Skip to content

Commit 58f6bf7

Browse files
committed
[STM] Support boot stack size configuration option
1 parent 3525f6b commit 58f6bf7

File tree

164 files changed

+1173
-200
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

164 files changed

+1173
-200
lines changed

targets/TARGET_STM/TARGET_STM32F0/TARGET_DISCO_F051R8/device/TOOLCHAIN_ARM_STD/stm32f0xx.sct

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#! armcc -E
12
; Scatter-Loading Description File
23
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
34
; Copyright (c) 2014, STMicroelectronics
@@ -27,6 +28,12 @@
2728
; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2829
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2930

31+
#if !defined(MBED_BOOT_STACK_SIZE)
32+
#define MBED_BOOT_STACK_SIZE 0x400
33+
#endif
34+
35+
#define Stack_Size MBED_BOOT_STACK_SIZE
36+
3037
; STM32F030R8: 64KB FLASH (0x10000) + 8KB RAM (0x2000)
3138

3239
LR_IROM1 0x08000000 0x10000 { ; load region size_region
@@ -37,9 +44,11 @@
3744
}
3845

3946
; 48 vectors = 192 bytes (0xC0) to be reserved in RAM
40-
RW_IRAM1 (0x20000000+0xC0) (0x2000-0xC0) { ; RW data
47+
RW_IRAM1 (0x20000000+0xC0) (0x2000-0xC0-Stack_Size) { ; RW data
4148
.ANY (+RW +ZI)
4249
}
4350

51+
ARM_LIB_STACK (0x20000000+0x2000) EMPTY -Stack_Size { ; stack
52+
}
4453
}
4554

