What does the stack high water mark value represent in FreeRTOS?
Think about what 'high water mark' means in terms of usage.
The stack high water mark shows the minimum amount of free stack space left, indicating the maximum stack usage so far.
Given the following FreeRTOS code snippet, what is the output of uxTaskGetStackHighWaterMark(NULL) if the task stack size is 200 words and the function returns 50?
UBaseType_t highWaterMark = uxTaskGetStackHighWaterMark(NULL);
printf("High water mark: %u\n", highWaterMark);The function returns the minimum free stack space in words.
The function returns the minimum free stack space left, so it prints 50.
Which FreeRTOS configuration option enables stack overflow checking at runtime?
Look for the option related to stack overflow detection.
configCHECK_FOR_STACK_OVERFLOW enables runtime stack overflow checking in FreeRTOS.
A task with a stack size of 256 words shows a high water mark of 5. What is the most likely cause?
Low high water mark means low free stack space.
A low high water mark means the task has used most of its stack, which risks overflow.
What is the correct sequence of steps to monitor stack high water mark for a task in FreeRTOS?
Think about the logical order from getting data to acting on it.
You first get the value, then interpret it, then compare to threshold, then log or alert.