Bird
0
0

Identify the error in this static task creation code snippet:

medium📝 Debug Q14 of 15
FreeRTOS - Memory Management
Identify the error in this static task creation code snippet:
StaticTask_t taskBuffer;
StackType_t stackBuffer[100];

xTaskCreateStatic(TaskFunction, "Task", 100, NULL, 1, NULL, &taskBuffer);
AFunction name is incorrect; should be xTaskCreate.
BTask buffer pointer is NULL, causing invalid task control block.
CStack buffer pointer is NULL, causing invalid stack memory.
DTask priority is invalid (should be zero).
Step-by-Step Solution
Solution:
  1. Step 1: Check parameters passed to xTaskCreateStatic

    The stack buffer pointer is NULL, which means no memory is provided for the task's stack.
  2. Step 2: Understand consequences of NULL stack buffer

    Without a valid stack buffer, the task cannot run properly and will cause errors.
  3. Final Answer:

    Stack buffer pointer is NULL, causing invalid stack memory. -> Option C
  4. Quick Check:

    Stack buffer must not be NULL [OK]
Quick Trick: Stack buffer pointer must be valid, not NULL [OK]
Common Mistakes:
  • Passing NULL for stack buffer
  • Confusing task buffer with stack buffer
  • Incorrect function name usage

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes