### ## ## ## ## ## ####
###### ## ## ## ## ##### ## ####
____ | _ \ | |_) | | _ < |_| \_\
## ## ###### ###### ## ## ## ##
# ### ## # # # # # # #
IMPORTANT: enter the case-INsensitive alphabetic (no numbers) code AND WRITE SOME SHORT summary of changes (below) if you are saving changes. (not required for previewing changes). Wiki-spamming is not tolerated, will be removed, so it does NOT even show up in history. Spammers go away now. Visit Preferences to set your user name Summary of change: == 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: * http://www.devrs.com/gba/files/crtls.zip 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: : \ <code> 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 </code> You can then run ''test.gba'' with any emulator (e.g. [http://vba.ngemu.com/ 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: <code> make arm-linux-as -o crt0.o crt0.s arm-linux-gcc -Wall -marm -mapcs-32 -mcpu=arm7tdmi -c -o screen_ve.o screen_ve.c arm-linux-gcc -Wall -marm -mapcs-32 -mcpu=arm7tdmi -c -o table.o table.c arm-linux-gcc -Wall -marm -mapcs-32 -mcpu=arm7tdmi -c -o ui.o ui.c arm-linux-gcc -Wall -marm -mapcs-32 -mcpu=arm7tdmi -c -o comm.o comm.c arm-linux-gcc -Wall -marm -mapcs-32 -mcpu=arm7tdmi -c -o screen.o screen.c arm-linux-gcc -Wall -marm -mapcs-32 -mcpu=arm7tdmi -c -o widget.o widget.c arm-linux-gcc -Wall -marm -mapcs-32 -mcpu=arm7tdmi -c -o widget_table.o widget_table.c arm-linux-gcc -Wall -marm -mapcs-32 -mcpu=arm7tdmi -c -o gbatune.o gbatune.c arm-linux-ld -T lnkscript crt0.o screen_ve.o table.o ui.o comm.o screen.o widget.o widget_table.o gbatune.o -o gbatune.elf -lc -lm `arm-linux-gcc -print-libgcc-file-name` arm-linux-ld: section .data [08014e84 -> 08014ea7] overlaps section .rodata [08001ec8 -> 08014ed3] arm-linux-ld: section .dynamic [08014ea8 -> 08014f4f] overlaps section .rodata [08001ec8 -> 08014ed3] arm-linux-ld: section .got.plt [08014f50 -> 08014f6f] overlaps section .dynsym [08014f14 -> 08014f73] arm-linux-ld: section .rel.dyn [08014f70 -> 08014f97] overlaps section .dynsym [08014f14 -> 08014f73] arm-linux-ld: BFD 2.15 assertion fail ../../src/bfd/elf32-arm.h:3737 arm-linux-ld: BFD 2.15 assertion fail ../../src/bfd/elf32-arm.h:3737 arm-linux-ld: BFD 2.15 assertion fail ../../src/bfd/elf32-arm.h:3737 arm-linux-ld: BFD 2.15 assertion fail ../../src/bfd/elf32-arm.h:3737 arm-linux-ld: BFD 2.15 assertion fail ../../src/bfd/elf32-arm.h:3737 arm-linux-ld: BFD 2.15 assertion fail ../../src/bfd/elf32-arm.h:3905 make: *** [gbatune.elf] Segmentation fault make: *** Deleting file `gbatune.elf' </code> The cross compiling system is configured regarding: [http://people.debian.org/~debacle/cross.html Setting up a Cross Development Environment on Debian GNU/Linux] and cross complier/linker is working fine with this little test: <code> int AgbMain(void) { return (0); } </code> I've successfully compiled the gbatune with this tool: [http://sourceforge.net/projects/devkitpro Devkitpro] Optional: Add document to category: Wiki formatting: * is Bullet list ** Bullet list subentry ... '''Bold''', ---- is horizontal ruler, <code> preformatted text... </code> See wiki editing HELP for tables and other formatting tips and tricks.