From 0b46886c0b86aff5fbdbf836b3194f4ebd52470f Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sun, 15 Dec 2024 21:43:46 +0100 Subject: [PATCH] better names for ewram ewram init start end --- ld_script.txt | 11 +++++++---- src/main.c | 14 +++++++------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/ld_script.txt b/ld_script.txt index cf45d1ac0..a6cc698e3 100755 --- a/ld_script.txt +++ b/ld_script.txt @@ -17,6 +17,7 @@ SECTIONS { ALIGN(4) { ewram_start = .; + data/sound_data.o(.bss); INCLUDE "sym_ewram.ld" src/agb_flash.o(.bss); @@ -27,6 +28,8 @@ SECTIONS { src/m4a.o(ewram_lib); src/agb_flash.o(ewram_lib); *libc.a:sbrkr.o(COMMON); + + ewram_end = .; } > EWRAM iwram 0x3000000 (NOLOAD) : @@ -725,15 +728,15 @@ SECTIONS { ewram_init : ALIGN(4) { - ewramClearEnd = .; - ewramClearEnd2 = .; + ewram_init_start = .; INCLUDE "sym_ewram_init.ld" *libc.a:impure.o(.data); *libc.a:locale.o(.data); *libc.a:mallocr.o(.data); - ewram2_end = .; - . = 0x2724; + + ewram_init_end = .; + . = 0x2724; /* This doesn't really do anything other than setting following 0x2724 bytes to 0 in rom */ } > EWRAM AT>ROM EWRAM_INIT_ROM_START = LOADADDR(ewram_init); diff --git a/src/main.c b/src/main.c index ee9aa49d9..01353d588 100644 --- a/src/main.c +++ b/src/main.c @@ -18,9 +18,9 @@ #include "text.h" extern u8 ewram_start[]; -extern u8 ewramClearEnd[]; -extern u8 ewramClearEnd2[]; // Force a second storage in the asm -extern u8 ewram2_end[]; +extern u8 ewram_end[]; // Force a second storage in the asm +extern u8 ewram_init_start[]; +extern u8 ewram_init_end[]; extern u8 iwram_start[]; extern u8 iwramClearEnd[]; extern u8 unk_code[]; @@ -49,12 +49,12 @@ void AgbMain(void) DmaStop(2); DmaStop(3); - if (ewram2_end - ewramClearEnd > 0) - CpuCopy32(EWRAM_INIT_ROM_START, ewramClearEnd, ewram2_end - ewramClearEnd); + if (ewram_init_end - ewram_init_start > 0) + CpuCopy32(EWRAM_INIT_ROM_START, ewram_init_start, ewram_init_end - ewram_init_start); - if (ewramClearEnd2 - ewram_start > 0) { + if (ewram_end - ewram_start > 0) { memset(value, 0, 4); - CpuSet(&value, ewram_start, CPU_SET_SRC_FIXED | CPU_SET_32BIT | (((ewramClearEnd2 - ewram_start) / 4) & 0x1FFFFF)); + CpuSet(&value, ewram_start, CPU_SET_SRC_FIXED | CPU_SET_32BIT | (((ewram_end - ewram_start) / 4) & 0x1FFFFF)); } if (unk_code_ram_end - unk_code_ram > 0)