In my media devices architecture class, we are developing on the GBA. Unfortunately, most of the students are developing on windows machines, which leaves me and a few others the odd men out. On macs, we're using devkitarm as our compiler with a provided makefile. Unfortunately, the Makefile had a few flags misconfigured.
The stock makefile worked perfectly until we started dealing with sound. The problem was two fold:
- Setting the interrupt handler would cause the GBA to reset
- Sound files larger than thirty seconds would overflow the ewram
There were two macros in the make file that were used for compiling and linking respectively:
MODEL = -mthumb -mthumb-interwork SPECS = -specs=gba_mb.specs
The model affects how the assembly is compiled, and the specs defines the way the linker will link the c objects together. I figured out that mthumb wasn't needed by looking at the windows makefile. Removing it resolved the rebooting issue.
I knew that the overflow had to do with the linker, because that's where it failed. I was at the point where I was actually trying to modify the linker script to manually force the audio memory to go to the right region when I realized there was a second gba .specs file. Switching to that file resolved the issue.
The resulting makefile macros are as followed:
MODEL = -mthumb-interwork SPECS = -specs=gba.specs
I am not a compiler expert. So, I can't tell you the full implications of changing these flags, but it did work for me. I'm still working on what I believe to be a compiler bug and plan to submit a bug report soon. If it turns out to be interesting, I'll make another post here.