One thing worth mentioning that's part of the DevKitPro is the "templated" build directories for Nintendo DS projects. I figured I'd give them a brief explanation since they're kind of unique to DKP.

You'll find them in [DevKitPro root dir]/examples/nds/templates/.
There should be two sub-directories:
  • arm9/
  • combined/

arm9/ is the simpler of the two, but is for projects that only require an arm9 executable. combined/ is a bit more complicated but allows for easily creating programs that use both the arm7 and arm9.

I'll only talk about the combined/ directory because you can limit yourself to the arm9/ sub-directory if all you want to do is mess around with the arm9, AND you can continue using the same template you've gotten used to as you move on to more complex projects and actually need both processors. In any case, most things apply to both templates in one way or another, it's just that in the case of combined/ it may be found in a subdirectory.

Template Prep

First, what I did was copy the combined/ directory to a location where I can easily find it when doing DS programming. I then renamed it "template", but you can call it whatever you want. The basic idea is to be able to just make a copy and rename it for each project you want to start, and you'll have a nice build environment ready to go.

Next, I made some changes to the default template because there's some unnecessary junk there (afaic):

If you don't use Programmer's Notepad you can safely delete template.pnproj, template.pnps, and template.prj.

cd [template directory]
rm template.*

I honestly have no idea why this is included with DKP. Maybe they own stock in it or something.

Next, you're going to want to do a "make clean". At the time of this writing the template directories are being distributed already built. This can cause problems for you during the linking phase of your project if your directory structure isn't setup just like the developers:
make clean
Now create a "data" subdirectory in the arm7/ and/or arm9/ subdirectories and add them to the relevant Makefile's list of subdirectories:

# For arm9/
cd arm9
mkdir data

Edit arm9/'s Makefile from this:
BUILD  := build
SOURCES := source
INCLUDES := include

To this:
BUILD  := build
SOURCES := source
INCLUDES := include
DATA := data # Or whatever you called the subdirectory you created

Your template build directory is ready to go!

Template Usage

Creating new projects is as simple as:

  1. Copying your template directory

  2. Renaming it something that fits your project

  3. Adding files as shown below

+- arm9/
+- source/ ; Put all source files (*.c, *.cpp, etc.) here
+- data/ ; Binary files (*.bin) go here
+- build/ ; Project will be built here. Also, *_bin.h files generated
; for your *.bin files will end up here.
+- arm7/ ; Basically same as arm9/ directory

Change to the [root] directory, run "make" to build everything, and you should have a nice *.nds file waiting for you to debug. =)