Finding CSTACK and HEAP for FreeRTOS embedded application ?
Our embedded application keep crashing VListinsertend after some time of operations.
Is this due to CSTACK and HEAP size ?
**FreeRTOS details
**
FreeRTOS 8.2 with heap 4 , Systick timer
osThreadDef(Task1, StartTask1, osPriorityRealtime, 0, 256);
osThreadDef(Task2, StartTask2, osPriorityHigh, 0, 196);
osThreadDef(Task3,StartTask3, osPriorityRealtime, 0, 256);
osThreadDef(Task4, StartTask4, osPriorityAboveNormal, 0, 196);
**MicroController is STM32F303CC
**
256 Kbytes of Flash memory
40 Kbytes of SRAM,
Routine booster: 8 Kbytes of SRAM on instruction and data bus, with HW parity check (CCM)
** Custom CSTACK and HEAP settings
**
CSTACK : 0X600
HEAP : 0X300
What should be the ideal CSTACK and HEAP size for the this kind of appilcations ?
Finding CSTACK and HEAP for FreeRTOS embedded application ?
Is this due to CSTACK and HEAP size ?Could be, or it could be one of a number of different things, the level of detail in your post only allows us to guess.
FreeRTOS 8.2 with heap 4 , Systick timerI would recommend upgrading to a much newer version of FreeRTOS because the later the version there more configASSERT() calls there are to check you are configuring the system correctly. You may find with a later version of FreeRTOS and configASSERT() defined to something that halts execution you find the cause of your problem immediately.
osThreadDef(Task1, StartTask1, osPriorityRealtime, 0, 256); osThreadDef(Task2, StartTask2, osPriorityHigh, 0, 196); osThreadDef(Task3,StartTask3, osPriorityRealtime, 0, 256); osThreadDef(Task4, StartTask4, osPriorityAboveNormal, 0, 196);This is not the native FreeRTOS API.
*MicroController is STM32F303CCAs this is an STM32 did you note the ‘special note for STM32 users’ on this page: https://www.freertos.org/RTOS-Cortex-M3-M4.html that says you must call NVICPriorityGroupConfig( NVICPriorityGroup_4 ); before starting the scheduler?
* 256 Kbytes of Flash memory 40 Kbytes of SRAM, Routine booster: 8 Kbytes of SRAM on instruction and data bus, with HW parity check (CCM) *Custom CSTACK and HEAP settings * CSTACK : 0X600 HEAP : 0X300The cause won’t be one of these as the CStack is only used by interrupts after the scheduler has started and if you are using heap_4 then the heap set up by the compiler/linker will only be used if you call malloc() directly yourself – FreeRTOS won’t call it. Some links you might find helpful: https://www.freertos.org/a00111.html https://www.freertos.org/FAQHelp.html https://www.freertos.org/Documentation/RTOS_book.html