View Single Post
Old February 12th, 2011 (06:49 AM). Edited February 13th, 2011 by knizz.
knizz's Avatar
knizz knizz is offline
Join Date: Aug 2007
Posts: 192
There is a compiler framework called LLVM. It's faster than GCC and opimizes code more aggresively and the llvm-frontend 'clang' has much better error-messages. I chose it to get rid of the devkit-dependency. (Which I didn't manage but ... at least I have fast code now.)

My clang version doesn't support arm (not because it can't but because the pre-compiled version doesn't include it.)
Fortunately the LLVM-Output is platform/cpu/os-independent. So I compile for x86 first and the override the cpu-type (i think clang ignores -march=thumb) when using llc. lists all options for optimizations. They are supposed to be used with clang when it performs *all* actions. When you do linking, etc. yourself you probably have to give the optimization options to llvm-ld too.

clang -O4 -S -emit-llvm -march=thumb file1.c file2.cpp
llvm-as-2.8 file1.s
llvm-as-2.8 file2.s
llvm-ld-2.8 -o rom file1.s.bc file2.s.bc
llc-2.8 -O=3 -march=thumb -mcpu=arm7tdmi rom.bc
arm-thumb-elf-as -mthumb-interwork -o crt0.o crt0.S
arm-thumb-elf-as -mthumb-interwork -o rom.o rom.s
arm-thumb-elf-ld -q -Ttext=0x8000000 -Tbss=0x3000000 -o rom.elf crt0.o rom.o
arm-thumb-elf-strip -s rom.elf
arm-thumb-elf-objcopy -O binary rom.elf rom.gba
gbafix rom.gba
I use the crt0.S from
Firered IDA 6.5 DB:
VBA-M with lua scripting support
Reply With Quote