mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/rtos2-utils.git
synced 2025-08-03 02:11:53 +00:00
36 lines
697 B
C++
36 lines
697 B
C++
#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, char * pcTaskName)
|
|
{
|
|
STA_DEBUG_PRINT("Stack overflow detected in task ");
|
|
if (pcTaskName)
|
|
{
|
|
// Manually calculate string length
|
|
// Limited to configMAX_TASK_NAME_LEN to avoid reading
|
|
// garbage values in case TCB has been corrupted
|
|
size_t len = 0;
|
|
while (len < configMAX_TASK_NAME_LEN)
|
|
{
|
|
if (pcTaskName[len] == '\0')
|
|
{
|
|
break;
|
|
}
|
|
++len;
|
|
}
|
|
|
|
STA_DEBUG_PRINTLN(pcTaskName, len);
|
|
}
|
|
STA_HALT();
|
|
}
|
|
|
|
|
|
#endif // STA_RTOS_STACK_OVERFLOW_HOOK
|