diff --git a/src/debug/stack_overflow.cpp b/src/debug/stack_overflow.cpp new file mode 100644 index 0000000..06cf2a7 --- /dev/null +++ b/src/debug/stack_overflow.cpp @@ -0,0 +1,24 @@ +#include +#ifdef STA_RTOS_STACK_OVERFLOW_HOOK + +#include +#include + +#include +#include + + +extern "C" void vApplicationStackOverflowHook(xTaskHandle xTask, signed char *pcTaskName) +{ + // TODO Handle corrupted parameters + // * check pcTaskName is cstring (look for \0 within ? bytes) + STA_DEBUG_PRINT("Stack overflow detected in task "); + if (pcTaskName) + { + STA_DEBUG_PRINTLN(pcTaskName); + } + STA_HALT(); +} + + +#endif // STA_RTOS_STACK_OVERFLOW_HOOK