mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/rtos2-utils.git
synced 2025-06-10 18:15:59 +00:00
Add stack overflow detection helper
This commit is contained in:
parent
5cf9b25491
commit
2aed5c5ba3
24
src/debug/stack_overflow.cpp
Normal file
24
src/debug/stack_overflow.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
#include <sta/config.hpp>
|
||||
#ifdef STA_RTOS_STACK_OVERFLOW_HOOK
|
||||
|
||||
#include <sta/assert.hpp>
|
||||
#include <sta/debug_serial.hpp>
|
||||
|
||||
#include <FreeRTOS.h>
|
||||
#include <task.h>
|
||||
|
||||
|
||||
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
|
Loading…
x
Reference in New Issue
Block a user