Skip to content

Commit 39e69d3

Browse files
committed
Use boot stack size from config system
To allow overriding of the boot stack size from the Mbed configuration system, consistently use MBED_CONF_TARGET_BOOT_STACK_SIZE rather than MBED_BOOT_STACK_SIZE. Fixes #10319
1 parent 5940b16 commit 39e69d3

File tree

438 files changed

+1444
-1440
lines changed

Some content is hidden

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

438 files changed

+1444
-1440
lines changed

docs/design-documents/platform/memory-model/ram_memory_model.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,16 @@ Phase 2:
9090
Note: Heap split support across multiple RAM banks, can also be achieved post this change.
9191

9292
# Detailed Design
93-
1. Update tools to set define `MBED_BOOT_STACK_SIZE` from target config option `target.boot-stack-size`
94-
1. Linker Scripts - Update linker scripts for ARM, IAR and GCC toolchain to use MBED_BOOT_STACK_SIZE define for standardizing size of ISR stack.
93+
1. Update tools to set define `MBED_CONF_TARGET_BOOT_STACK_SIZE` from target config option `target.boot-stack-size`
94+
1. Linker Scripts - Update linker scripts for ARM, IAR and GCC toolchain to use MBED_CONF_TARGET_BOOT_STACK_SIZE define for standardizing size of ISR stack.
9595
1. Update __user_setup_stackheap() implementation to adopt 2-region RAM memory model.
9696
__user_setup_stackheap() works with systems where the application starts with a value of sp (r13) that is already correct. To make use of sp(stack base), implement __user_setup_stackheap() to set up r0 (heap base), r2 (heap limit), and r3 (stack limit) (for a two-region model) and return.
9797
Reference http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.kui0099a/armlib_cjagaaha.htm http://www.keil.com/support/man/docs/armlib/armlib_chr1359122863069.htm
9898
1. Modify _sbrk() implementation for GCC to use 2-region memory model
9999

100100
# Tools and configuration changes
101101

102-
1. Target config option "target.boot-stack-size" which is passed to the linker as the define "MBED_BOOT_STACK_SIZE" so the linker can adjust the stack accordingly.
102+
1. Target config option "target.boot-stack-size" which is passed to the linker as the define "MBED_CONF_TARGET_BOOT_STACK_SIZE" so the linker can adjust the stack accordingly.
103103
Boot stack size - the size of ISR and main stack will be 4K as default in targets.json for bare metal (non-RTOS) builds.
104104
Boot stack size - the size of ISR stack will be over-written as 1K in `rtos/mbed_lib.json` for RTOS builds.
105105

hal/tests/TESTS/mbed_hal/stack_size_unification/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ extern uint32_t mbed_stack_isr_size;
3737

3838
#define EXPECTED_USER_THREAD_DEFAULT_STACK_SIZE (MBED_CONF_RTOS_THREAD_STACK_SIZE)
3939

40-
#if ((MBED_RAM_SIZE - MBED_BOOT_STACK_SIZE) <= (EXPECTED_MAIN_THREAD_STACK_SIZE + EXPECTED_ISR_STACK_SIZE))
40+
#if ((MBED_RAM_SIZE - MBED_CONF_TARGET_BOOT_STACK_SIZE) <= (EXPECTED_MAIN_THREAD_STACK_SIZE + EXPECTED_ISR_STACK_SIZE))
4141
#error [NOT_SUPPORTED] Insufficient stack for staci_size_unification tests
4242
#endif
4343

storage/blockdevice/tests/TESTS/blockdevice/heap_block_device/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ using namespace utest::v1;
2828
#define TEST_BLOCK_COUNT 10
2929
#define TEST_ERROR_MASK 16
3030

31-
#if ((MBED_RAM_SIZE - MBED_BOOT_STACK_SIZE) <= TEST_BLOCK_DEVICE_SIZE)
31+
#if ((MBED_RAM_SIZE - MBED_CONF_TARGET_BOOT_STACK_SIZE) <= TEST_BLOCK_DEVICE_SIZE)
3232
#error [NOT_SUPPORTED] Insufficient heap for heap block device tests
3333
#endif
3434

storage/blockdevice/tests/TESTS/blockdevice/mbr_block_device/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ using namespace utest::v1;
2727
#define BLOCK_COUNT 16
2828
#define BLOCK_SIZE 512
2929

30-
#if ((MBED_RAM_SIZE - MBED_BOOT_STACK_SIZE) <= (BLOCK_COUNT * BLOCK_SIZE))
30+
#if ((MBED_RAM_SIZE - MBED_CONF_TARGET_BOOT_STACK_SIZE) <= (BLOCK_COUNT * BLOCK_SIZE))
3131
#error [NOT_SUPPORTED] Insufficient heap for mbr block device tests
3232
#endif
3333

storage/blockdevice/tests/TESTS/blockdevice/util_block_device/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ using namespace utest::v1;
2929
#define BLOCK_COUNT 16
3030
#define BLOCK_SIZE 512
3131

32-
#if ((MBED_RAM_SIZE - MBED_BOOT_STACK_SIZE) <= (BLOCK_COUNT * BLOCK_SIZE))
32+
#if ((MBED_RAM_SIZE - MBED_CONF_TARGET_BOOT_STACK_SIZE) <= (BLOCK_COUNT * BLOCK_SIZE))
3333
#error [NOT_SUPPORTED] Insufficient heap for util block device tests
3434
#endif
3535

