Skip to content

Commit 95dcd75

Browse files
author
Deepika
committed
Update the linker script to support RW/ZI/Heap span across RAM banks
As per EWARM Development guide A region consists of one or several memory ranges, where each memory range consists of a continuous sequence of bytes in a specific memory. Several ranges can be combined by using region expressions. Note that those ranges do not need to be consecutive or even in the same memory. RAM region here is made as combination of 2-RAM banks define region RAM_region = mem:[from __SRAM2_start__ to __SRAM2_end__] | mem:[from __SRAM1_start__ to __SRAM1_end__]; block can be placed in specific region which can have several ranges. place in RAM_region { block RW }; place in RAM_region { block ZI }; place in RAM_region { block HEAP };
1 parent 6dbc00d commit 95dcd75

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

targets/TARGET_STM/TARGET_STM32L4/TARGET_STM32L443xC/device/TOOLCHAIN_IAR/stm32l443xx.icf

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ define symbol __region_SRAM1_end__ = 0x2000BFFF;
1818
/* Memory regions */
1919
define memory mem with size = 4G;
2020
define region ROM_region = mem:[from __region_ROM_start__ to __region_ROM_end__];
21-
define region SRAM2_region = mem:[from __region_SRAM2_start__ to __region_SRAM2_end__];
22-
define region SRAM1_region = mem:[from __region_SRAM1_start__ to __region_SRAM1_end__];
21+
define region RAM_region = mem:[from __region_SRAM2_start__ to __region_SRAM2_end__];
22+
| mem:[from __region_SRAM1_start__ to __region_SRAM1_end__];
2323

2424
if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
2525
define symbol MBED_BOOT_STACK_SIZE = 0x400;
@@ -37,5 +37,4 @@ do not initialize { section .noinit };
3737
place at address mem:__intvec_start__ { readonly section .intvec };
3838

3939
place in ROM_region { readonly };
40-
place in SRAM1_region { readwrite, block STACKHEAP };
41-
place in SRAM2_region { };
40+
place in RAM_region { readwrite, zeroinit, block STACKHEAP };

targets/TARGET_STM/TARGET_STM32L4/TARGET_STM32L475xG/device/TOOLCHAIN_IAR/stm32l475xx.icf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,19 @@ define symbol __NVIC_start__ = 0x10000000;
1212
define symbol __NVIC_end__ = 0x10000187;
1313
define symbol __region_SRAM2_start__ = 0x10000188;
1414
define symbol __region_SRAM2_end__ = 0x10007FFF;
15+
1516
define symbol __region_CRASH_DATA_RAM_start__ = 0x20000000;
1617
define symbol __region_CRASH_DATA_RAM_end__ = 0x200000FF;
18+
1719
define symbol __region_SRAM1_start__ = 0x20000100;
1820
define symbol __region_SRAM1_end__ = 0x20017FFF;
1921

2022
/* Memory regions */
2123
define memory mem with size = 4G;
2224
define region ROM_region = mem:[from __region_ROM_start__ to __region_ROM_end__];
23-
define region SRAM2_region = mem:[from __region_SRAM2_start__ to __region_SRAM2_end__];
2425
define region CRASH_DATA_RAM_region = mem:[from __region_CRASH_DATA_RAM_start__ to __region_CRASH_DATA_RAM_end__];
25-
define region SRAM1_region = mem:[from __region_SRAM1_start__ to __region_SRAM1_end__];
26+
define region RAM_region = mem:[from __region_SRAM2_start__ to __region_SRAM2_end__]
27+
| mem:[from __region_SRAM1_start__ to __region_SRAM1_end__];
2628

2729
/* Define Crash Data Symbols */
2830
define exported symbol __CRASH_DATA_RAM_START__ = __region_CRASH_DATA_RAM_start__;
@@ -33,15 +35,13 @@ if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
3335
}
3436

3537
define symbol __size_cstack__ = MBED_BOOT_STACK_SIZE;
36-
define symbol __size_heap__ = 0x17000;
38+
define symbol __size_heap__ = 0x12000;
3739
define block CSTACK with alignment = 8, size = __size_cstack__ { };
3840
define block HEAP with alignment = 8, size = __size_heap__ { };
3941

4042
initialize by copy with packing = zeros { readwrite };
4143
do not initialize { section .noinit };
4244

4345
place at address mem:__intvec_start__ { readonly section .intvec };
44-
4546
place in ROM_region { readonly };
46-
place in SRAM1_region { readwrite, block HEAP };
47-
place in SRAM2_region { first block CSTACK, zeroinit };
47+
place in RAM_region { first block CSTACK, readwrite, zeroinit, block HEAP };

0 commit comments

Comments
 (0)