FreeRTOS Exercise Lab02
FreeRTOS Lab 02
The two tasks created in the previous example are almost identical, the only difference between them being the text string they print out. This duplication can be removed by, instead, creating two instances of a single task implementation. The task parameter should be used to pass into each task the string that it should print out.
- Create a CCS Project using FreeRTOS Project Template
- Add printf-stdarg.c file to project (Project > Add Files ...)
- Initialize UART0 for 115,200 baud rate (assuming 16 MHz bus clock), 8 bit word length, no parity bits, one stop bit, FIFOs enabled. (UART0 Echo Source Code is available here)
- Write a single task function (vTaskFunction). The task parameter should be used to obtain the string the task should print out.
- The pvParameters parameter of the xTaskCreate() function is used to pass the text string into the task
Even though there is now only one task implementation (vTaskFunction), more than one instance of the defined task can be created. Each created instance will execute independently under the control of the FreeRTOS scheduler.