my FreeRTOS project on STM32F103 exhibits a strange behavior with thread stack sizes

Hey guys my FreeRTOS project on STM32F103 exhibits a strange behavior with thread stack sizes. ManagerTask android RFIDTask function flawlessly with 128 and 256 bytes of stack space, respectively. However, increasing either thread's stack beyond 512 bytes leads to both threads crashing with what appears to be stack corruption , something like "nonsensical values in stack memory". How can I determine the
MAX SAFE TOTAL
MAX SAFE TOTAL
stack size for both threads, considering
configMINIMAL_STACK_SIZE
configMINIMAL_STACK_SIZE
is set to 128 bytes?
configTOTAL_HEAP_SIZE
configTOTAL_HEAP_SIZE
is currently set to 4096 bytes. @Middleware & OS
attachment 0
6 Replies
electro_coco
electro_coco4mo ago
U have stack overflow what is maximum ram size of your mcu You are exceeding it Make sure your task are static so that dynamic allocation doesnot occur and your task memory gets allocated at complie time Plus start in debug mode with hardfault handler watched if you are using cube ide Your mcu is going to hard fault
Marvee Amasi
Marvee Amasi4mo ago
I'm not entirely familiar with using the hardfault handler for debugging. Could you provide some guidance on setting it up in CubeIDE to help diagnose the stack issue?
electro_coco
electro_coco4mo ago
I dont remember quite well but there is a hardfault watcher in cube in debug mode in menus just explore cube ide top bar
Marvee Amasi
Marvee Amasi4mo ago
I think my task uses dynamic allocation
ZacckOsiemo
ZacckOsiemo4mo ago
Interrupt
How to debug a HardFault on an ARM Cortex-M MCU
A community and blog for embedded software makers
Marvee Amasi
Marvee Amasi4mo ago
Ah, this is helpful @ZacckOsiemo , thanks
Want results from more Discord servers?
Add your server