Bird
0
0

Examine the following FreeRTOS task creation code snippet:

medium📝 Debug Q6 of 15
FreeRTOS - RTOS Fundamentals
Examine the following FreeRTOS task creation code snippet:
BaseType_t result = xTaskCreate(TaskHandler, "TaskA", 512, NULL, 3, NULL);
What is the most likely issue with this code?
AStack size is too small for the task
BTask priority is invalid
CTask function prototype is incorrect
DThe last parameter should not be NULL
Step-by-Step Solution
Solution:
  1. Step 1: Check task function prototype

    FreeRTOS task functions must have the prototype: void TaskHandler(void *pvParameters).
  2. Step 2: Analyze given code

    If TaskHandler does not match this prototype, task creation will fail or behave unexpectedly.
  3. Step 3: Validate other parameters

    Stack size 512 and priority 3 are valid; last parameter can be NULL if task handle is not needed.
  4. Final Answer:

    Task function prototype is incorrect -> Option C
  5. Quick Check:

    Task functions must accept void* parameter [OK]
Quick Trick: Task functions require void* parameter [OK]
Common Mistakes:
  • Ignoring task function signature requirements
  • Assuming NULL task handle is invalid

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes