From 821052415204c52e75612e510b8e1e1d077b95db Mon Sep 17 00:00:00 2001 From: Lephe Date: Wed, 4 May 2022 17:21:23 +0100 Subject: [PATCH] ld: merge XRAM and YRAM into a single 16-kiB section --- fx9860g.ld | 28 ++++++++-------------------- fxcg50.ld | 29 ++++++++--------------------- include/gint/defs/attributes.h | 4 ++-- src/kernel/start.c | 6 ++---- 4 files changed, 20 insertions(+), 47 deletions(-) diff --git a/fx9860g.ld b/fx9860g.ld index e6a8bf2..f66b8f2 100644 --- a/fx9860g.ld +++ b/fx9860g.ld @@ -35,8 +35,7 @@ MEMORY /* On-chip IL memory */ ilram (rwx): o = 0xe5200000, l = 4k /* On-chip X and Y memory */ - xram (rwx): o = 0xe5007000, l = 8k - yram (rwx): o = 0xe5017000, l = 8k + xyram (rwx): o = 0xe500e000, l = 16k } SECTIONS @@ -188,29 +187,18 @@ SECTIONS . = ALIGN(16); } > ilram AT> rom - . = ORIGIN(xram); - .xram ALIGN(4) : ALIGN(4) { - _lxram = LOADADDR(.xram); - _rxram = . ; + . = ORIGIN(xyram); + .xyram ALIGN(4) : ALIGN(4) { + _lxyram = LOADADDR(.xyram); + _rxyram = . ; - *(.xram) + *(.xram .yram .xyram) . = ALIGN(16); - } > xram AT> rom - - . = ORIGIN(yram); - .yram ALIGN(4) : ALIGN(4) { - _lyram = LOADADDR(.yram); - _ryram = . ; - - *(.yram) - - . = ALIGN(16); - } > yram AT> rom + } > xyram AT> rom _silram = SIZEOF(.ilram); - _sxram = SIZEOF(.xram); - _syram = SIZEOF(.yram); + _sxyram = SIZEOF(.xyram); diff --git a/fxcg50.ld b/fxcg50.ld index 143e4f4..0874c49 100644 --- a/fxcg50.ld +++ b/fxcg50.ld @@ -21,8 +21,7 @@ MEMORY /* On-chip IL memory */ ilram (rwx): o = 0xe5200000, l = 4k /* On-chip X and Y memory */ - xram (rwx): o = 0xe5007000, l = 8k - yram (rwx): o = 0xe5017000, l = 8k + xyram (rwx): o = 0xe500e000, l = 16k } SECTIONS @@ -102,7 +101,6 @@ SECTIONS .bss (NOLOAD) : { _rbss = . ; - *(.bss.vram) *(.bss COMMON) . = ALIGN(16); @@ -144,29 +142,18 @@ SECTIONS . = ALIGN(16); } > ilram AT> rom - . = ORIGIN(xram); - .xram ALIGN(4) : ALIGN(4) { - _lxram = LOADADDR(.xram); - _rxram = . ; + . = ORIGIN(xyram); + .xyram ALIGN(4) : ALIGN(4) { + _lxyram = LOADADDR(.xyram); + _rxyram = . ; - *(.xram) + *(.xram .yram .xyram) . = ALIGN(16); - } > xram AT> rom - - . = ORIGIN(yram); - .yram ALIGN(4) : ALIGN(4) { - _lyram = LOADADDR(.yram); - _ryram = . ; - - *(.yram) - - . = ALIGN(16); - } > yram AT> rom + } > xyram AT> rom _silram = SIZEOF(.ilram); - _sxram = SIZEOF(.xram); - _syram = SIZEOF(.yram); + _sxyram = SIZEOF(.xyram); /* gint's uninitialized BSS section, going to static RAM. All the large data arrays will be located here */ diff --git a/include/gint/defs/attributes.h b/include/gint/defs/attributes.h index 0dda841..4ca6037 100644 --- a/include/gint/defs/attributes.h +++ b/include/gint/defs/attributes.h @@ -14,8 +14,8 @@ #define GBSS3 __attribute__((section(".gint.bss.sh3"))) /* Objects for the ILRAM, XRAM and YRAM regions */ #define GILRAM __attribute__((section(".ilram"))) -#define GXRAM __attribute__((section(".xram"))) -#define GYRAM __attribute__((section(".yram"))) +#define GXRAM __attribute__((section(".xyram"))) +#define GYRAM __attribute__((section(".xyram"))) /* Unused parameters or variables */ #define GUNUSED __attribute__((unused)) diff --git a/src/kernel/start.c b/src/kernel/start.c index 8f793bd..7530519 100644 --- a/src/kernel/start.c +++ b/src/kernel/start.c @@ -23,8 +23,7 @@ extern uint32_t brom, srom, /* Limits of ROM mappings */ ldata, sdata, rdata, /* User's data section */ lilram, silram, rilram, /* IL memory section */ - lxram, sxram, rxram, /* X memory section */ - lyram, syram, ryram, /* Y memory section */ + lxyram, sxyram, rxyram, /* X and Y memory section */ sbss, rbss; /* User's BSS section */ #ifdef FX9860G extern uint32_t @@ -151,8 +150,7 @@ int start(int isappli, int optnum) if(!isSH3()) { regcpy(&lilram, &silram, &rilram); - regcpy(&lxram, &sxram, &rxram); - regcpy(&lyram, &syram, &ryram); + regcpy(&lxyram, &sxyram, &rxyram); } #ifdef FX9860G