0
0
FreeRTOSprogramming~10 mins

Stack high water mark monitoring 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 get the stack high water mark of a task.

FreeRTOS
UBaseType_t highWaterMark = uxTaskGetStackHighWaterMark([1]);
Drag options to blanks, or click blank then click option'
ATaskHandle_t
BNULL
CxTaskHandle
Dvoid
Attempts:
3 left
💡 Hint
Common Mistakes
Passing NULL instead of the task handle.
Using the type name instead of a variable.
Passing void or unrelated values.
2fill in blank
medium

Complete the code to print the stack high water mark value.

FreeRTOS
printf("Stack high water mark: %u\n", [1]);
Drag options to blanks, or click blank then click option'
AhighWaterMark
BTaskHandle_t
CuxTaskGetStackHighWaterMark(xTaskHandle)
DNULL
Attempts:
3 left
💡 Hint
Common Mistakes
Calling the function inside printf instead of using the variable.
Passing the task handle or NULL instead of the value.
Using the type name instead of a variable.
3fill in blank
hard

Fix the error in the code to correctly get the stack high water mark.

FreeRTOS
UBaseType_t highWaterMark = uxTaskGetStackHighWaterMark([1]);
Drag options to blanks, or click blank then click option'
ATaskHandle
BNULL
CNULLHandle
DxTaskHandle
Attempts:
3 left
💡 Hint
Common Mistakes
Using NULL or invalid variable names.
Confusing type names with variables.
4fill in blank
hard

Fill both blanks to create a function that returns the stack high water mark of a task.

FreeRTOS
UBaseType_t getStackHighWaterMark([1] task) {
    return uxTaskGetStackHighWaterMark([2]);
}
Drag options to blanks, or click blank then click option'
ATaskHandle_t
BxTaskHandle
Ctask
Dvoid
Attempts:
3 left
💡 Hint
Common Mistakes
Using void as parameter type.
Passing a variable not declared as parameter.
Mismatching parameter names.
5fill in blank
hard

Fill all three blanks to complete the for loop that populates the highWaterMarks array using the corresponding task handles.

FreeRTOS
const char* taskNames[] = {"Task1", "Task2", "Task3"};
UBaseType_t highWaterMarks[] = {0, 0, 0};
for (int [1] = 0; [2] < 3; [3]++) {
    highWaterMarks[i] = uxTaskGetStackHighWaterMark(xTaskHandles[i]);
}
Drag options to blanks, or click blank then click option'
Ai
Bj
Ck
Dindex
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names in loop parts.
Using undefined variables.