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 > R4DS trouble with homebrew ARM7

#159403 - PypeBros - Mon Jun 30, 2008 8:54 am

Hello all.

It looks like my custom ARM7 code doesn't get properly initialized on the R4DS, and i'm looking for hints on how i could determine whether it has actually be loaded by the R4 firmware or not, etc.

Anything like a 7-9 synchronization (like in the ndswifi library) stalls, and i don't seem to receive any input (touchscreen, buttons...) anymore. The same binary works flawlessly on SCSD and in desmume, so despite there may be something wrong with my code, i'm more suspecting something wrong (a step missed) with "how to run your homebrew on R4DS" ...

I know from .map file that my ARM7 code should be located in the IWRAM region, which (afaik) is not mapped from the ARM9, so i cannot "remotely" check that the proper code is in place except from its interaction with shared WRAM.

I am using dkp-r21, if that matters. Any hint would be welcome.
_________________
SEDS: Sprite Edition on DS :: modplayer

#159407 - Maxxie - Mon Jun 30, 2008 11:23 am

The R4 loads arm7 binary without flaws. I use custom arm7 bins on it all the time.

Check your code in an emulator to see whether you are doing something completely wrong.

#159409 - PypeBros - Mon Jun 30, 2008 11:57 am

okay, thanks for your testimony.
i tried to strip down my code and used a custom (but trivially simple and basing on latest basic.arm7 from dkp21) arm7 and it worked as expected.

Seems like i'm going to debug my arm7 through flashing BG color once again (reminds me of good ol' x86 bootstrapper dev'ing days :P)
_________________
SEDS: Sprite Edition on DS :: modplayer

#159464 - zzo38computer - Tue Jul 01, 2008 5:10 pm

If you divide by zero in the ARM7, everything on the ARM7 will stop working until you turn off and turn back on the Nintendo DS. This also happens if you set the frequency of a sound to zero. I know this because I made this mistake once.
_________________
Important: Please send messages about FWNITRO to the public forum, not privately to me.

#159469 - Maxxie - Tue Jul 01, 2008 6:07 pm

Well it won't actual freeze, it will jump to the exception handler. And if it doesn't correct the problem it will return and fail again.

#159524 - PypeBros - Wed Jul 02, 2008 10:15 am

which then makes me wonder "how should i set up an exception handler on the ARM7". There doesn't look to be any exception.h in the arm7 part of libnds ... i guess i'll try my chance in the processor manual tonight ...
_________________
SEDS: Sprite Edition on DS :: modplayer

#159527 - Maxxie - Wed Jul 02, 2008 10:52 am

GBATek wrote:

27FFD9Ch - RAM - NDS9 Debug Stacktop / Debug Vector (0=None)
380FFDCh - RAM - NDS7 Debug Stacktop / Debug Vector (0=None)


Arm7 exceptions are handled the same way as arm9 ones, with the only difference of the mpu status saving.