0
0
FreeRTOSprogramming~10 mins

Real-time vs general-purpose OS in FreeRTOS - Interactive Practice

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 World".

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

Complete the code to start the FreeRTOS scheduler.

FreeRTOS
int main(void) {
    // Setup code
    [1]();
    for(;;); // Loop forever
}
Drag options to blanks, or click blank then click option'
AvTaskStartScheduler
BxTaskCreate
CvTaskDelay
DvTaskDelete
Attempts:
3 left
💡 Hint
Common Mistakes
Calling task creation instead of starting scheduler.
Using delay or delete functions here.
3fill in blank
hard

Fix the error in the task function to correctly delay the task for 1000 milliseconds.

FreeRTOS
void vTaskFunction(void *pvParameters) {
    for(;;) {
        // Do work
        [1];
    }
}
Drag options to blanks, or click blank then click option'
AvTaskDelay(1000 / portTICK_PERIOD_MS)
BvTaskDelay(1000)
CvTaskDelay(pdMS_TO_TICKS(1000))
DvTaskDelay(1000 * portTICK_PERIOD_MS)
Attempts:
3 left
💡 Hint
Common Mistakes
Passing milliseconds directly without conversion.
Multiplying or dividing by portTICK_PERIOD_MS incorrectly.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps task names to their priorities for tasks with priority greater than 1.

FreeRTOS
task_priorities = {task.name: task[1] for task in tasks if task.priority [2] 1}
Drag options to blanks, or click blank then click option'
A.priority
B>
C<
D.name
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong comparison operator.
Accessing wrong attribute for priority.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps uppercase task names to their stack sizes for tasks with stack size greater than 512.

FreeRTOS
task_info = { [1]: [2] for task in tasks if task.stack_size [3] 512}
Drag options to blanks, or click blank then click option'
Atask.name.upper()
Btask.stack_size
C>
Dtask.priority
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong attribute for stack size.
Using wrong comparison operator.