|
NDS
Dev Env versus Manual Installation
If you have not seen NDS
Dev Env,
the simple installer that sets everything up for you,
then I recommend you check it out a.s.a.p! If you would
rather
get your Nintendo DS
development environment setup manually, then proceed. One
word of
caution: I will
not
be updating
this page very often - if ever - and I'll assume you are using NDS Dev
Env.
Notes
Do not use any spaces in directory names.
Assumptions
I do my development on a Windows XP SP2 machine.
I'll assume that this tutorial works fine on Windows 2000 and XP Pro or
Home.
I much prefer to see
file extensions and I recommend
you enable this on your computer.
Software
Checklist:
DevkitARM
(Current Version: Release
11)
MSys
(Current Version: 1.0.10)
ndslib
(Current
Version: CVS
only)
TortoiseCVS
(Current
Version: 1.8.13)
Nintendo
DS program template (updated
version of Joat's)
Dualis
(Current Version: Release
7)
emulator
Step
1
- Create Parent
Directory
Be Aware: The directory structure is really up to you, but if you don't
use exactly what is
in this tutorial, you'll have to manually edit files, pathnames, etc.
Browse to your C: drive and create a directory called ndsdev.
Note:
It seems that a lot of people want to do the install in a different
directory or on a
different drive. I'll highlight in
this color when/where you'll
have to make changes.
Step 2
- Setup DevkitARM
Download DevkitARM
Release 11 (4.9 MB)

Double-click devkitARM_r11-win32.exe
and extract
to C:\ndsdev

Browse to C:\ndsdev
Rename devkitARM_r11
to devkitarm
(this is very
important!)

Add C:\ndsdev\devkitarm\bin;
to Path System
Variable
(Control
Panel -> System ->
Advanced -> Environment Variables
More information about this can be found here)

If you
installed to a different path, make sure Path is set properly.
Step 3
- Setup MSys
Download MSys
1.0.10 (2.7 MB)
Install using all defaults except
change the path to C:\ndsdev\msys\1.0.

When prompted to do post-install,
type n
and press Enter.
Add C:\ndsdev\msys\1.0\bin;
to Path System
Variable
(Control
Panel -> System ->
Advanced -> Environment Variables
More information about this can be found here)

If you
installed to a different path, make sure Path is set properly.
Your c:\ndsdev
directory
should look something like this:

Step
4
- Setup ndslib
Currently there are two ways to get ndslib.
For the most up-to-date, though sometimes buggy or most
likely to
have changes that break stuff that worked the day before, there's
CVS. This can
be a bit of a pain for the beginner so I'll walk you through setting up
TortoiseCVS below. If you would rather just download a zipped
version of ndslib, scroll
down.
Download TortoiseCVS
1.8.13 (4.7 MB)
Install using the defaults and reboot your computer when it's done.
After rebooting, browse to C:\ndsdev.
Right-click where there are no icons and left-click CVS Checkout...

Fill in the the options so that it looks exactly like this

Basically, copy and paste the following line into the field next to CVSROOT:
:pserver:anonymous@cvs.sourceforge.net:/cvsroot/ndslib
and then type ndslib
next to Module:
Click OK
and it should begin checking out (downloading) ndslib.
When it's finished, there should be no errors.

If
you prefer to just download a
zipped version of ndslib, then get the file here
(94 KB).
Extract ndslib.zip
into C:\ndsdev.
Your C:\ndsdev
directory should now look
something like this:

Before we install ndslib, we have to let it know where we installed
DevkitARM.
Go into the ndslib
directory now and right-click Install.bat
and left-click Edit.

Change the first line to SET
DEVDIR=C:\ndsdev\devkitarm. (Or wherever you
installed it)

Now, double-click Install.bat
and cross your fingers!
Hopefully there will be no errors. At some point you'll be
prompted to
copy
crt files and linkerscript
to
devkit arm lib directory?
(must
be done manualy if not)
yes
or no?
Type yes
and press Enter.
That's it. At this point you have what you need to start
compiling your first
Nintendo DS demo/game/whatever so let's move on to that!
Step
5
- Compile the
template
Download the updated version (thanks DesktopMan) of Joat's template
that I
updated here.
Browse to C:\ndsdev.
Create a directory called projects.
Extract template.zip
into the projects
directory. It should
look something like this:

Open a Command
Prompt (Start
-> Run
-> cmd)
and go to that directory
(cd
C:\ndsdev\projects\template).
In the template
directory, you'll see a file called CommonMakefile.in.
I already edited that file and put in the
correct paths.
If you are installing into a different directory, then you'll have to edit that file
manually. You
only have to modify this line:
export
NDSLIBPATH
:= /c/ndsdev/ndslib
Type make
and press Enter.
With any luck, you'll see the following. (Ignore the mv
errors. Any others could be
bad.)

