GithubHelp home page GithubHelp logo

baodongsheng / libtransistor Goto Github PK

View Code? Open in Web Editor NEW

This project forked from reswitched/libtransistor

0.0 1.0 0.0 517 KB

Open source toolchain for Switch development

License: ISC License

Makefile 0.60% C 27.55% C++ 70.96% Assembly 0.73% Perl 6 0.08% Ruby 0.07%

libtransistor's Introduction

libtransistor

Build Status Chat on Discord

Libtransistor is a userland library for the Nintendo Switch. Currently, binaries can only be run under Mephisto or with pegaswitch with ACE on 3.0.0.

If you want to setup a Switch Homebrew Development Environment, go read The Guide !

Building

First, clone the repo with

git clone --recursive https://github.com/reswitched/libtransistor

You will need Python 2 and the python packages listed in requirements.txt. You'll also need clang and lld >=5.0 (llvm linker).

You should just be able to run make. If that doesn't work, submit an issue (or pull request). This will produce a number of nro and nso files in build/test/. These are binaries for the Nintendo Switch. NRO files are relocatable shared objects suitable for use with ROhan. Both NRO and NSO binaries can be run under Mephisto, but NSO binaries don't get relocated properly at the moment and will crash pretty quickly.

Building on Fedora

Fedora does not ship recent enough clang and lld binaries. However, pre-built clang binaries from llvm.org can be used.

Example:

wget -c http://releases.llvm.org/5.0.1/clang+llvm-5.0.1-x86_64-linux-gnu-Fedora27.tar.xz
tar xpf clang+llvm-5.0.1-x86_64-linux-gnu-Fedora27.tar.xz
export PATH=`pwd`/clang+llvm-5.0.1-x86_64-linux-gnu-Fedora27/bin:$PATH
cd libtransistor
make

If some of the cmake CXX tests fail, you may need to install the necessary dependencies.

sudo dnf -y install libstdc++-devel gcc-c++.x86_64

Running

$ ./ctu --load-nro <path-to-libtransistor>/build/test/<binary>.nro

For running the bsd test, you may want to also pass --enable-sockets. Don't pass that for anything you don't want phoning home, though.

Debugging

Because Mephisto comes with a GDB stub and we produce standard ELF files before converting to NSO/NRO, we can debug libtransistor binaries very easily.

$ ./ctu --load-nro <path-to-libtransistor>/build/test/<binary>.nro --enable-gdb
[GdbStub] INFO: Starting GDB server on port 24689...
[GdbStub] INFO: Waiting for gdb to connect...
$ aarch64-none-elf-gdb 
(gdb) target remote localhost:24689
Remote debugging using localhost:24689
warning: No executable has been specified and target does not support
determining executable automatically.  Try using the "file" command.
0x0000007100000080 in ?? ()
(gdb) add-symbol-file <path-to-libtransistor>/build/test/<binary>.nro.so 0x7100000000 -s .bss 0x7100000000
add symbol table from file "<path-to-libtransistor>/build/test/<binary>.nro.so" at
	.text_addr = 0x7100000000
	.bss_addr = 0x7100000000
(y or n) y
Reading symbols from <path-to-libtransistor>/build/test/<binary>.nro.so...done.
(gdb) 

libtransistor's People

Contributors

d3m3vilurr avatar daeken avatar dvdfreitag avatar kgsws avatar maci0 avatar misson20000 avatar pokemod97 avatar roblabla avatar vgmoose avatar xyzz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.