From d926a0d016e44292e8e619b4727b6d1eaad9f326 Mon Sep 17 00:00:00 2001 From: Daniel Hellstrom Date: Fri, 25 Sep 2020 15:37:20 +0200 Subject: leon3,shm: update default base address (for GR740 MP config) 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. --- bsps/sparc/leon3/mpci/getcfg.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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. -- cgit v1.2.3