Issue details
While some detailed build configuration, There are potential stack overflow in thread function named pmTask
|
#define FREERTOS_MIN_STACK_SIZE 150 // M4-FPU register setup is bigger so stack needs to be bigger |
|
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) FREERTOS_MIN_STACK_SIZE ) |
|
#define PM_TASK_STACKSIZE configMINIMAL_STACK_SIZE |
|
STATIC_MEM_TASK_ALLOC(pmTask, PM_TASK_STACKSIZE); |
|
STATIC_MEM_TASK_CREATE(pmTask, pmTask, PM_TASK_NAME, NULL, PM_TASK_PRI); |
In this line, pmTask Allows 600(150 * 4) stack size.
However, after checking the stack using our internally developed tool, it might have 612 Bytes in with some detailed configurations.
Steps to produce
1. In Makefile, add this line:
This will help you automatically calculating stack size of each function.
2. Build normally, using this configurations:
(make cf2_defconfig ->) make
Now we can get stack usage file (*.su) for each source file, So we can manually check stack size of each function.
In case of pmTask :
There are large call stack with this flow:
pmTask (pmTask) => 104 bytes
ledseqRunBlocking (ledseqRunBlocking) => 24 bytes
runLedseq (runLedseq) => 56 bytes
updateActive (updateActive) => 16 bytes
ledSet (ledSet) => 16 bytes
ledSetForce.part.0 (ledSetForce.part.0) => 88 bytes
syslinkSendPacket (syslinkSendPacket) => 24 bytes
uartslkSendDataDmaBlocking (uartslkSendDataDmaBlocking) => 24 bytes
xQueueGenericSend (xQueueGenericSend) => 40 bytes
xTaskResumeAll (xTaskResumeAll) => 32 bytes
xTaskIncrementTick (xTaskIncrementTick) => 48 bytes
assertFail (assertFail) => 8 bytes
eprintf (eprintf) => 12 bytes
evprintf (evprintf) => 48 bytes
itoa10 (itoa10) => 32 bytes
itoa10Unsigned (itoa10Unsigned) => 40 bytes
SUM => 612 bytes
So, there are potentially occur stack overflow in pmTask Thread function.
Environment
Version
Commit a5c3837
Issue details
While some detailed build configuration, There are potential stack overflow in thread function named
pmTaskcrazyflie-firmware/src/config/config.h
Line 55 in 83aa19e
crazyflie-firmware/src/config/FreeRTOSConfig.h
Line 79 in 83aa19e
crazyflie-firmware//src/config/config.h
Line 175 in 83aa19e
crazyflie-firmware/src/hal/src/pm_stm32f4.c
Line 124 in 83aa19e
crazyflie-firmware/src/hal/src/pm_stm32f4.c
Line 132 in 83aa19e
In this line,
pmTaskAllows600(150 * 4)stack size.However, after checking the stack using our internally developed tool, it might have
612Bytes in with some detailed configurations.Steps to produce
1. In Makefile, add this line:
This will help you automatically calculating stack size of each function.
2. Build normally, using this configurations:
(make cf2_defconfig ->) make
Now we can get stack usage file (
*.su) for each source file, So we can manually check stack size of each function.In case of pmTask :
There are large call stack with this flow:
SUM => 612 bytes
So, there are potentially occur stack overflow in
pmTaskThread function.Environment
Version
Commit a5c3837