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 stack size for both threads, considering is set to 128 bytes? is currently set to 4096 bytes.
@Middleware & OS
6 Replies
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
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?
I dont remember quite well but there is a hardfault watcher in cube in debug mode in menus just explore cube ide top bar
I think my task uses dynamic allocation
This helped me with hardfaults https://interrupt.memfault.com/blog/cortex-m-hardfault-debug
Interrupt
How to debug a HardFault on an ARM Cortex-M MCU
A community and blog for embedded software makers
Ah, this is helpful @ZacckOsiemo , thanks