Complete the code to enable stack overflow checking method 1 in FreeRTOSConfig.h.
#define configCHECK_FOR_STACK_OVERFLOW [1]
Setting configCHECK_FOR_STACK_OVERFLOW to 1 enables method 1 stack overflow checking in FreeRTOS.
Complete the function prototype for the stack overflow hook used with method 1 or 2.
void vApplicationStackOverflowHook([1]);The hook function receives the task handle and the task name as parameters.
Fix the error in the stack overflow hook implementation to correctly handle method 2 detection.
void vApplicationStackOverflowHook(TaskHandle_t xTask, char *pcTaskName) {
[1];
for( ;; );
}Disabling interrupts immediately prevents further damage after detecting stack overflow.
Fill both blanks to configure FreeRTOS for stack overflow detection method 2 and enable the hook.
#define configCHECK_FOR_STACK_OVERFLOW [1] #define configUSE_STACK_OVERFLOW_HOOK [2]
Method 2 is enabled by setting configCHECK_FOR_STACK_OVERFLOW to 2 and enabling the hook with configUSE_STACK_OVERFLOW_HOOK set to 1.
Fill all three blanks to implement a stack overflow hook that disables interrupts, logs the task name, and halts the system.
void vApplicationStackOverflowHook(TaskHandle_t xTask, char *pcTaskName) {
[1];
printf("Stack overflow in task: %s\n", [2]);
for( [3] );
}The hook disables interrupts, prints the task name, and enters an infinite loop to halt the system.