3DS Homebrew Development
|Introduction • Homebrew Development • Glossary • Flashcart FAQ|
|Lists||All Homebrew • Applications • Games • Emulators • Demos • CFWs • Exploits • Development libraries & tools • PC Utilities|
This page contains general information for 3DS Homebrew developers.
If you have any questions, you can come to GBAtemp's main homebrew development and help thread. It contains shared sources, examples and libraries.
You can find all known resources (hardware registers, syscalls, utilities) to develop your homebrew on 3dbrew.
To develop 3DS homebrew you need a development environment consisting of tools, scripts and libraries which will be detailed below. The sources are compiled to binary using GNU GCC-ARM or devkitPro with devkitARM. The available tools and SDK work on Windows 32/64bit and Linux.
The languages used to write homebrew are C and C++ (and occasionally ASM). There are various online tutorials and books available to learn these languages.
Alternatively, you can also write homebrew in Lua by using Lua Player Plus.
- 1 Install devkitPro
- 2 Compiling sources
- 3 SMDH
- 4 Editor setup
- 5 3dsx homebrew
- 6 Launcher.dat and 3ds homebrew
- 7 Packing CIA files
- 8 Releasing
DevkitPro is an essential set of toolchains for homebrew development.
Use the automated-installer. Install in C:\devkitPro\ and it will install all the latest versions of the required programs (you can disable devkitPSP, but be sure to enable CTRULib in DevkitARM menu). It will create the environment variables automatically.
Linux / OSX
1) Download the devkitPro perl script
2) Download the latest ctrulib from GitHub. Place the ctrulib folder in the same location as the perl script
3) Open a terminal and execute these commands:
cd /path/to/the/script chmod +x devkitARMupdate.pl sudo ./devkitARMupdate.pl /opt/devkitPro echo "export DEVKITPRO=/opt/devkitPro" >> ~/.bashrc echo "export DEVKITARM=\$DEVKITPRO/devkitARM" >> ~/.bashrc echo "export PATH=\$PATH:\$DEVKITARM/bin" >> ~/.bashrc source ~/.bashrc cd ctrulib/libctru make sudo -E make install
If the last line gives an error about not being allow to preserve the environment, run these commands instead:
sudo -s export DEVKITPRO=/opt/devkitPro export DEVKITARM=$DEVKITPRO/devkitARM make install exit
You may want to install various libraries/tools if your project requires them.
If you simply want to compile a homebrew project without (or after) editing it, you can use the
make utility from the command prompt/terminal.
1) Windows: Open a Command Prompt (Run -> cmd); Linux/Mac OSX: Open a Terminal from your applications
2) Navigate to the project directory (change to the correct path)
3) Run make
If you ever want to remove the compiled files, you can use this command:
This is often needed when re-compiling a project.
cannot find 3dsx_crt0.o: No such file or directory
In your makefile, find
-mfloat-abi=softfp and change it to
-mfloat-abi=hard. You shouldn't ever use
softfp for 3DS homebrew.
(name) uses VFP register arguments but (name2) does not
Part of your project or the libraries you use were compiled with
-mfloat-abi=softfp while other parts were compiled with
-mfloat-abi=hard. Make sure to use
-mfloat-abi=hard everywhere. You may have to manually recompile the libraries you use, if needed.
Every homebrew application has an smdh file, containing additional information:
- Name of the application (Short description)
- Description of the application (Long description)
- Name of the author (Publisher)
This information is used in The Homebrew Launcher (3DSX), and in the home menu (3DS/CIA).
The icon is a simple 48x48px png file. You can place this png in your project folder (the same folder as your Makefile is in) and name it icon.png. If no icon.png is present, a default icon from the ctrulib folder will be used.
The other data can be set in the Makefile directly:
APP_TITLE := My Application APP_DESCRIPTION := A description of my app APP_AUTHOR := Me
The SMDH file is automatically created when building the project (unless you explicitly set NO_SMDH in the Makefile).
bannertool makesmdh -s "My application" -l "A description of my app" -p "Me" -i icon.png -o myapplication.smdh
This section explains how to set up various editors to edit and compile (existing) homebrew projects. If you want to start a new homebrew project, you should preferably copy an example project and edit the sources.
Note that this section lists only the more advanced editors which have features such as code auto-completion. You can use any text editor to edit the source files and compile as detailed above. You should however use a proper code editor (aka not notepad). Some examples are Notepad++, Sublime Text, vim, and Emacs.
The Programmers Notepad is (optionally) installed by the devkitPro installer.
1) File -> New -> Project
Give it a name and save anywhere.
2) Right click the project -> Add Files
Now navigate to the example you want and add the files from that folder (eg. Makefile, readme.md, ...)
3) Right click the project -> Add Magic Folder
Navigate to the example directory again and add the source folder within. Repeat this for any other folders in the example (if any).
4) You can build the project using Tools -> Make
Make sure the project you want to build is the active project (Right click project -> active project)
Visual Studio 2015 (community)
When installing Visual Studio, make sure to install the Visual C++ packages!
1) File -> New -> Project From Existing Code...
2) In the dropdown, choose Visual C++ and click Next
3) Under Project file location, navigate to the folder with all sources. Enter a name for the project and click next.
4) Use external build system, Next
5) Build command line:
Clean command line:
Leave the rest blank. Click Finish.
6) Right click project (in the solution explorer) -> properties
7) Under VC++ directories -> General -> Include directories, add the devkitARM and ctrulib include directories (change if needed):
Make sure not to remove anything already in the box! You can add any other include folder that the project may need as well. In the end it'll read something like:
8) (Optional) Right click project -> Add -> Existing Item
Choose the Makefile and any other files you want to add, then click Add. This step isn't required, but allows you to edit the Makefile etc. from the editor.
Alternatively, you can use "Show All Files" under the "Project" menu (on the top) to display all files and folders as they are on the file system.
9) You can now build the project (Right click -> Build)
Tested with the standalone Eclipse Mars CDT on Linux. Instructions may be slightly different for other cases.
1) File -> New -> Makefile Project with Existing Code
2) Under Existing Code Location, navigate to the folder containing the code.
You can leave both C and C++ checked, even if the project only contains one.
Under Toolchain for Indexer Settings, choose a valid Toolchain (eg. Linux GCC)
3) Right click the Project in the project explorer and choose properties.
4) Go to C/C++ Build -> Environment.
Here you need to add the DEVKITPRO and DEVKITARM variables, with their correct paths, eg.
Make sure to change the values to the paths on your system.
5) This step isn't needed to build, but it will make Eclipse recognize the external libraries when editing code.
Go to C/C++ General -> Paths & Symbols -> Includes
Under "GNU C" (or "GNU C++", or both, depending on what files your project has), add the following include directories:
Again, change the paths if needed. When finished, click OK.
6) You can now build the project. Right click project -> Build project
Homebrew in this format is the most common, and can be played with ninjhax/ironhax/tubehax. No additional steps have to be taken to create this kind of homebrew; it is the default format produced when using
You can find ctrulib homebrew examples here: https://github.com/smealum/ctrulib/tree/master/examples
Launcher.dat and 3ds homebrew
If you don't need Kernel access, prefer developing homebrew in 3dsx format. Also remember that the .dat format works only on 4.1.x-4.5.x consoles.
Convert .elf to .3ds
To create a .3ds file (or .cia), you need some additional files in your project (TODO: Make guide on how to create these):
- An RSF file - Contains various info such as permissions etc.
- An icon.bin - The icon and information for the home menu. This is equivalent to the compiled SMDH file, so you can just use that one.
- A banner.bin - The banner for the top screen
You should preferably put them in your project folder (or a subfolder).
After building the project (see above), you should have an .elf file. You can convert this into a .3ds file:
- Download makerom (and compile it with
- Add the folder where you placed the makerom executable to your PATH environment variable
- Open a command prompt/terminal and navigate to your project
- Run the following commands:
arm-none-eabi-strip [ELF file] makerom -f cci -o [Destination .3ds file] -rsf [RSF file] -target d -exefslogo -elf [ELF file] -icon [icon file] -banner [banner file]
arm-none-eabi-strip myproject.elf makerom -f cci -o myproject.3ds -rsf gw_workaround.rsf -target d -exefslogo -elf myproject.elf -icon myproject.smdh -banner banner.bin
Please note that the first command will alter the ELF file, so you may want to back it up first.
Packing CIA files
CIA files are generic data containers that can be installed on a 3DS. In order to do this you need to have a 3DS below 9.2.
The process of building a CIA is similar to building a .3DS file:
arm-none-eabi-strip myproject.elf makerom -f cia -o myproject.cia -rsf cia.rsf -target t -exefslogo -elf myproject.elf -icon myproject.smdh -banner banner.bin
Note that the used RSF file is not the same one as the one used for building .3DS files.
When you are ready to release your homebrew application, create a new thread in the Homebrew Development section. In this thread, you can describe your project.
Make sure to attach (or link to an uploaded version of) the relevant files for your homebrew. This will usually be the 3DSX and SMDH files that have been compiled. You can also include the ELF file, which will allow people to repack it with makerom to a 3DS (and CIA) file. The ELF file can also be used on 3DS Emulators (currently two available: Citra and 3DMoo).
If your project is open source, you can upload the code to GitHub. Alternatively, you can simply provide the source as a separate download, or include it with the compiled files.