0
0
FreeRTOSprogramming~10 mins

Stack overflow detection (method 1 and 2) in FreeRTOS - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to enable stack overflow checking method 1 in FreeRTOSConfig.h.

FreeRTOS
#define configCHECK_FOR_STACK_OVERFLOW [1]
Drag options to blanks, or click blank then click option'
A0
B3
C2
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Setting the value to 0 disables checking.
Using 2 enables method 2, not method 1.
2fill in blank
medium

Complete the function prototype for the stack overflow hook used with method 1 or 2.

FreeRTOS
void vApplicationStackOverflowHook([1]);
Drag options to blanks, or click blank then click option'
Avoid
BTaskHandle_t xTask, char *pcTaskName
CTaskHandle_t xTask
Dint xTask
Attempts:
3 left
💡 Hint
Common Mistakes
Using only one parameter.
Using incorrect parameter types.
3fill in blank
hard

Fix the error in the stack overflow hook implementation to correctly handle method 2 detection.

FreeRTOS
void vApplicationStackOverflowHook(TaskHandle_t xTask, char *pcTaskName) {
    [1];
    for( ;; );
}
Drag options to blanks, or click blank then click option'
AtaskDISABLE_INTERRUPTS()
BvTaskSuspendAll()
CvTaskDelete(xTask)
DportYIELD()
Attempts:
3 left
💡 Hint
Common Mistakes
Calling vTaskDelete inside the hook.
Not disabling interrupts before infinite loop.
4fill in blank
hard

Fill both blanks to configure FreeRTOS for stack overflow detection method 2 and enable the hook.

FreeRTOS
#define configCHECK_FOR_STACK_OVERFLOW [1]
#define configUSE_STACK_OVERFLOW_HOOK [2]
Drag options to blanks, or click blank then click option'
A2
B1
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Setting the hook macro to 0 disables the hook.
Using method 1 value instead of 2.
5fill in blank
hard

Fill all three blanks to implement a stack overflow hook that disables interrupts, logs the task name, and halts the system.

FreeRTOS
void vApplicationStackOverflowHook(TaskHandle_t xTask, char *pcTaskName) {
    [1];
    printf("Stack overflow in task: %s\n", [2]);
    for( [3] );
}
Drag options to blanks, or click blank then click option'
AtaskDISABLE_INTERRUPTS()
BpcTaskName
C;;
DvTaskSuspendAll()
Attempts:
3 left
💡 Hint
Common Mistakes
Not disabling interrupts before printing.
Using incorrect loop syntax.