diff --git a/build/libraries/init/ARM7/crt0.c b/build/libraries/init/ARM7/crt0.c index bd7ddb8..7ec4be3 100644 --- a/build/libraries/init/ARM7/crt0.c +++ b/build/libraries/init/ARM7/crt0.c @@ -59,6 +59,7 @@ SDK_WEAK_SYMBOL asm void _start( void ) str r12, [r12, #REG_IME_OFFSET] //---- clear memory +#if 0 // private-WRAM (except program area) ldr r1, =SDK_STATIC_BSS_END // r1= max(__bss_end__, #HW_PRV_WRAM) mov r0, #HW_PRV_WRAM @@ -71,6 +72,7 @@ SDK_WEAK_SYMBOL asm void _start( void ) cmp r1, r2 stmltia r1!, {r0} blt @1 +#endif //---- initialize stack pointer // SVC mode @@ -109,7 +111,7 @@ SDK_WEAK_SYMBOL asm void _start( void ) bmi @1_2 //---- load autoload block and initialize bss -// bl do_autoload + bl do_autoload //---- fill static static bss with 0 ldr r0, =_start_ModuleParams @@ -184,11 +186,15 @@ static asm void do_autoload( void ) ldr dest, [infop], #4 // dest ldr dest_size, [infop], #4 // size add dest_end, dest, dest_size // dest_end +#if 1 + mov dest, dest_end +#else @1: cmp dest, dest_end ldrmi tmp, [src], #4 // [dest++] <- [src++] strmi tmp, [dest], #4 bmi @1 +#endif //---- fill bss with 0 ldr dest_size, [infop], #4 // size diff --git a/build/libraries/init/ARM9/crt0.c b/build/libraries/init/ARM9/crt0.c index a004813..2c35cda 100644 --- a/build/libraries/init/ARM9/crt0.c +++ b/build/libraries/init/ARM9/crt0.c @@ -123,7 +123,7 @@ SDK_WEAK_SYMBOL asm void _start( void ) ldr r1, =_start_ModuleParams ldr r0, [r1, #20] // r0 = bottom of compressed data bl MIi_UncompressBackward -// bl do_autoload + bl do_autoload //---- fill static static bss with 0 ldr r0, =_start_ModuleParams @@ -352,11 +352,15 @@ static asm void do_autoload( void ) ldr tmp, [infop], #4 // size add dest_end, dest_begin, tmp // dest_end mov dest, dest_begin // dest working pointer +#if 1 + mov dest, dest_end +#else @1: cmp dest, dest_end ldrmi tmp, [src], #4 // [dest++] <- [src++] strmi tmp, [dest], #4 bmi @1 +#endif //---- fill bss with 0 ldr tmp, [infop], #4 // size diff --git a/include/twl/specfiles/ARM7-BB.lcf.template b/include/twl/specfiles/ARM7-BB.lcf.template index 4c2ef4b..0cb83da 100644 --- a/include/twl/specfiles/ARM7-BB.lcf.template +++ b/include/twl/specfiles/ARM7-BB.lcf.template @@ -19,7 +19,7 @@ MEMORY (RWX) : ORIGIN = , LENGTH = 0x0 # >> - binary.AUTOLOAD_INFO (RWX) : ORIGIN = 0, LENGTH = 0x0 > +# binary.AUTOLOAD_INFO (RWX) : ORIGIN = 0, LENGTH = 0x0 > (RW) : ORIGIN = AFTER(), LENGTH = 0x0 > (RW) : ORIGIN = AFTER(), LENGTH = 0x0 > @@ -311,15 +311,17 @@ SECTIONS ############################ AUTOLOAD_INFO ########################## .binary.AUTOLOAD_INFO: { + SDK_AUTOLOAD_LIST = .; WRITEW ADDR(.); WRITEW SDK_AUTOLOAD..SIZE; WRITEW SDK_AUTOLOAD..BSS_SIZE; - } > binary.AUTOLOAD_INFO + SDK_AUTOLOAD_LIST_END = .; + } >> # > binary.AUTOLOAD_INFO - SDK_AUTOLOAD_LIST = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE; - SDK_AUTOLOAD_LIST_END = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); +# SDK_AUTOLOAD_LIST = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE; +# SDK_AUTOLOAD_LIST_END = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); ############################ OVERLAYS ############################### diff --git a/include/twl/specfiles/ARM7-DSTEG.lcf.template b/include/twl/specfiles/ARM7-DSTEG.lcf.template index 0d2898c..f56bf86 100644 --- a/include/twl/specfiles/ARM7-DSTEG.lcf.template +++ b/include/twl/specfiles/ARM7-DSTEG.lcf.template @@ -19,7 +19,7 @@ MEMORY (RWX) : ORIGIN = , LENGTH = 0x0 # >> - binary.AUTOLOAD_INFO (RWX) : ORIGIN = 0, LENGTH = 0x0 > +# binary.AUTOLOAD_INFO (RWX) : ORIGIN = 0, LENGTH = 0x0 > (RW) : ORIGIN = AFTER(), LENGTH = 0x0 > (RW) : ORIGIN = AFTER(), LENGTH = 0x0 > @@ -311,15 +311,17 @@ SECTIONS ############################ AUTOLOAD_INFO ########################## .binary.AUTOLOAD_INFO: { + SDK_AUTOLOAD_LIST = .; WRITEW ADDR(.); WRITEW SDK_AUTOLOAD..SIZE; WRITEW SDK_AUTOLOAD..BSS_SIZE; + SDK_AUTOLOAD_LIST_END = .; } > binary.AUTOLOAD_INFO - SDK_AUTOLOAD_LIST = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE; - SDK_AUTOLOAD_LIST_END = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); +# SDK_AUTOLOAD_LIST = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE; +# SDK_AUTOLOAD_LIST_END = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); ############################ OVERLAYS ############################### diff --git a/include/twl/specfiles/ARM9-BB.lcf.template b/include/twl/specfiles/ARM9-BB.lcf.template index e4b2277..d94dbf7 100644 --- a/include/twl/specfiles/ARM9-BB.lcf.template +++ b/include/twl/specfiles/ARM9-BB.lcf.template @@ -19,8 +19,8 @@ MEMORY (RWX) : ORIGIN = , LENGTH = 0x0 # >> - binary.AUTOLOAD_INFO (RWX) : ORIGIN = 0, LENGTH = 0x0 > - binary.STATIC_FOOTER (RWX) : ORIGIN = 0, LENGTH = 0x0 >> +# binary.AUTOLOAD_INFO (RWX) : ORIGIN = 0, LENGTH = 0x0 > +# binary.STATIC_FOOTER (RWX) : ORIGIN = 0, LENGTH = 0x0 >> (RW) : ORIGIN = AFTER(), LENGTH = 0x0 > (RW) : ORIGIN = AFTER(), LENGTH = 0x0 > @@ -348,15 +348,17 @@ SECTIONS ############################ AUTOLOAD_INFO ########################## .binary.AUTOLOAD_INFO: { + SDK_AUTOLOAD_LIST = .; WRITEW ADDR(.); WRITEW SDK_AUTOLOAD..SIZE; WRITEW SDK_AUTOLOAD..BSS_SIZE; - } > binary.AUTOLOAD_INFO + SDK_AUTOLOAD_LIST_END = .; + } >> # > binary.AUTOLOAD_INFO - SDK_AUTOLOAD_LIST = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE; - SDK_AUTOLOAD_LIST_END = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); +# SDK_AUTOLOAD_LIST = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE; +# SDK_AUTOLOAD_LIST_END = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); ############################ STATIC_FOOTER ########################## @@ -365,7 +367,7 @@ SECTIONS WRITEW 0xdec00621; # LE(0x2106C0DE) = NITRO CODE WRITEW _start_ModuleParams - ADDR(.); WRITEW 0; # NO DIGEST - } > binary.STATIC_FOOTER + } >> # > binary.STATIC_FOOTER ############################ OVERLAYS ############################### SDK_OVERLAY_NUMBER = ; diff --git a/include/twl/specfiles/ARM9-DSTEG.lcf.template b/include/twl/specfiles/ARM9-DSTEG.lcf.template index 8172512..11b34cd 100644 --- a/include/twl/specfiles/ARM9-DSTEG.lcf.template +++ b/include/twl/specfiles/ARM9-DSTEG.lcf.template @@ -19,8 +19,8 @@ MEMORY (RWX) : ORIGIN = , LENGTH = 0x0 # >> - binary.AUTOLOAD_INFO (RWX) : ORIGIN = 0, LENGTH = 0x0 > - binary.STATIC_FOOTER (RWX) : ORIGIN = 0, LENGTH = 0x0 >> +# binary.AUTOLOAD_INFO (RWX) : ORIGIN = 0, LENGTH = 0x0 > +# binary.STATIC_FOOTER (RWX) : ORIGIN = 0, LENGTH = 0x0 >> (RW) : ORIGIN = AFTER(), LENGTH = 0x0 > (RW) : ORIGIN = AFTER(), LENGTH = 0x0 > @@ -348,15 +348,17 @@ SECTIONS ############################ AUTOLOAD_INFO ########################## .binary.AUTOLOAD_INFO: { + SDK_AUTOLOAD_LIST = .; WRITEW ADDR(.); WRITEW SDK_AUTOLOAD..SIZE; WRITEW SDK_AUTOLOAD..BSS_SIZE; + SDK_AUTOLOAD_LIST_END = .; } > binary.AUTOLOAD_INFO - SDK_AUTOLOAD_LIST = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE; - SDK_AUTOLOAD_LIST_END = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); +# SDK_AUTOLOAD_LIST = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE; +# SDK_AUTOLOAD_LIST_END = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); ############################ STATIC_FOOTER ##########################