0
0
FreeRTOSprogramming~10 mins

Tick timer and scheduler in FreeRTOS - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to start the FreeRTOS scheduler.

FreeRTOS
vTaskStartScheduler[1];
Drag options to blanks, or click blank then click option'
A[]
B;
C{}
D()
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting the parentheses after the function name.
Adding a semicolon inside the parentheses.
2fill in blank
medium

Complete the code to create a FreeRTOS task with the correct priority.

FreeRTOS
xTaskCreate(taskFunction, "Task1", configMINIMAL_STACK_SIZE, NULL, [1], NULL);
Drag options to blanks, or click blank then click option'
A1
BtskIDLE_PRIORITY
C0
DconfigMAX_PRIORITIES
Attempts:
3 left
💡 Hint
Common Mistakes
Using zero as priority which is idle priority.
Using configMAX_PRIORITIES which is out of range.
3fill in blank
hard

Fix the error in the tick hook function declaration.

FreeRTOS
void vApplicationTickHook[1]
Drag options to blanks, or click blank then click option'
A()
B(void)
C(int)
D(void*)
Attempts:
3 left
💡 Hint
Common Mistakes
Using empty parentheses which is not valid in C for no-parameter functions.
Adding parameters to the tick hook function.
4fill in blank
hard

Fill both blanks to create a dictionary of task names and their states.

FreeRTOS
const char* taskStates[] = {"Running", "Ready", "Blocked", "Suspended"};
for(int i = 0; i < [1]; i++) {
    printf("Task %s is %s\n", taskNames[i], taskStates[[2]]);
}
Drag options to blanks, or click blank then click option'
AconfigMAX_PRIORITIES
BuxTaskGetNumberOfTasks()
Ci
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using configMAX_PRIORITIES which is unrelated to task count.
Using a fixed zero index for all task states.
5fill in blank
hard

Fill all three blanks to correctly implement a tick hook that increments a counter and yields if needed.

FreeRTOS
static BaseType_t xHigherPriorityTaskWoken = pdFALSE;
void vApplicationTickHook(void) {
    [1]++;
    if (xSemaphoreGiveFromISR(xSemaphore, &[2]) == pdTRUE) {
        port[3]();
    }
}
Drag options to blanks, or click blank then click option'
AulTickCount
BxHigherPriorityTaskWoken
CYIELD_FROM_ISR
DvTaskDelay
Attempts:
3 left
💡 Hint
Common Mistakes
Using a wrong variable name for the tick count.
Calling vTaskDelay inside an ISR which is invalid.
Not passing the address of the flag variable.