targets/TARGET_ARM_FM/TARGET_FVP_MPS2/TARGET_FVP_MPS2_M0/device/TOOLCHAIN_ARM_STD/MPS2.sct

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@
3838
#include "../memory_zones.h"
3939
#include "../cmsis_nvic.h"
4040

41-
#if !defined(MBED_BOOT_STACK_SIZE)
42-
#define MBED_BOOT_STACK_SIZE 0x400
41+
#if !defined(MBED_CONF_TARGET_BOOT_STACK_SIZE)
42+
#define MBED_CONF_TARGET_BOOT_STACK_SIZE 0x400
4343
#endif
4444

4545
#if (defined(__stack_size__))
4646
#define STACK_SIZE __stack_size__
4747
#else
48-
#define STACK_SIZE MBED_BOOT_STACK_SIZE
48+
#define STACK_SIZE MBED_CONF_TARGET_BOOT_STACK_SIZE
4949
#endif
5050

5151
; The vector table is loaded at address 0x00000000 in Flash memory region.

targets/TARGET_ARM_FM/TARGET_FVP_MPS2/TARGET_FVP_MPS2_M0/device/TOOLCHAIN_GCC_ARM/MPS2.ld

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
#include "../memory_zones.h"
3232
#include "../cmsis_nvic.h"
3333

34-
#if !defined(MBED_BOOT_STACK_SIZE)
35-
#define MBED_BOOT_STACK_SIZE 0x400
34+
#if !defined(MBED_CONF_TARGET_BOOT_STACK_SIZE)
35+
#define MBED_CONF_TARGET_BOOT_STACK_SIZE 0x400
3636
#endif
3737

3838
MEMORY
@@ -69,7 +69,7 @@ MEMORY
6969
*/
7070
ENTRY(Reset_Handler)
7171

72-
STACK_SIZE = MBED_BOOT_STACK_SIZE;
72+
STACK_SIZE = MBED_CONF_TARGET_BOOT_STACK_SIZE;
7373

7474
/* Size of the vector table in SRAM */
7575
M_VECTOR_RAM_SIZE = NVIC_VECTORS_SIZE;

targets/TARGET_ARM_FM/TARGET_FVP_MPS2/TARGET_FVP_MPS2_M0/device/TOOLCHAIN_IAR/MPS2.icf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ define symbol __ICFEDIT_region_RAM_end__ = ZBT_SRAM2_START + ZBT_SRAM2_SIZE
4646

4747
/*-Sizes-*/
4848
/* Heap and Stack size */
49-
if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
50-
define symbol MBED_BOOT_STACK_SIZE = 0x400;
49+
if (!isdefinedsymbol(MBED_CONF_TARGET_BOOT_STACK_SIZE)) {
50+
define symbol MBED_CONF_TARGET_BOOT_STACK_SIZE = 0x400;
5151
}
5252
define symbol __ICFEDIT_size_heap__ = 0x200000;
53-
define symbol __ICFEDIT_size_cstack__ = MBED_BOOT_STACK_SIZE;
53+
define symbol __ICFEDIT_size_cstack__ = MBED_CONF_TARGET_BOOT_STACK_SIZE;
5454
/**** End of ICF editor section. ###ICF###*/
5555

5656
define memory mem with size = 4G;

targets/TARGET_ARM_FM/TARGET_FVP_MPS2/TARGET_FVP_MPS2_M0P/device/TOOLCHAIN_ARM_STD/MPS2.sct

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@
3838
#include "../memory_zones.h"
3939
#include "../cmsis_nvic.h"
4040

41-
#if !defined(MBED_BOOT_STACK_SIZE)
42-
#define MBED_BOOT_STACK_SIZE 0x400
41+
#if !defined(MBED_CONF_TARGET_BOOT_STACK_SIZE)
42+
#define MBED_CONF_TARGET_BOOT_STACK_SIZE 0x400
4343
#endif
4444

4545
#if (defined(__stack_size__))
4646
#define STACK_SIZE __stack_size__
4747
#else
48-
#define STACK_SIZE MBED_BOOT_STACK_SIZE
48+
#define STACK_SIZE MBED_CONF_TARGET_BOOT_STACK_SIZE
4949
#endif
5050

5151
; The vector table is loaded at address 0x00000000 in Flash memory region.

targets/TARGET_ARM_FM/TARGET_FVP_MPS2/TARGET_FVP_MPS2_M0P/device/TOOLCHAIN_GCC_ARM/MPS2.ld

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
#include "../memory_zones.h"
3232
#include "../cmsis_nvic.h"
3333

34-
#if !defined(MBED_BOOT_STACK_SIZE)
35-
#define MBED_BOOT_STACK_SIZE 0x400
34+
#if !defined(MBED_CONF_TARGET_BOOT_STACK_SIZE)
35+
#define MBED_CONF_TARGET_BOOT_STACK_SIZE 0x400
3636
#endif
3737

3838
MEMORY
@@ -69,7 +69,7 @@ MEMORY
6969
*/
7070
ENTRY(Reset_Handler)
7171

72-
STACK_SIZE = MBED_BOOT_STACK_SIZE;
72+
STACK_SIZE = MBED_CONF_TARGET_BOOT_STACK_SIZE;
7373

7474
/* Size of the vector table in SRAM */
7575
M_VECTOR_RAM_SIZE = NVIC_VECTORS_SIZE;

0 commit comments

Comments
 (0)