gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Development environment on Linux?

#41452 - takochan - Thu Apr 28, 2005 6:03 pm

Hello.

I am trying to set up a development environement for Linux, but I have some problems. I read on the forums that some of you successfully installed one...

The devkit just works out of the box ; however there are several include and lib directories, I wonder which one should I add to my gcc variables.

The real problem seems to be ndslib, when I try to compile the "hello world" example from Dovoto, it tries to launch a Windows executable (examples/tools/ndstool.exe).

Well, to be true I don't know where to start from - is there a tutorial to set-up a development enviroment on a Linux machine?


Last edited by takochan on Sun May 01, 2005 2:34 pm; edited 1 time in total

#41453 - ghod - Thu Apr 28, 2005 6:10 pm

I have this same problem when trying to develop with linux. The souce for ndstool can be gotten from: http://darkfader.net/ds/ . Once I built this binary and placed it in the examples/tools directory, it worked, except now it is looking for dsbuild.exe which I haven't yet found the source for.

#41458 - josath - Thu Apr 28, 2005 6:50 pm

instead of using dsbuild.exe, download this:
http://darkfader.net/ds/files/ndsmall.bin
and then this is the command to convert an .nds to a .nds.gba
Code:
cat ndsmall.bin mygame.nds > mygame.nds.gba

I believe that it is more compatible than using dsbuild.exe, but i could be wrong. Here is the source to dsbuild if you want it: http://rorexrobots.com/ds/dsbuild.cpp

For ndstool, make sure to check that the linux version actually works. For some reason, when I compiled it under linux, it didn't work right. But, wine runs ndstool.exe fine. So in my examples/tools folder, I left ndstool.exe there, and created a script called 'ndstool':
Code:
# ndstool script to launch wine, in the correct path
wine `dirname $0`/ndstool.exe $*

So when the makefiles call ndstool, they will hit the script first, which will launch wine on ndstool.exe, passing along any paramaters.

As far as variables, I only need to do this to my path: (I have devkitarm in ~/ds/devkitarm)
Code:
export PATH=$PATH:~/ds/devkitarm/bin

Also you have to make sure to copy the startup scripts from ndslib to the devkitarm directory.
Create a script in the ndslib/startup dir called go.sh:
Code:

DEVDIR=/home/davidr/ds/devkitarm

