Bird
0
0

What is wrong with this xTaskCreate() usage?

medium📝 Debug Q7 of 15
FreeRTOS - Task Creation and Management
What is wrong with this xTaskCreate() usage?
TaskHandle_t xHandle;
BaseType_t res = xTaskCreate(
  NULL, "Task", 1000, NULL, 2, &xHandle);
if(res == pdPASS) printf("Created\n");
AStack size is too large
BTask name is NULL, causing failure
CTask function pointer is NULL, causing failure
DTask handle pointer is NULL
Step-by-Step Solution
Solution:
  1. Step 1: Check the task function pointer

    The first parameter is NULL, which is invalid because a task must have a function to execute.
  2. Step 2: Confirm other parameters

    Task name is valid, stack size is reasonable, and task handle pointer is valid.
  3. Final Answer:

    Task function pointer is NULL, causing failure -> Option C
  4. Quick Check:

    Task function pointer cannot be NULL [OK]
Quick Trick: Task function pointer must not be NULL [OK]
Common Mistakes:
  • Assuming NULL function pointer is allowed
  • Confusing task name with function pointer
  • Ignoring task handle pointer validity

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes