diff --git a/source/start.s b/source/start.s index 264565b..c143ddf 100644 --- a/source/start.s +++ b/source/start.s @@ -3,6 +3,7 @@ .extern main .align 4 .arm +.extern fake_heap_end @ used for heap setup by newlib used by devKitARM #define SIZE_32KB 0b01110 #define SIZE_128KB 0b10000 @@ -93,6 +94,14 @@ _fix_sdmc_mount: str r1, [r0] mov pc, lr +_setup_heap: + mov r0, #0x2000000 @ Setup a 32MiB heap + ldr r1, =__end__ @ grab the location of the end of the binary + add r0, r0, r1 + ldr r1, =fake_heap_end @ heap goes from end of program to this variable + str r0, [r1] + mov pc, lr + _init: push {r0-r12, lr} @@ -100,6 +109,8 @@ _init: bl _fix_sdmc_mount + bl _setup_heap + bl main mrc p15, 0, r4, c1, c0, 0