cp *.o $DEVDIR/arm-elf/lib/
cp *.ld $DEVDIR/arm-elf/lib/
cp *.specs $DEVDIR/arm-elf/lib/
cp thumb/*.o $DEVDIR/arm-elf/lib/thumb/
cp interwork/*.o $DEVDIR/arm-elf/lib/interwork/
cp thumb/interwork/*.o $DEVDIR/arm-elf/lib/thumb/interwork/

Make sure to set DEVDIR correctly to your devkitarm directory. then run it.

Here's is a guide to ndsdev on linux: Nintendo DS on Linux guide

#41709 - takochan - Sun May 01, 2005 1:14 pm

Hello, and thank you for your answers!

I tried to set up a developement environement using the Linux development tutorial (I was very happy to find one) but I had some problems.

First of all, there is an inconstancy between ndslib and the template. In ndslib, there is this function:
Code:

uint32 touchReadTemperature(int * t1, int * t2);


...But in arm7/main.cpp the example call it as if it was:
Code:

uint32 touchReadTemperature(int t1, int t2);

I corrected it.

Secondly, in the arm9/main.cpp there are the following lines:
Code:

   DISPLAY_CONTROL = MODE_0_2D;
   SUB_DISPLAY_CONTROL = MODE_0_2D;


but neither DISPLAY_CONTROL nor SUB_DISPLAY_CONTROL appear in ndslib. I commented these lines.

After compilation, I get a .ds.gba file, so I can not test it using dualis (additionnally I can not test it on my DS since I don't have my GBA Card yet). How can I produce a file readable by an emulator?

#41727 - DaBigJHall - Sun May 01, 2005 3:35 pm

The file readable by Dualis is the arm9.bin found in the template\arm9\ directory, or in the template\boot\resources\ directory. I don't know about other emulators, though. Hope that helps :)

I think DISPLAY_CONTROL and SUB_DISPLAY_CONTROL changed to DISPLAY_CR and SUB_DISPLAY_CR, respectively. I think the videoSetMode() and videoSetModeSub() macros do the same thing as assigning values to those variables, but then again, I could have no idea what I'm talking about right now :).
_________________
Yep, it's a signature.

#41741 - takochan - Sun May 01, 2005 4:53 pm

Thank you, it works now.

#42216 - oxymen - Sun May 08, 2005 2:29 am

I went through the guide for ndsdev on linux.
when I try to compile the template I get this list of errors:

Code:

make

rm -rf arm9/arm9.bin
rm -rf arm7/arm7.bin
make -C arm7 -I /home/ndsdev/ds_projects/template
make[1]: Entering directory `/home/ndsdev/ds_projects/template/arm7'
mv: missing file argument
Try `mv --help' for more information.
make[2]: [all] Error 1 (ignored)
main.cpp
/home/ndsdev/ds_projects/template/arm7/./main.cpp:6:21: NDS/NDS.h: No such file or directory
/home/ndsdev/ds_projects/template/arm7/./main.cpp:8:27: NDS/ARM7/BIOS.h: No such file or directory
/home/ndsdev/ds_projects/template/arm7/./main.cpp:9:28: NDS/ARM7/touch.h: No such file or directory
/home/ndsdev/ds_projects/template/arm7/./main.cpp:10:28: NDS/ARM7/clock.h: No such file or directory
/home/ndsdev/ds_projects/template/arm7/./main.cpp: In function `void InterruptHandler()':
/home/ndsdev/ds_projects/template/arm7/./main.cpp:18: error: `IF' undeclared (first use this function)
/home/ndsdev/ds_projects/template/arm7/./main.cpp:18: error: (Each undeclared identifier is reported only once for each function it appears in.)
/home/ndsdev/ds_projects/template/arm7/./main.cpp:18: error: `IRQ_VBLANK' undeclared(first use this function)
/home/ndsdev/ds_projects/template/arm7/./main.cpp:21: error: `IPC' undeclared (firstuse this function)
/home/ndsdev/ds_projects/template/arm7/./main.cpp:24: error: `XKEYS' undeclared (first use this function)
/home/ndsdev/ds_projects/template/arm7/./main.cpp:27: error: `TSC_MEASURE_X' undeclared (first use this function)
/home/ndsdev/ds_projects/template/arm7/./main.cpp:27: error: `touchRead' undeclared (first use this function)
/home/ndsdev/ds_projects/template/arm7/./main.cpp:28: error: `TSC_MEASURE_Y' undeclared (first use this function)
/home/ndsdev/ds_projects/template/arm7/./main.cpp:29: error: `TSC_MEASURE_Z1' undeclared (first use this function)
/home/ndsdev/ds_projects/template/arm7/./main.cpp:30: error: `TSC_MEASURE_Z2' undeclared (first use this function)
/home/ndsdev/ds_projects/template/arm7/./main.cpp:33: error: `uint8' undeclared (first use this function)
/home/ndsdev/ds_projects/template/arm7/./main.cpp:33: error: expected primary-expression before ')' token
/home/ndsdev/ds_projects/template/arm7/./main.cpp:33: error: `rtcGetTime' undeclared(first use this function)
/home/ndsdev/ds_projects/template/arm7/./main.cpp:34: error: expected primary-expression before ')' token
/home/ndsdev/ds_projects/template/arm7/./main.cpp:34: error: `BCDToInteger' undeclared (first use this function)
/home/ndsdev/ds_projects/template/arm7/./main.cpp:37: error: `touchReadTemperature' undeclared (first use this function)
/home/ndsdev/ds_projects/template/arm7/./main.cpp: In function `int main(int, char**)':
/home/ndsdev/ds_projects/template/arm7/./main.cpp:50: error: `rtcReset' undeclared (first use this function)
/home/ndsdev/ds_projects/template/arm7/./main.cpp:53: error: `IME' undeclared (firstuse this function)
/home/ndsdev/ds_projects/template/arm7/./main.cpp:54: error: `IRQ_HANDLER' undeclared (first use this function)
/home/ndsdev/ds_projects/template/arm7/./main.cpp:55: error: `IE' undeclared (first use this function)
/home/ndsdev/ds_projects/template/arm7/./main.cpp:55: error: `IRQ_VBLANK' undeclared(first use this function)
/home/ndsdev/ds_projects/template/arm7/./main.cpp:56: error: `IF' undeclared (first use this function)
/home/ndsdev/ds_projects/template/arm7/./main.cpp:57: error: `DISP_SR' undeclared (first use this function)
/home/ndsdev/ds_projects/template/arm7/./main.cpp:57: error: `DISP_VBLANK_IRQ' undeclared (first use this function)
/home/ndsdev/ds_projects/template/arm7/./main.cpp:61: error: `swiWaitForVBlank' undeclared (first use this function)
make[2]: *** [main.o] Error 1
make[1]: *** [build] Error 2
make[1]: Leaving directory `/home/ndsdev/ds_projects/template/arm7'
make: *** [all] Error 2


What is wrong?

#42219 - DaBigJHall - Sun May 08, 2005 2:34 am

GCC isn't finding your include files. Did you copy the NDS folder in ndslib\include to devkitARM_r11\arm-elf\include? That should fix the problem.
_________________
Yep, it's a signature.

#42249 - wintermute - Sun May 08, 2005 1:24 pm

DaBigJHall wrote:
GCC isn't finding your include files. Did you copy the NDS folder in ndslib\include to devkitARM_r11\arm-elf\include? That should fix the problem.


don't ever do this with libraries that aren't specifically written to be installed in this manner. In the case of arm toolchains four separate versions are required to be placed in the compiler tree. Always use the -I & -L options to work with external libraries.

There are now a number of examples which show how to do this properly. My best advice at this point is to wait for the impending release of devkitARM r12.

#42254 - DaBigJHall - Sun May 08, 2005 3:56 pm

Oops! I'll have to go and change those, then :) I've been meaning to update my libogc and libnds from the CVS anyway.

Stupid me :D
_________________
Yep, it's a signature.

#42262 - tepples - Sun May 08, 2005 6:25 pm

wintermute wrote:
In the case of arm toolchains four separate versions are required to be placed in the compiler tree.

Even if only the -mthumb -mthumb-interwork version is ever used?

Quote:
Always use the -I & -L options to work with external libraries.

Isn't -I deprecated in newer GCC? Or is -I- something different?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#42267 - josath - Sun May 08, 2005 6:43 pm

you have to set the env variable NDSLIBPATH in bash i just do:
export NDSLIBPATH=/home/davidr/ds/ndslib/
(i think the last slash might be important, put it just in case)
then i don't get the 'not found' errors

#42268 - wintermute - Sun May 08, 2005 7:15 pm

tepples wrote:


Isn't -I deprecated in newer GCC? Or is -I- something different?


-I- is something different.

http://gcc.activeventure.org/Directory-Options.html