summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Hellstrom <daniel@gaisler.com>2020-09-25 15:37:20 +0200
committerDaniel Hellstrom <daniel@gaisler.com>2020-09-25 15:58:41 +0200
commitd926a0d016e44292e8e619b4727b6d1eaad9f326 (patch)
tree29082730184222470a59448145519931fbdc598c
parente6e04899154d94ac5e8515b69978424d6edc7f7a (diff)
leon3,shm: update default base address (for GR740 MP config)rcc-v1.3.0rcc-1.3
The shared memory base is normally set by the user application. It defaults to 0x40000000 for LEON3 (start of memory) since before, with GR740 having its memory at 0x00000000 a better base address the new default is to based it on the _RAM_START taken from the linker script.
-rw-r--r--bsps/sparc/leon3/mpci/getcfg.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/bsps/sparc/leon3/mpci/getcfg.c b/bsps/sparc/leon3/mpci/getcfg.c
index fc67cf8e3a..8fa41c1579 100644
--- a/bsps/sparc/leon3/mpci/getcfg.c
+++ b/bsps/sparc/leon3/mpci/getcfg.c
@@ -20,7 +20,7 @@
/* Let user override this configuration by declaring this a weak variable */
shm_config_table BSP_shm_cfgtbl __attribute__((weak)) =
{
- (vol_u32 *)0x40000000, /* USER OVERRIDABLE */
+ (vol_u32 *)0xffffffff, /* USER OVERRIDABLE (see comment below) */
0x00001000, /* USER OVERRIDABLE */
SHM_BIG,
NULL_CONVERT,
@@ -33,6 +33,8 @@ shm_config_table BSP_shm_cfgtbl __attribute__((weak)) =
},
};
+extern unsigned int _RAM_START;
+
void Shm_Get_configuration(
uint32_t localnode,
shm_config_table **shmcfg
@@ -44,6 +46,17 @@ void Shm_Get_configuration(
BSP_shm_cfgtbl.format = SHM_BIG;
+ /* If not defined by user then default shared memory base address to the
+ * start of memory by aligning RAM_START to lower 512MiB:
+ * - 0x00000000 (SDRAM base for LEON4)
+ * - 0x40000000 (SRAM base LEON3)
+ * - 0x60000000 (SDRAM base LEON3)
+ */
+ if (BSP_shm_cfgtbl.base = (vol_u32 *)0xffffffff) {
+ BSP_shm_cfgtbl.base = (vol_u32 *)
+ (((unsigned int)&_RAM_START) & 0xE0000000);
+ }
+
/*
* Override cause_intr or shm_isr if your target has
* special requirements.