gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Not working .nds booter

#122973 - Lick - Sat Mar 24, 2007 1:35 am

http://lickr.org/files/launcher.zip

I'm kind of stuck with this NDS file bootstub. It's supposed to be copied by the ARM9 to VRAM, then ran from ARM7. The bootstub itself will search for the DLDI section in Main RAM, and copy it over its own DLDI section that is in VRAM. Then it initializes FAT using the copied DLDI section, and it loads the requested file (currently static filename "launchee.nds").

The problem is that if FAT was initialized in the launcher, then the bootstub will magically stay at white screens.
If FAT was never initialized in the launcher, but there is a DLDI section (and you patch it correctly), the the bootstub WORKS. It successfully copies the Main RAM-DLDI to its own VRAM-DLDI and boots the "launchee.nds".
I'm not really expecting someone to know how this bug can be fixed, but I'm just posting all the code, so someone could at least try.

And yes, I know that I could make the ARM9 run the bootstub and let the ARM7 idle, which is what MightyMax' exec_stub does. BUT I really want this to work as it fits perfectly into rebootlib in this form.

Thanks for reading.
_________________
http://licklick.wordpress.com

#123025 - Diddl - Sat Mar 24, 2007 6:15 pm

don't understand why ARM7 doesn't work in same manner as the ARM9. but why do you use this old gba_nds_fat solution? libfat works much better and much faster and more secure. gba_nds_fat has many bugs in it ...

#123027 - GrizzlyAdams - Sat Mar 24, 2007 6:26 pm

I'm thinking that there may be something in the dldi you are using thats modified when its initialized. try making a backup copy of the dldi in your arm9 main before you call fat init, then patch the arm7 stub with the backup on the arm9 before you hand it over to the arm7.

#123048 - Lick - Sat Mar 24, 2007 9:19 pm

Diddl wrote:
don't understand why ARM7 doesn't work in same manner as the ARM9. but why do you use this old gba_nds_fat solution? libfat works much better and much faster and more secure. gba_nds_fat has many bugs in it ...

libfat gives me white screens with only having linked to it! It's because it uses malloc and the ARM7 doesn't play along.

GrizzlyAdams: I will try that.
_________________
http://licklick.wordpress.com

#123123 - Diddl - Sun Mar 25, 2007 10:39 am

Lick wrote:

libfat gives me white screens with only having linked to it! It's because it uses malloc and the ARM7 doesn't play along.


I believe it doesn't use malloc() if you don't use buffering (buffers = 0). in this case speed is slow like at gba_nds_fat, but it should work.

#123127 - chishm - Sun Mar 25, 2007 11:07 am

Diddl wrote:
Lick wrote:

libfat gives me white screens with only having linked to it! It's because it uses malloc and the ARM7 doesn't play along.


I believe it doesn't use malloc() if you don't use buffering (buffers = 0). in this case speed is slow like at gba_nds_fat, but it should work.

It forces at least 2 cache sectors. Also, look at the source of libfat. You can remove its reliance on malloc by supplying your own allocator in mem_alloc.h. This won't remove the DKA reliance on malloc though.
_________________
http://chishm.drunkencoders.com
http://dldi.drunkencoders.com