Recall & Review
beginner
What is stack size allocation in FreeRTOS?
Stack size allocation in FreeRTOS is the process of assigning a specific amount of memory for each task's stack, which stores local variables, function calls, and return addresses during task execution.
Click to reveal answer
beginner
Why is it important to allocate the correct stack size for a FreeRTOS task?
Allocating the correct stack size prevents stack overflow, which can cause unpredictable behavior or crashes, and avoids wasting memory by not allocating more stack than needed.
Click to reveal answer
intermediate
How do you specify the stack size when creating a task in FreeRTOS?
You specify the stack size as the third argument in the xTaskCreate() function, usually in words (not bytes), for example: xTaskCreate(taskFunction, "TaskName", 128, NULL, priority, &handle);
Click to reveal answer
intermediate
What unit is used for stack size in FreeRTOS task creation?
Stack size is specified in words, not bytes. The size of a word depends on the processor architecture (e.g., 4 bytes on a 32-bit system).
Click to reveal answer
advanced
What tool or method can help detect stack overflow in FreeRTOS?
FreeRTOS provides stack overflow checking options that can be enabled in the configuration file (configCHECK_FOR_STACK_OVERFLOW). Also, runtime checks and monitoring functions can help detect stack overflow.
Click to reveal answer
In FreeRTOS, what does the stack size parameter in xTaskCreate() represent?
✗ Incorrect
The stack size parameter in xTaskCreate() is the number of words allocated for the task's stack, not bytes.
What can happen if a FreeRTOS task's stack size is too small?
✗ Incorrect
If the stack size is too small, the task can overflow its stack, leading to crashes or unpredictable behavior.
How can you detect stack overflow in FreeRTOS?
✗ Incorrect
Enabling configCHECK_FOR_STACK_OVERFLOW activates stack overflow checking in FreeRTOS.
When specifying stack size in xTaskCreate(), what should you consider about the processor?
✗ Incorrect
Stack size is specified in words, and the size of a word depends on the processor architecture.
What is a good practice when deciding the stack size for a FreeRTOS task?
✗ Incorrect
Estimating stack size based on task needs and adding margin helps prevent overflow without wasting memory.
Explain how stack size allocation works in FreeRTOS and why it matters.
Think about what happens if the stack is too small or too large.
You got /4 concepts.
Describe how to specify and check stack size for a task in FreeRTOS.
Consider both creation and debugging steps.
You got /4 concepts.