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.

Coding > GbaDev Compile with crt0.s and linkscrpit doubt ;(

#4061 - rome - Mon Mar 17, 2003 2:01 pm

i?m trying compile Gbadev with crt0.S v1.26 by Jeff Frohwein, in my gba C plus plus project.
the project has only 4 files. gba.c and crt0.s (linkscript file of course)
crtbegin.o and crtend.o to cplus cplus projects

i wanna compile just to test if interrupts are enabled. but when i compile it gets a warning:

/cygdrive/c/DEVKIT~1/BIN/../lib/gcc-lib/arm-agb-elf/3.0.2/../../../../arm-agb-el
f/bin/ld: warning: cannot find entry symbol _start; defaulting to 08000000

what?s wrong? the elf files wasnt created :(

see below whats done in makefile:

Code:

All : gba.bin

gba.bin : gba.elf
   objcopy -O binary gba.elf gba.bin

gba.elf: crt0.o gba.o crtbegin.o crtend.o
   gcc -nostartfiles -Tlnkscript -o crt0.o gba.o crtbegin.o crtend.o

gba.o : gba.cpp
   gcc -c gba.cpp

crt0.o : crt0.s
   as -mthumb-interwork -marm7tdmi -o crt0.o crt0.s

#4064 - pollier - Mon Mar 17, 2003 7:17 pm

I'm not completely sure about symbol _start but probably has to do with whether you named your startup function "main" or "AgbMain"

Also, this doesn't look right:
Quote:
gcc -nostartfiles -Tlnkscript -o crt0.o gba.o crtbegin.o crtend.o


-nostartfiles disables the use of the crt files (I think) so it's a bit redundant, and you need to specify the .elf output file after -o, also crtbegin.o ought to be the first in the linking list, as far as I know, but I never use those...

replacement (although it won't fix the "symbol _start" error)
Code:
gcc -nostartfiles -Tlnkscript -o gba.elf crtbegin.o crt0.o gba.o crtend.o


or this ought to work I believe:
Code:
gcc -Tlnkscript -o gba.elf gba.o

but someone'll have to confirm that...

woah, I've written a lot of uncertainty into this post (heh)
_________________
(Works for me!)

#4085 - ampz - Tue Mar 18, 2003 5:07 am

I believe "_start" is supposed to be the entrypoint in crt0.s or something.

more uncertainty... :D