Compiling/Linking/Packaging Gameboy Advance Images
In order to build binaries that you can actually use on a GBA (or emulator) you need to compile/link/package things properly. You need at least the following:
- A cross-compiler toolchain setup as defined in CrossCompilation.
- A crt0.o designed for the GBA (from devrs.com, see below).
- A properly setup linker script to put everything together.
crt0 and the linker script have already been put together; you just need to grab them and build them:
Assemble CRT0.S using something like arm-elf-as CRT0.S -o crt0.o. Grab crt0.o and lnkscript, and bring them to your project directory. Compiling, Linking, and then extracting a suitable GBA image then becomes something similar to:
- \\n
arm-elf-gcc -c test.c -c -Wall -Wall -marm -mapcs-32 -mcpu=arm7tdmi arm-elf-ld -T lnkscript ./crt0.o test.o -o test.elf arm-elf-objcopy -O binary test.elf test.gba
You can then run test.gba with any emulator (e.g. [VisualBoyAdvance] , BoycottAdvance).
I encountered a problem when I try to compile the gbatune.
It seems the linker is not working correctly.
Here is the result of make:\nÿ2ÿ
The cross compiling system is configured regarding: [Setting up a Cross Development Environment on Debian GNU/Linux]
and cross complier/linker is working fine with this little test:\nÿ3ÿ
I've successfully compiled the gbatune with this tool: