I configured CubeMX STM32 to use FreeRTOS stack overflow monitoring. Now I want to test that it in fact works. I tried some simple stuff like executing below function in one of the threads
`// C program to demonstrate stack overflow
// by creating a non-terminating recursive
// function.
void fun(int x)
{
if (x == 1)
return;
x = 6;
fun(x);
}
int x = 5;
fun(x);
but I get HardFault.
Do you know a way to simulate stack overflow on FreeRTOS?
Looks like I found the solution. All you need is to change stack size of one thread to very low and program goes to vApplicationStackOverflowHook
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With