targets/TARGET_STM/TARGET_STM32F0/TARGET_DISCO_F051R8/device/TOOLCHAIN_GCC_ARM/STM32F0xx.ld

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
/* Linker script to configure memory regions. */
2+
3+
#if !defined(MBED_BOOT_STACK_SIZE)
4+
#define MBED_BOOT_STACK_SIZE 0x400
5+
#endif
6+
7+
STACK_SIZE = MBED_BOOT_STACK_SIZE;
8+
29
MEMORY
310
{
411
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 64k
@@ -146,7 +153,7 @@ SECTIONS
146153
* size of stack_dummy section */
147154
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
148155
_estack = __StackTop;
149-
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
156+
__StackLimit = __StackTop - STACK_SIZE;
150157
PROVIDE(__stack = __StackTop);
151158

152159
/* Check if data + heap + stack exceeds RAM limit */

targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F030R8/device/TOOLCHAIN_ARM_STD/stm32f0xx.sct

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#! armcc -E
12
; Scatter-Loading Description File
23
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
34
; Copyright (c) 2014, STMicroelectronics
@@ -27,6 +28,12 @@
2728
; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2829
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2930

31+
#if !defined(MBED_BOOT_STACK_SIZE)
32+
#define MBED_BOOT_STACK_SIZE 0x400
33+
#endif
34+
35+
#define Stack_Size MBED_BOOT_STACK_SIZE
36+
3037
; STM32F030R8: 64KB FLASH (0x10000) + 8KB RAM (0x2000)
3138

3239
LR_IROM1 0x08000000 0x10000 { ; load region size_region
@@ -37,9 +44,11 @@
3744
}
3845

3946
; 45 vectors = 180 bytes (0xB4); 8-byte aligned = 0xB8 (0xB4 + 0x4) to be reserved in RAM
40-
RW_IRAM1 (0x20000000+0xB8) (0x2000-0xB8) { ; RW data
47+
RW_IRAM1 (0x20000000+0xB8) (0x2000-0xB8-Stack_Size) { ; RW data
4148
.ANY (+RW +ZI)
4249
}
4350

51+
ARM_LIB_STACK (0x20000000+0x2000) EMPTY -Stack_Size { ; stack
52+
}
4453
}
4554

targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F030R8/device/TOOLCHAIN_GCC_ARM/STM32F030X8.ld

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
/* Linker script to configure memory regions. */
2+
3+
#if !defined(MBED_BOOT_STACK_SIZE)
4+
#define MBED_BOOT_STACK_SIZE 0x400
5+
#endif
6+
7+
STACK_SIZE = MBED_BOOT_STACK_SIZE;
8+
29
MEMORY
310
{
411
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 64k
@@ -145,7 +152,7 @@ SECTIONS
145152
* size of stack_dummy section */
146153
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
147154
_estack = __StackTop;
148-
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
155+
__StackLimit = __StackTop - STACK_SIZE;
149156
PROVIDE(__stack = __StackTop);
150157

151158
/* Check if data + heap + stack exceeds RAM limit */

targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F030R8/device/TOOLCHAIN_IAR/stm32f030x8.icf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ define symbol __ICFEDIT_region_ROM_end__ = 0x0800FFFF;
1010
define symbol __ICFEDIT_region_RAM_start__ = 0x200000B8; /* Add 4 more bytes after NVIC section to be aligned on 8 bytes */
1111
define symbol __ICFEDIT_region_RAM_end__ = 0x20001FFF;
1212
/*-Sizes-*/
13-
define symbol __ICFEDIT_size_cstack__ = 0x400;
13+
if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
14+
define symbol MBED_BOOT_STACK_SIZE = 0x400;
15+
}
16+
define symbol __ICFEDIT_size_cstack__ = MBED_BOOT_STACK_SIZE;
1417
define symbol __ICFEDIT_size_heap__ = 0x800;
1518
/**** End of ICF editor section. ###ICF###*/
1619

targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F031K6/device/TOOLCHAIN_ARM_STD/stm32f0xx.sct

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#! armcc -E
12
; Scatter-Loading Description File
23
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
34
; Copyright (c) 2014, STMicroelectronics
@@ -27,6 +28,12 @@
2728
; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2829
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2930

31+
#if !defined(MBED_BOOT_STACK_SIZE)
32+
#define MBED_BOOT_STACK_SIZE 0x400
33+
#endif
34+
35+
#define Stack_Size MBED_BOOT_STACK_SIZE
36+
3037
; 32KB FLASH (0x8000) + 4KB RAM (0x1000)
3138

3239
LR_IROM1 0x08000000 0x8000 { ; load region size_region
@@ -37,9 +44,11 @@
3744
}
3845

3946
; 44 vectors = 176 bytes (0xB0) to be reserved in RAM
40-
RW_IRAM1 (0x20000000+0xB0) (0x1000-0xB0) { ; RW data
47+
RW_IRAM1 (0x20000000+0xB0) (0x1000-0xB0-Stack_Size) { ; RW data
4148
.ANY (+RW +ZI)
4249
}
4350

51+
ARM_LIB_STACK (0x20000000+0x1000) EMPTY -Stack_Size { ; stack
52+
}
4453
}
4554

targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F031K6/device/TOOLCHAIN_GCC_ARM/STM32F031X6.ld

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
/* Linker script to configure memory regions. */
2+
3+
#if !defined(MBED_BOOT_STACK_SIZE)
4+
#define MBED_BOOT_STACK_SIZE 0x400
5+
#endif
6+
7+
STACK_SIZE = MBED_BOOT_STACK_SIZE;
8+
29
MEMORY
310
{
411
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 32k
@@ -145,7 +152,7 @@ SECTIONS
145152
* size of stack_dummy section */
146153
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
147154
_estack = __StackTop;
148-
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
155+
__StackLimit = __StackTop - STACK_SIZE;
149156
PROVIDE(__stack = __StackTop);
150157

151158
/* Check if data + heap + stack exceeds RAM limit */

targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F031K6/device/TOOLCHAIN_IAR/stm32f031x6.icf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ define symbol __ICFEDIT_region_ROM_end__ = 0x08007FFF;
99
define symbol __ICFEDIT_region_RAM_start__ = 0x200000B0;
1010
define symbol __ICFEDIT_region_RAM_end__ = 0x20000FFF;
1111
/*-Sizes-*/
12-
define symbol __ICFEDIT_size_cstack__ = 0x400;
12+
if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
13+
define symbol MBED_BOOT_STACK_SIZE = 0x400;
14+
}
15+
define symbol __ICFEDIT_size_cstack__ = MBED_BOOT_STACK_SIZE;
1316
define symbol __ICFEDIT_size_heap__ = 0x200;
1417
/**** End of ICF editor section. ###ICF###*/
1518

targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F042K6/device/TOOLCHAIN_ARM_STD/stm32f0xx.sct

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#! armcc -E
12
; Scatter-Loading Description File
23
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
34
; Copyright (c) 2014, STMicroelectronics
@@ -27,6 +28,12 @@
2728
; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2829
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2930

31+
#if !defined(MBED_BOOT_STACK_SIZE)
32+
#define MBED_BOOT_STACK_SIZE 0x400
33+
#endif
34+
35+
#define Stack_Size MBED_BOOT_STACK_SIZE
36+
3037
; 32KB FLASH (0x8000) + 6KB RAM (0x1800)
3138

3239
LR_IROM1 0x08000000 0x8000 { ; load region size_region
@@ -37,9 +44,11 @@
3744
}
3845

3946
; 48 vectors = 192 bytes (0xC0) to be reserved in RAM
40-
RW_IRAM1 (0x20000000+0xC0) (0x1800-0xC0) { ; RW data
47+
RW_IRAM1 (0x20000000+0xC0) (0x1800-0xC0-Stack_Size) { ; RW data
4148
.ANY (+RW +ZI)
4249
}
4350

51+
ARM_LIB_STACK (0x20000000+0x1800) EMPTY -Stack_Size { ; stack
52+
}
4453
}
4554

targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F042K6/device/TOOLCHAIN_GCC_ARM/STM32F042X6.ld

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
/* Linker script to configure memory regions. */
2+
3+
#if !defined(MBED_BOOT_STACK_SIZE)
4+
#define MBED_BOOT_STACK_SIZE 0x400
5+
#endif
6+
7+
STACK_SIZE = MBED_BOOT_STACK_SIZE;
8+
29
MEMORY
310
{
411
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 32k
@@ -145,7 +152,7 @@ SECTIONS
145152
* size of stack_dummy section */
146153
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
147154
_estack = __StackTop;
148-
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
155+
__StackLimit = __StackTop - STACK_SIZE;
149156
PROVIDE(__stack = __StackTop);
150157

151158
/* Check if data + heap + stack exceeds RAM limit */

0 commit comments

Comments
 (0)