From e66b9083b4e12136fb752c672b09fcc340906d04 Mon Sep 17 00:00:00 2001 From: Lephe Date: Mon, 28 Sep 2020 14:06:29 +0200 Subject: [PATCH] kernel: do not copy data to on-chip memory on SH3 Avoids a crash at startup, but the application needs to be smart enough to not use the data. --- src/kernel/start.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/kernel/start.c b/src/kernel/start.c index 59aa165..3bfa604 100644 --- a/src/kernel/start.c +++ b/src/kernel/start.c @@ -116,11 +116,17 @@ int start(int isappli, int optnum) /* Load data sections and wipe the bss section. This has to be done first for static and global variables to be initialized */ regcpy(&ldata, &sdata, &rdata); - regcpy(&lilram, &silram, &rilram); - regcpy(&lxram, &sxram, &rxram); - regcpy(&lyram, &syram, &ryram); regclr(&rbss, &sbss); + /* Do not load data to ILRAM, XRAM or YRAM on SH3 - the areas don't + exist. If you use them, you're responsible! */ + if(!isSH3()) + { + regcpy(&lilram, &silram, &rilram); + regcpy(&lxram, &sxram, &rxram); + regcpy(&lyram, &syram, &ryram); + } + #ifdef FX9860G /* Copy permanentely-mapped code to start of user RAM (on fx-CG 50 it is loaded along ILRAM contents) */