Closed ids1024 closed 2 years ago
When I do that mGBA crashes with a jump to 0x0800_0298
, which if you dump the ELF file is the address of main
in a release build.
The logs also show that it was doing a bunch of out of bounds reads to copy the IWRAM data before it crashes by trying to jump out of bounds. And if you set a breakpoint in the debugger (eg: break 0x08000000
) you can pause the emulation before the crash and view the loaded rom. the rom data is extremely regular, like things didn't load right.
However, the ELF version of both the debug and release builds of the example work fine in mGBA.
So, I suspect we're doing objcopy wrong somehow? I haven't used the tool in so long I can't remember if there's some other flag to set or something. I'll link this on the GBA discord and hopefully we can get it sorted out soon.
This appears to have been fixed on mGBA's side in 0.10.0 when I run the hello
example after an objcopy, @ids1024 can you update your own mGBA and confirm?
Yep. Not sure exactly what was going on and what change in mGBA fixed it, but it seems to be fine now in 0.10.0. And it seemed to be file size that's the issue in any case, so the solution would be padding with zeros and not any change in the gba
crate.
If I open the
hello
elf file in mgba, it runs as expected. If I open the.gba
file, it errors with "Jumped to invalid address".These commands should be correct, right? I guess an issue like this would have to be related to the linker script, or
asm_runtime.rs
?