Main Page | Related Pages

Configuring the Development Environment

Nintendo DS development requires a number of components all working together. Below is how the computer was configure on which this Guide was developed.

Hardware Requirements and Configuration

Most of the hardware required for NDS programming is available off the shelf, though some can be expensive.

Basic Hardware

In addition, a mechanism to run DS code from the GBA flash cart is required. There are a few ways to do this:

PassMe

The PassMe is a piece of hardware that sits between the NDS and a commerical cartridge. It works by allowing the Nintendo DS to handshake with the cartridge, but once the handshake is complete, it loads the data from the GBA cart and causes execution to start there. Effectively, it makes the NDS believe that the code that is being run has been loaded from the DS cartridge when in fact, it is running the homebrew code written to the GBA cartridge.

The best source of information related to the PassMe can be found at http://www.dspassme.com/ This site has information on both purchasing and building PassMe devices.

WiFi Pass Through

Firefly has a technique which allows running the GBA code by downloading pass-through code using the download application portion of the NDS. Note that this requires specific WiFi hardware. Information on this techinique is available at:

http://users.belgacom.net/bn967347/

Software Requirements and Configuration

Several pieces of software are required for NDS development. The good part is that all of it is available free of charge.

This section assumes that the ndsdev user will do the NDS development on the computer using the bash shell. Commands will require modification if another user or shell is used. At the completion of this section, the home directory of the developer will look like:

/home/ndsdev/devkitARM_r11 /home/ndsdev/ndslib /home/ndsdev/dualis /home/ndsdev/ds_projects/template

ARM Development Kit

The ARM development kit is available at http://sourceforge.net/projects/devkitpro/ This is the compiler for the ARM7 and ARM9 processors. The latest version at the time of writing was R11.

ndslib

This is a library that primarily provides definitions for various addresses within the NDS memory. In addition, it provides some routines to access the BIOS as well as an API to the 3D subsystem of the NDS. At the time of writing, there was no official release of ndslib. Places to look to obtain this library are:

Assuming that you've downloaded PhoenixRising's version of ndslib, do the following steps to configure ndslib:

cd ndslib make clean make cd startup cp *{.o,.ld,.specs} $HOME/devkitARM_r11/arm-elf/lib/ cp thumb/*.o $HOME/devkitARM_r11/arm-elf/lib/thumb cp interwork/*.o $HOME/devkitARM_r11/arm-elf/lib/interwork cp thumb/interwork/*.o $HOME/devkitARM_r11/arm-elf/lib/thumb/interwork

Dualis, the NDS Emulator

The primary website for dualis is http://dualis.1emulation.com/ . Unfortunately, it is only available as a windows application, and must be run from within wine. Simply download, unpack it in your home directory, and it is ready to run with wine. No additional configuration is required. Code provided within this tutorial was tested on dualis release 8.

The NDS Project Template.

Many developers use the template as a basis for starting their own projects. Once the template is working, it can be copied to each new project, and modifications can begin from there. The home of the template appears to be the NDSTech Wiki, located at:

http://www.bottledlight.com/ds/

Download ds_project_template.zip, then do the following:

mkdir ds_projects cd ds_projects unzip ../ds_project_template.zip

Note that as of the time of this writing, the boot/main.cpp of the template must be modified to support the PassMe. Here is a quote from the NDSWiki page:

For the new PassMe method, replace main() in template/boot/main.cpp: int main(int argc, char ** argv) { LoadBin(GETRAW(arm9_bin), 0x02004000, GETRAWSIZE(arm9_bin)); LoadBin(GETRAW(arm7_bin), 0x02380000, GETRAWSIZE(arm7_bin)); *(volatile uint32 *)0x027FFE24 = 0x02004000; CallARM7(); while (1) ; return 0; }

If this hasn't already been done to the main template, you will need to do this by editing template/boot/main.cpp

The template was developed with a Windows platform in mind, and the CommonMakefile.in must be modified and the NDSLIBPATH changed to /home/ndsdev/ndslib.

Testing the Configuration

Next, testing the configuration of the environment by building the template and executing it. The template should run in both Dualis as well as on the NDS.

cd ~/ds_projects/template make clean make

A successful compile results in these last few lines:

built ... boot.gba ROM fixed! make[1]: Leaving directory `/home/ndsdev/ds_projects/template/boot' mv boot/boot.gba template.ds.gba

Once the template is compiled successfully, it can be tested on the NDS. Note that dualis release 2 cannot run the template, but reportedly, release 3 can. However, as noted above, I have not tested release 3. Using dualis release 2 with this application causes two white screens to appear in the emulator:

140template.png

Dualis R2 Executing template.

Other Common Tools

Linux provides several other tools that will be of use while developing applications. Typically, your Linux distrubtion will provide a means to automatically install them.

Troubleshooting Configuration Issues

While compiling the template, I get a "mv: missing file argument" error.

This is normal behavior of the template. Also, all programs based on the template will do this as well. This error can safely be ignored.

When testing the template, both screens are white

This is normal behavior with Dualis R2.
Generated on Fri Apr 22 13:47:40 2005 for Homebrew Programmers Guide to the Nintendo DS by doxygen 1.3.6