diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2023-12-21 15:16:48 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2024-01-15 10:33:13 +0100 |
commit | 437da01f80cb2368beeed2aef69a5e8339caf2c5 (patch) | |
tree | 3e4806682fdedc122ad8f8bc828040e61a0f65f2 | |
parent | bsp/tms570: Add variant enable to build (diff) | |
download | rtems-437da01f80cb2368beeed2aef69a5e8339caf2c5.tar.bz2 |
bsp/tms570: Add linkcmds.memory
Remove obsolete tms570ls3137_hdk_with_loader BSP variant. With the new
memory origin/size build options this variant is no longer required.
Update #4982.
19 files changed, 172 insertions, 111 deletions
diff --git a/bsps/arm/tms570/README b/bsps/arm/tms570/README index 2a0bd4c8e4..200f8077cf 100644 --- a/bsps/arm/tms570/README +++ b/bsps/arm/tms570/README @@ -14,9 +14,6 @@ Drivers: BSP variants: tms570ls3137_hdk_intram - place code and data into internal SRAM tms570ls3137_hdk_sdram - place code into external SDRAM and data to SRAM - tms570ls3137_hdk_with_loader - reserve 256kB at Flash start for loader - and place RTEMS application from address - 0x00040000 tms570ls3137_hdk - variant for stand-alone RTEMS application stored and running directly from flash. This variant requires initialization of hardware to be integrated diff --git a/bsps/arm/tms570/config/tms570ls3137_hdk_with_loader-testsuite.tcfg b/bsps/arm/tms570/config/tms570ls3137_hdk_with_loader-testsuite.tcfg deleted file mode 100644 index cd8b657bc5..0000000000 --- a/bsps/arm/tms570/config/tms570ls3137_hdk_with_loader-testsuite.tcfg +++ /dev/null @@ -1,9 +0,0 @@ -# -# tms570ls3137_hdk_with_loader RTEMS Test Database. -# -# Format is one line per test that is _NOT_ built. -# - -include: testdata/small-memory-testsuite.tcfg - -exclude: linpack diff --git a/bsps/arm/tms570/include/bsp/tms570_hwinit.h b/bsps/arm/tms570/include/bsp/tms570_hwinit.h index a14e99dfeb..f23584f9b1 100644 --- a/bsps/arm/tms570/include/bsp/tms570_hwinit.h +++ b/bsps/arm/tms570/include/bsp/tms570_hwinit.h @@ -43,11 +43,21 @@ #ifndef LIBBSP_ARM_TMS570_HWINIT_H #define LIBBSP_ARM_TMS570_HWINIT_H -#define TMS570_TCRAM_START_PTR ( (void *) ( 0x08000000U ) ) -#define TMS570_TCRAM_WINDOW_END_PTR ( (void *) ( 0x08080000U ) ) +#include <bspopts.h> +#include <stdint.h> +#include <bsp/start.h> -#define TMS570_SDRAM_START_PTR ( (void *) ( 0x80000000U ) ) -#define TMS570_SDRAM_WINDOW_END_PTR ( (void *) ( 0xA0000000U ) ) +static inline bool tms570_running_from_tcram( void ) +{ + uintptr_t fncptr = (uintptr_t)bsp_start_hook_0; + return (fncptr - TMS570_MEMORY_SRAM_ORIGIN) < TMS570_MEMORY_SRAM_SIZE; +} + +static inline bool tms570_running_from_sdram( void ) +{ + uintptr_t fncptr = (uintptr_t)bsp_start_hook_0; + return (fncptr - TMS570_MEMORY_SDRAM_ORIGIN) < TMS570_MEMORY_SDRAM_SIZE; +} /* Ti TMS570 core setup implemented in assembly */ void _esmCcmErrorsClear_( void ); diff --git a/bsps/arm/tms570/start/bspstarthooks-hwinit.c b/bsps/arm/tms570/start/bspstarthooks-hwinit.c index 0ce03c3a15..593c7a9ec3 100644 --- a/bsps/arm/tms570/start/bspstarthooks-hwinit.c +++ b/bsps/arm/tms570/start/bspstarthooks-hwinit.c @@ -47,22 +47,6 @@ #include <bsp/tms570_selftest_parity.h> #include <bsp/tms570_hwinit.h> -static inline -int tms570_running_from_tcram( void ) -{ - void *fncptr = (void*)bsp_start_hook_0; - return ( fncptr >= (void*)TMS570_TCRAM_START_PTR ) && - ( fncptr < (void*)TMS570_TCRAM_WINDOW_END_PTR ); -} - -static inline -int tms570_running_from_sdram( void ) -{ - void *fncptr = (void*)bsp_start_hook_0; - return ( ( (void*)fncptr >= (void*)TMS570_SDRAM_START_PTR ) && - ( (void*)fncptr < (void*)TMS570_SDRAM_WINDOW_END_PTR ) ); -} - #define PBIST_March13N_SP 0x00000008U /**< March13 N Algo for 1 Port mem */ BSP_START_TEXT_SECTION void bsp_start_hook_0( void ) diff --git a/bsps/arm/tms570/start/init_emif_sdram.c b/bsps/arm/tms570/start/init_emif_sdram.c index 18f0e41f2b..0b190da321 100644 --- a/bsps/arm/tms570/start/init_emif_sdram.c +++ b/bsps/arm/tms570/start/init_emif_sdram.c @@ -50,8 +50,7 @@ void tms570_emif_sdram_init( void ) uint32_t sdcr = 0; /* Do not run attempt to initialize SDRAM when code is running from it */ - if ( ( (void*)tms570_emif_sdram_init >= (void*)TMS570_SDRAM_START_PTR ) && - ( (void*)tms570_emif_sdram_init <= (void*)TMS570_SDRAM_WINDOW_END_PTR ) ) + if ( tms570_running_from_sdram() ) return; sdtimr = TMS570_EMIF_SDTIMR_T_RFC_SET( sdtimr, 6 - 1 ); @@ -88,7 +87,7 @@ void tms570_emif_sdram_init( void ) TMS570_EMIF.SDCR = sdcr; - dummy = *(volatile uint32_t*)TMS570_SDRAM_START_PTR; + dummy = *(volatile uint32_t*)TMS570_MEMORY_SDRAM_ORIGIN; (void) dummy; TMS570_EMIF.SDRCR = 31; diff --git a/bsps/arm/tms570/start/linkcmds.tms570ls3137_hdk b/bsps/arm/tms570/start/linkcmds.tms570ls3137_hdk index ea41dad921..70f60662a6 100644 --- a/bsps/arm/tms570/start/linkcmds.tms570ls3137_hdk +++ b/bsps/arm/tms570/start/linkcmds.tms570ls3137_hdk @@ -1,9 +1,4 @@ - -MEMORY { - ROM_INT (RX) : ORIGIN = 0x00000000, LENGTH = 3M - RAM_INT (AIWX) : ORIGIN = 0x08000000, LENGTH = 256k - RAM_EXT (AIWX) : ORIGIN = 0x80000000, LENGTH = 8M -} +INCLUDE linkcmds.memory REGION_ALIAS ("REGION_START", ROM_INT); REGION_ALIAS ("REGION_VECTOR", RAM_INT); diff --git a/bsps/arm/tms570/start/linkcmds.tms570ls3137_hdk_intram b/bsps/arm/tms570/start/linkcmds.tms570ls3137_hdk_intram index cf7dbb6521..6060eec80c 100644 --- a/bsps/arm/tms570/start/linkcmds.tms570ls3137_hdk_intram +++ b/bsps/arm/tms570/start/linkcmds.tms570ls3137_hdk_intram @@ -1,9 +1,4 @@ - -MEMORY { - ROM_INT (RX) : ORIGIN = 0x00000000, LENGTH = 3M - RAM_INT (AIWX) : ORIGIN = 0x08000100, LENGTH = 256k - RAM_EXT (AIW) : ORIGIN = 0x80000000, LENGTH = 8M -} +INCLUDE linkcmds.memory REGION_ALIAS ("REGION_START", RAM_INT); REGION_ALIAS ("REGION_VECTOR", RAM_INT); diff --git a/bsps/arm/tms570/start/linkcmds.tms570ls3137_hdk_sdram b/bsps/arm/tms570/start/linkcmds.tms570ls3137_hdk_sdram index d5cbd45a87..b6a76ff407 100644 --- a/bsps/arm/tms570/start/linkcmds.tms570ls3137_hdk_sdram +++ b/bsps/arm/tms570/start/linkcmds.tms570ls3137_hdk_sdram @@ -1,9 +1,4 @@ - -MEMORY { - ROM_INT (RX) : ORIGIN = 0x00000000, LENGTH = 3M - RAM_INT (AIWX) : ORIGIN = 0x08000100, LENGTH = 256k - RAM_EXT (AIWX) : ORIGIN = 0x80000000, LENGTH = 8M -} +INCLUDE linkcmds.memory REGION_ALIAS ("REGION_START", RAM_EXT); REGION_ALIAS ("REGION_VECTOR", RAM_EXT); diff --git a/bsps/arm/tms570/start/linkcmds.tms570ls3137_hdk_with_loader b/bsps/arm/tms570/start/linkcmds.tms570ls3137_hdk_with_loader deleted file mode 100644 index 6e633975fb..0000000000 --- a/bsps/arm/tms570/start/linkcmds.tms570ls3137_hdk_with_loader +++ /dev/null @@ -1,36 +0,0 @@ - -MEMORY { - ROM_BOOT(RX) : ORIGIN = 0x00000000, LENGTH = 256k - ROM_INT (RX) : ORIGIN = 0x00040000, LENGTH = 3M-256k - RAM_INT (AIWX) : ORIGIN = 0x08000100, LENGTH = 256k - RAM_EXT (AIWX) : ORIGIN = 0x80000000, LENGTH = 8M -} - -REGION_ALIAS ("REGION_START", ROM_INT); -REGION_ALIAS ("REGION_VECTOR", RAM_INT); -REGION_ALIAS ("REGION_TEXT", ROM_INT); -REGION_ALIAS ("REGION_TEXT_LOAD", ROM_INT); -REGION_ALIAS ("REGION_RODATA", ROM_INT); -REGION_ALIAS ("REGION_RODATA_LOAD", ROM_INT); -REGION_ALIAS ("REGION_DATA", RAM_INT); -REGION_ALIAS ("REGION_DATA_LOAD", ROM_INT); -REGION_ALIAS ("REGION_FAST_TEXT", RAM_INT); -REGION_ALIAS ("REGION_FAST_TEXT_LOAD", ROM_INT); -REGION_ALIAS ("REGION_FAST_DATA", RAM_INT); -REGION_ALIAS ("REGION_FAST_DATA_LOAD", ROM_INT); -REGION_ALIAS ("REGION_BSS", RAM_INT); -REGION_ALIAS ("REGION_WORK", RAM_INT); -REGION_ALIAS ("REGION_STACK", RAM_INT); -REGION_ALIAS ("REGION_NOCACHE", RAM_INT); -REGION_ALIAS ("REGION_NOCACHE_LOAD", RAM_INT); - -bsp_vector_table_in_start_section = 1; - -SECTIONS { - .int_vec_overlay : ALIGN_WITH_INPUT { - bsp_int_vec_overlay_start = .; - . += 256; - } > RAM_INT AT > RAM_INT -} - -INCLUDE linkcmds.armv4 diff --git a/spec/build/bsps/arm/tms570/bspls3137hdkwithloader.yml b/spec/build/bsps/arm/tms570/bspls3137hdkwithloader.yml deleted file mode 100644 index 90069533a1..0000000000 --- a/spec/build/bsps/arm/tms570/bspls3137hdkwithloader.yml +++ /dev/null @@ -1,21 +0,0 @@ -SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause -arch: arm -bsp: tms570ls3137_hdk_with_loader -build-type: bsp -cflags: [] -copyrights: -- Copyright (C) 2020 embedded brains GmbH & Co. KG -cppflags: [] -enabled-by: true -family: tms570 -includes: [] -install: [] -links: -- role: build-dependency - uid: ../../opto2 -- role: build-dependency - uid: ../../tstsmallmem -- role: build-dependency - uid: grp -source: [] -type: build diff --git a/spec/build/bsps/arm/tms570/grp.yml b/spec/build/bsps/arm/tms570/grp.yml index a31553c4e1..05f5eb13fc 100644 --- a/spec/build/bsps/arm/tms570/grp.yml +++ b/spec/build/bsps/arm/tms570/grp.yml @@ -43,6 +43,20 @@ links: - role: build-dependency uid: optlinkflags - role: build-dependency + uid: optmemflashorigin +- role: build-dependency + uid: optmemflashsize +- role: build-dependency + uid: optmemsdramorigin +- role: build-dependency + uid: optmemsdramsize +- role: build-dependency + uid: optmemsramorigin +- role: build-dependency + uid: optmemsramsize +- role: build-dependency + uid: linkcmdsmemory +- role: build-dependency uid: ../../linkcmds - role: build-dependency uid: ../../obj diff --git a/spec/build/bsps/arm/tms570/linkcmdsmemory.yml b/spec/build/bsps/arm/tms570/linkcmdsmemory.yml new file mode 100644 index 0000000000..33a87513bd --- /dev/null +++ b/spec/build/bsps/arm/tms570/linkcmdsmemory.yml @@ -0,0 +1,27 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +build-type: config-file +content: | + MEMORY { + ROM_INT : ORIGIN = ${TMS570_MEMORY_FLASH_ORIGIN:#010x}, LENGTH = ${TMS570_MEMORY_FLASH_SIZE:#010x} + RAM_INT : ORIGIN = ${TMS570_MEMORY_SRAM_ORIGIN:#010x}, LENGTH = ${TMS570_MEMORY_SRAM_SIZE:#010x} + RAM_EXT : ORIGIN = ${TMS570_MEMORY_SDRAM_ORIGIN:#010x}, LENGTH = ${TMS570_MEMORY_SDRAM_SIZE:#010x} + } + + tms570_memory_flash_begin = ORIGIN (ROM_INT); + tms570_memory_flash_end = ORIGIN (ROM_INT) + LENGTH (ROM_INT); + tms570_memory_flash_size = LENGTH (ROM_INT); + + tms570_memory_sram_begin = ORIGIN (RAM_INT); + tms570_memory_sram_end = ORIGIN (RAM_INT) + LENGTH (RAM_INT); + tms570_memory_sram_size = LENGTH (RAM_INT); + + tms570_memory_sdram_begin = ORIGIN (RAM_EXT); + tms570_memory_sdram_end = ORIGIN (RAM_EXT) + LENGTH (RAM_EXT); + tms570_memory_sdram_size = LENGTH (RAM_EXT); +copyrights: +- Copyright (C) 2023 embedded brains GmbH & Co. KG +enabled-by: true +install-path: ${BSP_LIBDIR} +links: [] +target: linkcmds.memory +type: build diff --git a/spec/build/bsps/arm/tms570/obj.yml b/spec/build/bsps/arm/tms570/obj.yml index 46e4eea116..d6a4255a52 100644 --- a/spec/build/bsps/arm/tms570/obj.yml +++ b/spec/build/bsps/arm/tms570/obj.yml @@ -68,7 +68,6 @@ install: - bsps/arm/tms570/start/linkcmds.tms570ls3137_hdk - bsps/arm/tms570/start/linkcmds.tms570ls3137_hdk_intram - bsps/arm/tms570/start/linkcmds.tms570ls3137_hdk_sdram - - bsps/arm/tms570/start/linkcmds.tms570ls3137_hdk_with_loader links: [] source: - bsps/arm/shared/cp15/arm-cp15-set-exception-handler.c diff --git a/spec/build/bsps/arm/tms570/optmemflashorigin.yml b/spec/build/bsps/arm/tms570/optmemflashorigin.yml new file mode 100644 index 0000000000..c25e230f5c --- /dev/null +++ b/spec/build/bsps/arm/tms570/optmemflashorigin.yml @@ -0,0 +1,18 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +actions: +- get-integer: null +- env-assign: null +- format-and-define: TMS570_MEMORY_FLASH_ORIGIN +build-type: option +copyrights: +- Copyright (C) 2023 embedded brains GmbH & Co. KG +default: +- enabled-by: true + value: 0x00000000 +description: | + Origin of the internal flash memory. +enabled-by: true +format: '{:#010x}' +links: [] +name: TMS570_MEMORY_FLASH_ORIGIN +type: build diff --git a/spec/build/bsps/arm/tms570/optmemflashsize.yml b/spec/build/bsps/arm/tms570/optmemflashsize.yml new file mode 100644 index 0000000000..defd82876e --- /dev/null +++ b/spec/build/bsps/arm/tms570/optmemflashsize.yml @@ -0,0 +1,20 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +actions: +- get-integer: null +- env-assign: null +- format-and-define: TMS570_MEMORY_FLASH_SIZE +build-type: option +copyrights: +- Copyright (C) 2023 embedded brains GmbH & Co. KG +default: +- enabled-by: TMS570_VARIANT_4357 + value: 0x00400000 +- enabled-by: true + value: 0x00300000 +description: | + Size in bytes of the internal flash memory. +enabled-by: true +format: '{:#010x}' +links: [] +name: TMS570_MEMORY_FLASH_SIZE +type: build diff --git a/spec/build/bsps/arm/tms570/optmemsdramorigin.yml b/spec/build/bsps/arm/tms570/optmemsdramorigin.yml new file mode 100644 index 0000000000..2220fc07a0 --- /dev/null +++ b/spec/build/bsps/arm/tms570/optmemsdramorigin.yml @@ -0,0 +1,18 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +actions: +- get-integer: null +- env-assign: null +- format-and-define: TMS570_MEMORY_SDRAM_ORIGIN +build-type: option +copyrights: +- Copyright (C) 2023 embedded brains GmbH & Co. KG +default: +- enabled-by: true + value: 0x80000000 +description: | + Origin of the external SDRAM memory. +enabled-by: true +format: '{:#010x}' +links: [] +name: TMS570_MEMORY_SDRAM_ORIGIN +type: build diff --git a/spec/build/bsps/arm/tms570/optmemsdramsize.yml b/spec/build/bsps/arm/tms570/optmemsdramsize.yml new file mode 100644 index 0000000000..e41cd24c40 --- /dev/null +++ b/spec/build/bsps/arm/tms570/optmemsdramsize.yml @@ -0,0 +1,18 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +actions: +- get-integer: null +- env-assign: null +- format-and-define: TMS570_MEMORY_SDRAM_SIZE +build-type: option +copyrights: +- Copyright (C) 2023 embedded brains GmbH & Co. KG +default: +- enabled-by: true + value: 0x00800000 +description: | + Size in bytes of the external SDRAM memory. +enabled-by: true +format: '{:#010x}' +links: [] +name: TMS570_MEMORY_SDRAM_SIZE +type: build diff --git a/spec/build/bsps/arm/tms570/optmemsramorigin.yml b/spec/build/bsps/arm/tms570/optmemsramorigin.yml new file mode 100644 index 0000000000..198eda69af --- /dev/null +++ b/spec/build/bsps/arm/tms570/optmemsramorigin.yml @@ -0,0 +1,18 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +actions: +- get-integer: null +- env-assign: null +- format-and-define: TMS570_MEMORY_SRAM_ORIGIN +build-type: option +copyrights: +- Copyright (C) 2023 embedded brains GmbH & Co. KG +default: +- enabled-by: true + value: 0x08000000 +description: | + Origin of the internal SRAM memory. +enabled-by: true +format: '{:#010x}' +links: [] +name: TMS570_MEMORY_SRAM_ORIGIN +type: build diff --git a/spec/build/bsps/arm/tms570/optmemsramsize.yml b/spec/build/bsps/arm/tms570/optmemsramsize.yml new file mode 100644 index 0000000000..515819daad --- /dev/null +++ b/spec/build/bsps/arm/tms570/optmemsramsize.yml @@ -0,0 +1,20 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +actions: +- get-integer: null +- env-assign: null +- format-and-define: TMS570_MEMORY_SRAM_SIZE +build-type: option +copyrights: +- Copyright (C) 2023 embedded brains GmbH & Co. KG +default: +- enabled-by: TMS570_VARIANT_4357 + value: 0x00080000 +- enabled-by: true + value: 0x00040000 +description: | + Size in bytes of the internal SRAM memory. +enabled-by: true +format: '{:#010x}' +links: [] +name: TMS570_MEMORY_SRAM_SIZE +type: build |