Creating tasks and starting the scheduler
The chapter’s first example-program is a FreeRTOS application with three tasks. Each task blinks an LED, and it interacts with the other tasks. The interactions are designed to illustrate particular ways that FreeRTOS works.
The FreeRTOS-based application is in the IDE-project Chapter_07, in the file Src\main_taskCreation.c. We’ll show how the program works, then run the program, and use SystemView to analyze the tasks’ behavior.
In order to get an RTOS application up and running, a few things need to happen:
- The MCU hardware needs to be initialized.
- The task functions need to be defined, e.g., C functions.
- RTOS tasks need to be created and mapped to the task functions.
- The return values for task-creation need to be checked, and errors handled.
- The RTOS scheduler must be started.
These are the typical steps for using the scheduler and tasks. Of course, there are additional...