Step
6
- Emulate the
Nintendo DS to test
Okay, so the last thing you'll want to do is emulate
something.
The template doesn't do anything in Dualis, so we won't bother
emulating that. If you're lucky enough to have a PassMe
device,
then give it a test on a real NDS. Otherwise, we'll get a
copy of DesktopMan's Tetris demo and run it in the Dualis emulator.
Download
Dualis
You can download Dualis.
Browse to
C:\ndsdev.
Create a directory in there called emulators.
Create a directory in there called dualis
and extract dualis-7.zip
into
that directory.
It should look something like this:

Download
the Tetris 1.0 demo
You can download the entire Tetris rom and source code from here.
Or, you can get just the Tetris executable from here.
Browse to C:\ndsdev.
Create a directory in there called roms.
Copy Tetris.bin
into the roms
directory.
It should look something like this:

No go back to C:\ndsdev\emulators\dualis
and double-click dualis.exe.

Click File
-> Load
and execute..
and then browse to C:\ndsdev\roms\Tetris.bin.
With any luck, you'll see something like this:

Feel free to play some Tetris for a while - you've earned it!
At this point you are ready to start coding for the Nintendo DS.
Microsoft
Visual Studio
NOTE:
I have
decided to use Programmer's
Notepad 2.x as the official IDE
for NDS Dev Env.
I'll assume you are going to use the same from this point on, but it
should be similar if you
are using VS instead.
Who wants to do everything from a command line when you've got Visual
Studio?
Here's how to get Visual Studio setup to compile our DS binaries.
Note:
I use Visual
Studio 2003 so your mileage may vary depending on which version you use.
Open Visual Studio
Click Tools
-> Options
Scroll down and click on Projects
Click on VC++
Directories
Under Platform,
make sure Win32
is listed
Under Show
directories for,
make sure Executable
files is
listed
Now scroll down to the bottom of the list and add these
C:\ndsdev\msys\1.0\bin
C:\ndsdev\devkitarm\bin
(or whatever
your install directory is)
It should look something like this (though I'm sure you'll have more in
the list):

Let's see if we can build the template solution.
In Visual Studio click File
-> Open
Solution
Browse to C:\ndsdev\projects\template
Double-click dsdemo.sln

You might be prompted to Convert this
solution and all of its projects.
If so, click Yes.

Click Build
-> Build
Solution
With any luck you'll see this:
----------------------
Done ----------------------
Build:
1 succeeded, 0 failed, 0 skipped
Yay!
Closing
Thoughts
First of all, this tutorial on getting your development environment
setup is subject to change at any time. As
software/libraries/etc. get updated, so will this
page.
Please check it often to see what's changed - or go to the Version
History page for more details.
Some day, maybe soon, ndslib will have regular releases and you will no
longer have to bother with CVS. Until then, you may
want to
re-check ndslib out of CVS regularly. Please refer to Step 4
if necessary. If you want to check the
file dates/versions of ndslib, go here.
What next? Until I can find the time to work on the next
couple
of day's tutorials, you are on your own. If you downloaded
the Tetris
source code,
why don't you take a look at it and see what you can figure
out?
There is other source code available, you'll just have to do some
Googling!
|