0
0
FreeRTOSprogramming~10 mins

Why RTOS over bare-metal in FreeRTOS - Test Your Understanding

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

Complete the code to create a FreeRTOS task that prints "Hello".

FreeRTOS
xTaskCreate([1], "Task1", 1000, NULL, 1, NULL);
Drag options to blanks, or click blank then click option'
AvTaskStartScheduler
BvTaskDelay
CvTaskPrintHello
DvTaskDelete
Attempts:
3 left
💡 Hint
Common Mistakes
Using scheduler start function instead of task function
Using delay or delete functions incorrectly
2fill in blank
medium

Complete the code to start the FreeRTOS scheduler.

FreeRTOS
int main() {
    // Setup code
    [1]();
    while(1) {}
}
Drag options to blanks, or click blank then click option'
AvTaskSuspend
BvTaskDelete
CvTaskDelay
DvTaskStartScheduler
Attempts:
3 left
💡 Hint
Common Mistakes
Calling delay or delete functions instead of starting scheduler
3fill in blank
hard

Fix the error in the task function to yield control to other tasks.

FreeRTOS
void vTaskFunction(void *pvParameters) {
    while(1) {
        // Do work
        [1](1);
    }
}
Drag options to blanks, or click blank then click option'
AvTaskSuspend
BvTaskDelay
CvTaskStartScheduler
DvTaskDelete
Attempts:
3 left
💡 Hint
Common Mistakes
Using delete or suspend which stops the task
Starting scheduler inside task
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps task names to their priorities if priority is greater than 2.

FreeRTOS
task_priorities = {task[1]: priority for task, priority in tasks.items() if priority [2] 2}
Drag options to blanks, or click blank then click option'
A.upper()
B>
C<
D.lower()
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong comparison operator
Not changing case of task names
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps uppercase task names to their priorities if priority is less than 5.

FreeRTOS
filtered_tasks = [1]: [2] for task, [3] in tasks.items() if priority < 5}}
Drag options to blanks, or click blank then click option'
Atask.upper()
Bpriority
Dtask
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong variable names
Not converting task names to uppercase