• Increase font size
  • Default font size
  • Decrease font size
Those who desire to give up freedom in order to gain security will not have, nor do they deserve, either one - Benjamin Franklin
Home Development Multimedia Nintendo DS Development environment setup

Nintendo DS Development environment setup

Today let's help Nintendo DS owners willing to develop some homebrew software!

Installing devkitARM

Devkitpro is a toolchain: a set of tools to compile programs on various platforms (ARM, PPC or MIPS). The NDS has an AMR7 and ARM9 processors, so we'll download devkitARM.

mkdir -p ~/nds/devkitpro
cd nds/devkipro
tar xjvf devkitARM_r23b-i686-linux.tar.bz2

Devkitpro projects need the environment variables DEVKITPRO and DEVKITARM. Let's set them in a script:

cd ..
cat > << EOF
export DEVKITPRO=~/nds/devkitpro

Now when opening a terminal you'll have to type this command before starting compilation:


Installing libnds

Now that we have installed the chaintool, we have to get the libnds library and extract it in a subfolder of devkitpro.

mkdir $DEVKITPRO/libnds
mv libnds-20071023.tar.bz2 $DEVKITPRO/libnds
cd $DEVKITPRO/libnds
tar xjvf libnds-20071023.tar.bz2
ln -s basic.arm7 default.arm7
cd ../..

Additional libraries

Other libraries are not required to start developing on NDS but they might be very handy. The first one is libfat.

mkdir $DEVKITPRO/libfat
mv libfat-src-20080530.tar.bz2 $DEVKITPRO/libfat
cd $DEVKITPRO/libfat
tar xjvf libfat-src-20080530.tar.bz2
cd ..

We need to fix a few things prior to compile it:

cat > libfat_nfstypes_fix.patch << EOF
--- libfat/include/fat.h    2008-05-10 21:34:41.000000000 +0200
+++ libfat_fixed/include/fat.h    2008-09-16 16:12:50.000000000 +0200
@@ -54,7 +54,7 @@
#  include <gctypes.h>
#  ifdef NDS
-#    include <nds/ndstypes.h>
+#    include <nds/jtypes.h>
#  else
#    include "gba_types.h"
#  endif
diff -ru libfat/nds/include/fat.h libfat_fixed/nds/include/fat.h
--- libfat/nds/include/fat.h    2008-05-10 21:34:58.000000000 +0200
+++ libfat_fixed/nds/include/fat.h    2008-09-16 16:04:56.000000000 +0200
@@ -40,7 +40,7 @@
#define NDS

-#include <nds/ndstypes.h>
+#include <nds/jtypes.h>


diff -ru libfat/nds/include/nitrofs.h libfat_fixed/nds/include/nitrofs.h
--- libfat/nds/include/nitrofs.h    2008-05-12 11:03:44.000000000 +0200
+++ libfat_fixed/nds/include/nitrofs.h    2008-09-16 16:12:30.000000000 +0200
@@ -31,7 +31,7 @@
#ifndef _NITROFS_H
#define _NITROFS_H

-#include <nds/ndstypes.h>
+#include <nds/jtypes.h>

#ifdef __cplusplus
extern "C" {
diff -ru libfat/source/common.h libfat_fixed/source/common.h
--- libfat/source/common.h    2008-05-10 21:34:41.000000000 +0200
+++ libfat_fixed/source/common.h    2008-09-16 16:12:09.000000000 +0200
@@ -43,7 +43,7 @@
#include <gctypes.h>
#  ifdef NDS
-   #include <nds/ndstypes.h>
+   #include <nds/jtypes.h>
#include <nds/system.h>

#  else
diff -ru libfat/source/libfat.c libfat_fixed/source/libfat.c
--- libfat/source/libfat.c    2008-05-23 21:37:46.000000000 +0200
+++ libfat_fixed/source/libfat.c    2008-09-16 16:05:11.000000000 +0200
@@ -111,7 +111,8 @@

if (setAsDefaultDevice) {
char filePath[MAXPATHLEN * 2] = "fat:/";
-#ifndef GBA
+#if defined(NDS) || defined(GBA)
if ( __system_argv->argvMagic == ARGV_MAGIC && __system_argv->argc >= 1 ) {

if ( !strncasecmp( __system_argv->argv[0], "fat", 3)) {
patch -p0 < patch_libfat.patch

cd libfat
make nds-release && make nds-install

If you want to use the NDS network capabilities you will need DSwifi

mkdir $DEVKITPRO/dswifi
mv dswifi-src-0.3.4.tar.bz2 $DEVKITPRO/dswifi
cd $DEVKITPRO/dswifi
tar xjvf dswifi-src-0.3.4.tar.bz2
make && make install
cd ../..

Allright, now you have a functionnal DevkitPRO and libnds install. To test this environment you can try some nds examples and install emulators like no$gba or desmume (this one is available as a debian package) to see the result.

Have fun Wink

Add New Search
Write comment
[b] [i] [u] [url] [quote] [code] [img] 
Please input the anti-spam code that you can read in the image.

3.26 Copyright (C) 2008 / Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."