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 > compiler arguments failed can someone please help me?

#47273 - solarwind__ - Wed Jul 06, 2005 11:15 pm

i am using devkitadv (not devkitarm) (this could be the problem but i dont know). I used a makefile that lookes like this:

gcc -c -mthumb -mthumb-interwork -o pong.elf pong.c
objcopy -O binary "C:\dev\3vg\pong.elf" "C:\dev\3vg\pong.gba"
pause

the one above does not work. when i open the gba file with VISUAL BOY ADVANCE, only a white screen appears. But i know the program works because i compiled a different way:


gcc -o hello.elf hello.c -lm
objcopy -O binary hello.elf hello.gba


that one works but i need to use the one above to be able to configure it to work with XBOO, so i need to tell the compiler to compile it so it starts in the SRAM memory in the GBA, any suggestions? Or is it just the old devkitadv thats causing the problem? SHould i get devkitarm? and try the whole thing over again?

thanks in advance
_________________
#solarwind

#47275 - sajiimori - Wed Jul 06, 2005 11:31 pm

-c creates an object file, so you're creating an .o file but naming it .elf. Name it pong.o instead, and then run gcc to link the real .elf:
Code:
gcc -o pong.elf pong.o

It can be a little confusing because gcc can invoke the compiler, the linker, or both. Your first example runs the compiler, the above line runs the linker, and your second example uses a shortcut that runs both.