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.

Beginners > DevKitARM setup question

#82494 - jensen - Sat May 06, 2006 10:14 pm

I have used devkitadv for a while and finally switched to devkitarm. using devkitpro-updater-1.2.7.exe i installed the devkitARM package with msys, libgba, etc.. After following a number of different tutorials, i basically arrive at the same crash point each time. When I limit the PATH variable to just the devkitarm\bin folder and run this batch file:
Code:
PATH= c:\devkitPro\devkitARM\bin;
arm-elf-gcc -mthumb-interwork -c first.c
arm-elf-gcc -specs=gba_mb.specs -mthumb-interwork first.o -o first.elf
arm-elf-objcopy -O binary first.elf first.gba
gbafix first.gba

I get this error. > collect2: _spawnvp: No such file or directory
If I add c:\devkitPro\msys\bin to the front of the PATH it hangs on the 3rd line (line where first.elf is outputted). after a while it dumps this..
Code:
c:\devkitPro\msys\bin\sh.exe: *** WFSO timed out
expr: syntax error
expr: syntax error
dirname: too few arguments
Try `dirname --help' for more information.
c:\devkitpro\devkitarm\bin\..\lib\gcc\arm-elf\4.1.0\..\..\..\..\arm-elf\bin\ld:
exec: .real: not found
collect2: ld returned 127 exit status

also, devkitpro and devkitarm are both declared in my env vars as /c/devkitpro during the auto-update. any help is greatly appreciated!

#82499 - Lord Graga - Sat May 06, 2006 10:37 pm

Welcome, another dane?

Maybe something is wrong with your PATH, try and paste it here.

#82500 - jensen - Sat May 06, 2006 10:49 pm

thanks for the reply! my system env path is set to
Quote:
c:\devkitPro\msys\bin;c:\devkitPro\devkitarm\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\system32\WBEM;C:\Program Files\Perl\bin\;C:\Program Files\Common Files\Adaptec Shared\System;C:\Nokia\Update_Manager\bin;c:\j2sdk1.4.2_06;c:\j2sdk1.4.2_06\bin;c:\j2me\midp2.0fcs\bin

i have tried including "PATH= c:\devkitPro\devkitARM\bin;" as the first line of my batch file (similar to what i'd do with devkitadv). yes another dane (but born in new jersery). my mor is from Koge and my far is from Taars.

#82522 - wintermute - Sun May 07, 2006 1:46 am

Hmm, in the first case you've discarded the path to msys/bin which is why you get the _spawnvp error. In the second case it appears that the elf2flt ld shellscript is failing - it appears that argv[0] is blank which really shouldn't be the case. I certainly can't reproduce this error here.

You can rename some files. In devkitPro/devkitARM/arm-elf/bin you'll see ld and ld.real.exe. Rename ld to ld.old and ld.real.exe to ld.exe then everything should work again.

Despite the fact that most tutorials show you how to use batch files to make compiling a project easier it's actually the wrong way to do it and has several flaws which will show up in more complex projects.

The right way is to use make and makefiles. devkitPro provides some example templates which are designed to allow the novice to get on with programming without understanding makefiles in detail. If you have the examples installed you'll find a simple base project which includes a PN2 project file. In your case c:\devkitPro\examples\gba\template

If you open up the makefile you'll see a block like this near the top

Code:

#---------------------------------------------------------------------------------
# TARGET is the name of the output, if this ends with _mb a multiboot image is generated
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# DATA is a list of directories containing data files
# INCLUDES is a list of directories containing header files
#---------------------------------------------------------------------------------
TARGET      :=   $(shell basename $(CURDIR))
BUILD      :=   build
SOURCES      :=   source
DATA      :=   
INCLUDES   :=


TARGET can be an actual name - the default entry is just a bit of code that uses the name of the directory so you don't even have to bother editing the makefile.

BUILD is the name of the folder where intermediate files will be placed. You don't have to worry about this either, it's simply to keep things tidy.

SOURCES is a list of directories which contain source files. These must be specified relative to the makefile directory, in this case <path/to/project/>source will be searched for .c and .cpp files.

DATA is the same thing for files which will be added as pure binary - don't worry about that for now.

INCLUDE is a list of directories for .h files which will be added to the compilers search path for includes. Again these are relative to the makefile .

All you really need to do is copy the template directory somewhere, rename it to suit and add your .c or .cpp files to the source directory. You can create an include directory and place your .h files in there or simply place those in the source directory too - the compiler searches for files specified with #include "<filename>.h" in the same directory as the .c or .cpp first.

Double click the .pnproj file and Programmer's Notepad should open, showing the files you've added in the project tree at the left. Clicking Tools->make should build the project leaving you with a .gba file in the top level project directory.

There are some guides to setting up some other editors in the FAQ.
_________________
devkitPro - professional toolchains at amateur prices
devkitPro IRC support
Personal Blog


Last edited by wintermute on Sun May 07, 2006 5:25 pm; edited 1 time in total

#82594 - jensen - Sun May 07, 2006 5:13 pm

Great! Changing the ld files fixed my problems. Many thanks for your guidelines with make files as well. Your feedback was extremely helpful!
Quote:
You can rename some files. In devkitPro/devkitARM/arm-elf/bin you'll see ld and ld.real.exe. Rename ld to ld.old and ld.real.exe to ld.exe then everything should work again.