However the two files are not aligned. The problems are:
Symbols xxx_DEFAULT, ROMx_STARTUP, RAMx_INIT are generated in regions.h but not used in linker script.
Linker script contains region RAM0..3 and ROM0..3, however the regions.h file may contain more regions as each memory defined in the DFP/BSP is mapped into a region.
Linker script region ROM0 contains vector table for startup - there is no flexibility in the script itself.
Linker script region RAM0 contains uninit sections - there seems to be no special handling required.
It is unclear how RAM_INIT should be handled by a linker script itself.
Do no longer generate the symbols xxx_DEFAULT, ROMx_STARTUP, RAMx_INIT
Add for ROM0 a comment that this is the startup region
Add for RAM0 a comment that this contains uninitialized memory, STACK and HEAP
As ROM0 is the startup region it should get the first memory from DFP/BSP that has the attribute startup set.
Combine contiguous memory from BSP/DFP into one region
Exclude memory from BSP/DFP that has attribute default=0 or Pname instead:
List memories with attribute Pname or default=0 in comment section (user may manually add it).
Once the files are generated/imported to the project they are under user control. Therefore the suggested behavior has acceptable user impact.
Environment (please complete the following information):
CMSIS-Toolbox Version 2.5.0
Additional context
It is unclear if and how init should be handled in linker scripts.
IMHO, there should be a resource management added to CMSIS-Toolbox that can deal with multi-core systems and applications that require bootloader/application/secure enclave.
Describe the problem
The CMSIS-Toolbox auto-generates
regions.h
files and provides linker scripts in theetc
directory as described here: https://github.com/Open-CMSIS-Pack/cmsis-toolbox/blob/main/docs/build-overview.md#linker-script-managementHowever the two files are not aligned. The problems are:
xxx_DEFAULT
,ROMx_STARTUP
,RAMx_INIT
are generated inregions.h
but not used in linker script.regions.h
file may contain more regions as each memory defined in the DFP/BSP is mapped into a region.It is unclear how RAM_INIT should be handled by a linker script itself.
To Reproduce See https://github.com/Open-CMSIS-Pack/STM32F746G-DISCO_BSP/tree/main/Layers/IoT/RTE/Device/STM32F746NGHx
Suggested behavior
Changes to auto-generated
regions.h
:xxx_DEFAULT
,ROMx_STARTUP
,RAMx_INIT
default=0
orPname
instead:Pname
ordefault=0
in comment section (user may manually add it).Once the files are generated/imported to the project they are under user control. Therefore the suggested behavior has acceptable user impact.
Environment (please complete the following information):
Additional context It is unclear if and how init should be handled in linker scripts.
IMHO, there should be a resource management added to CMSIS-Toolbox that can deal with multi-core systems and applications that require bootloader/application/secure enclave.