Page 1 of 1

How to compile .s to .gba?

Posted: Fri Nov 19, 2021 6:09 pm
by sudo-sandwich
I want to mod a game, but I'm having trouble recompiling after decompiling. I've decompiled my rom with luvdis (https://github.com/aarant/luvdis), which outputs a .s file. Luvdis claims that the decompiled output should recompile identically to the original rom. However, I was unable to recompile my rom (without any modifications). The new rom and the old rom do not match and the new rom doesn't boot in any emulator.

How do I compile a .s file to a useable .gba rom? Am I even approaching this the right way?

Re: How to compile .s to .gba?

Posted: Thu Jun 02, 2022 12:18 am
by WinterMute
I tried luvdis with some devkitARM compiled .gba files and managed to build identical ROMs OK. These are the commands I used to recompile the source.

Code: Select all

/opt/devkitpro/devkitARM/bin/arm-none-eabi-gcc rom.s -Ttext=0x8000000 -nostartfiles -nodefaultlibs -o rom.elf
/opt/devkitpro/devkitARM/bin/arm-none-eabi-objcopy -O binary rom.elf rom.gba 
 
There's a warning: cannot find entry symbol _start but that's benign.