nds/arm7/start.s
Zack Buhman 62d6a3b2a6 arm7: copy to exclusive internal ram
Before this commit, attempting to start the rom on real NDS/DSi
hardware would result in the display of a solid white screen, with
no apparent evidence of the arm9 program running.

After much testing, I found that this issue was directly caused "main
mmeory" bus contention. Because arm7 and arm9 are both attempting to
read instructions from ewram at the same time, and arm9 bus access
stalls completely.

I also found that this could not be mitigated with giving arm9
priority in EXMEMCNT.

The solution appears to be to relocate arm7 code execution from
main/shared memory to an arm7-internal memory.

After this commit, the examples now function as intended on real
NDS/DSi hardware.
2024-09-10 12:16:19 -05:00

27 lines
527 B
ArmAsm

.macro COPY_32_BYTE_ALIGNED
cmp r1, r10
beq _fill_break.\@
_fill_loop.\@:
ldmia r0!, {r2 - r9}
stmia r1!, {r2 - r9}
cmp r1, r10
bne _fill_loop.\@
_fill_break.\@:
.endm
.section .text.start
.global _start
_start:
// copy .text to internal ram
ldr r0, =__text_load_start
ldr r1, =__text_link_start
ldr r10, =__text_link_end
COPY_32_BYTE_ALIGNED
// jump to internal ram
ldr r3,=_loop_forever
bx r3
_loop_forever:
b _loop_forever