2115396
(Nozomi Nishimura)
May 26, 2021, 3:55pm
1
Board FRDM-K64F
mbed OS 5.13.4
A stack overflow has occurred.
I want to increase the stack size, where is it defined?
Error Message: CMSIS-RTOS error: Stack overflow
// Current Thread: main Id: 0x20002CD0 Entry: 0x31895
StackSize: 0x1000 StackMem: 0x1FFFA850 SP: 0x2002FF58
I’ve already tried to change the following macro definition, but the error message hasn’t changed and the stack size remained 0x1000.
mbed_config.h
#define MBED_CONF_RTOS_MAIN_THREAD_STACK_SIZE 4096
#define MBED_CONF_RTOS_THREAD_STACK_SIZE 4096
Thank you.
JohnnyK
(Jan Kamidra)
May 26, 2021, 4:17pm
2
Hello,
stands inside the file mbed_config.h
// Automatically generated configuration file.
// DO NOT EDIT, content will be overwritten.
Because these macros are auto generated before compiling from content of many .json files across the MbedOS. So you probably need change it via mbed_app.json
file.
This version of Mbed OS is too much old so documentation is not available but it will be same or similar -
The configuration system - Program setup | Mbed OS 6 Documentation
Hi,
I am having some really weird problem with mbed + nucleo_f207zg. Can someone offer some pointers?
On a customized PCB built around STM32F207ZGT6, if I leave main stack size as default 8192, then the app works largely fine.
"config": {
"main-stack-size": {
"value": 8192 // changing this line causing trouble
}
},
Once I change main stack size to something bigger, such 8196 or 8190, app will crash upon boot.
++ MbedOS Error Info ++
Error Status: 0x80010132 Code: 306 Modul…
BR, Jan
2115396
(Nozomi Nishimura)
May 28, 2021, 3:54am
3
Hello
I tried your advice, and it worked!
I changed rtos\mbed_lib.json file.
"config": {
"present": 1,
"main-thread-stack-size": {
"help": "The size of the main thread's stack",
"value": 8192
},
Thank you!
JohnnyK
(Jan Kamidra)
May 28, 2021, 4:30am
4
Hello again,
I’m glad you found what you needed.
However, small correction.
This way is possible but when you update or downgrade MbedOS you will lost this setting and will must be set again every time, when you will manipulate with MbedOS version.
Therefore, it is better to create mbed_app.json
in the project folder and place the same content in this file. That will overide original config from the rtos\mbed_lib.json
file.
{
"config": {
"main-stack-size": {
"value": 8192
}
}
}
BR, Jan
2115396
(Nozomi Nishimura)
May 31, 2021, 4:01am
5
HI,
Again, thanks for the comment!
I’ll follow your advice.
(I already checked your suggestion worked)
Thank you.
1 Like
ladislas
(Ladislas de Toldi)
March 18, 2022, 8:59am
6
I’m a bit late to the party, but the actual config name is main-thread-stack-size
, just in case
More info here: Scheduling options and config - API references and tutorials | Mbed OS 6 Documentation