Skip to content

Commit 9b2ba12

Browse files
committed
Increase background stack size to fix overflows with debug profile
1 parent ffe9ddf commit 9b2ba12

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

rtos/TARGET_CORTEX/mbed_rtx_conf.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,18 @@
4545
#else
4646
#define EXTRA_IDLE_STACK 0
4747
#endif
48+
49+
// Increase the idle thread stack size when debug is enabled
50+
#if defined(MBED_DEBUG)
51+
#define EXTRA_IDLE_STACK_DEBUG MBED_CONF_RTOS_IDLE_THREAD_STACK_SIZE_DEBUG_EXTRA
52+
#else
53+
#define EXTRA_IDLE_STACK_DEBUG 0
54+
#endif
55+
4856
#ifdef MBED_CONF_APP_IDLE_THREAD_STACK_SIZE
49-
#define OS_IDLE_THREAD_STACK_SIZE (MBED_CONF_APP_IDLE_THREAD_STACK_SIZE + EXTRA_IDLE_STACK)
57+
#define OS_IDLE_THREAD_STACK_SIZE MBED_CONF_APP_IDLE_THREAD_STACK_SIZE
5058
#else
51-
#define OS_IDLE_THREAD_STACK_SIZE (MBED_CONF_RTOS_IDLE_THREAD_STACK_SIZE + EXTRA_IDLE_STACK)
59+
#define OS_IDLE_THREAD_STACK_SIZE (MBED_CONF_RTOS_IDLE_THREAD_STACK_SIZE + EXTRA_IDLE_STACK + EXTRA_IDLE_STACK_DEBUG)
5260
#endif
5361

5462
#define OS_DYNAMIC_MEM_SIZE 0

rtos/mbed_lib.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,22 @@
2121
"idle-thread-stack-size-tickless-extra": {
2222
"help": "Additional size to add to the idle thread when tickless is enabled and LPTICKER_DELAY_TICKS is used",
2323
"value": 256
24+
},
25+
"idle-thread-stack-size-debug-extra": {
26+
"help": "Additional size to add to the idle thread when code compilation optimisation is disabled",
27+
"value": 0
2428
}
2529
},
2630
"macros": ["_RTE_"],
2731
"target_overrides": {
2832
"*": {
2933
"target.boot-stack-size": "0x400"
34+
},
35+
"STM": {
36+
"idle-thread-stack-size-debug-extra": 128
37+
},
38+
"STM32L1": {
39+
"idle-thread-stack-size-debug-extra": 512
3040
},
3141
"MCU_NRF51": {
3242
"target.boot-stack-size": "0x800"

0 commit comments

Comments
 (0)