diff --git a/epicardium/FreeRTOSConfig.h b/epicardium/FreeRTOSConfig.h index 6822b06869e173a68ccef3a8081ce558478bf675..b92b12b9ec223da13082f23fcad849a1337ba316 100644 --- a/epicardium/FreeRTOSConfig.h +++ b/epicardium/FreeRTOSConfig.h @@ -56,6 +56,13 @@ /* Allow static allocation of data structures */ #define configSUPPORT_STATIC_ALLOCATION 1 +/* + * Enable stack overflow detector. + * + * TODO: Remove for production. + */ +#define configCHECK_FOR_STACK_OVERFLOW 2 + /* Alias the default handler names to match CMSIS weak symbols */ #define vPortSVCHandler SVC_Handler #define xPortPendSVHandler PendSV_Handler diff --git a/epicardium/support.c b/epicardium/support.c index 534506ba3ca22fe6e827b3fe1aca22a1668be853..a4af99db481fc0530545832221af9a99fb90bc64 100644 --- a/epicardium/support.c +++ b/epicardium/support.c @@ -6,6 +6,7 @@ #include "task.h" #include "api/dispatcher.h" +#include "modules/log.h" #include "card10.h" @@ -112,3 +113,8 @@ void vApplicationGetTimerTaskMemory( */ *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; } + +void vApplicationStackOverflowHook(TaskHandle_t xTask, signed char *pcTaskName) +{ + LOG_CRIT("rtos", "Task \"%s\" overflowed stack!", pcTaskName); +}