4.2. FreeRTOS

4.2.1. Introduction

FreeRTOS is a market-leading real-time operating system (RTOS) for microcontrollers and small microprocessors. Distributed freely under the MIT open source license, FreeRTOS includes a kernel and a growing set of libraries suitable for use across all industry sectors. FreeRTOS is built with an emphasis on reliability and ease of use.

PDK supports FreeRTOS on R5F, C66x, C7x CPUs for J721E. OSAL support and PDK Drivers running with FreeRTOS are available in this release.

FreeRTOS is not supported on A72 core.

4.2.2. Features Supported

  • FreeRTOS Kernel 10.5.1

    • Tasks, semaphores, mutex, queues, timers, list, heap, event groups

    • preemptive priority-based scheduler

    • static and/or dynamic memory allocation Mode

  • In order to keep the PDK drivers/examples OS agnostic, additionally below OSAL modules are implemented to call FreeRTOS APIs underneath:-

    • Clock, Task, Semaphore, Event, Mailbox, Mutex, Queue, Cache, HW Interrupts, HW Timers, Cycleprofiler, Heap, Load.

4.2.3. Features Not Supported

  • Co-routines, stream buffer are not enabled and compiled by default. Users can add these to the FreeRTOS config and makefile if they want to use these features.

  • Tickless IDLE mode

  • Task level memory protection wrapper

  • On R5F, nested interrupts are not supported.

  • HW Interrupt and SW Interrupt Load measurements are not supported.

4.2.4. Important files and directory structure

FreeRTOS source is distributed along with PDK and given below are some important files and folders related to FreeRTOS.

${PDK_INSTALL_PATH}/packages/ti/kernel
│
├────────────────────────────────── freertos
│                                    ├────── FreeRTOS-LTS   <= FreeRTOS Kernel source code. PDK simply clones the code from
│                                    │                         FreeRTOS Github and does not modify anything in this folder
│                                    │
│                                    ├────── config         <= FreeRTOS configuration header files for different SOCs and CPUs
│                                    │
│                                    └────── portable       <= FreeRTOS porting related files for supported cores
│
├────────────────────────────────── lib                     <= FreeRTOS library to link against. Linking to the library in this path
│                                                              enables the application to operate in FreeRTOS mode
│
└────────────────────────────────── test/freertos           <= FreeRTOS Examples and Unit Test

${PDK_INSTALL_PATH}/packages/ti/osal                        <= APIs to access FreeRTOS features in a OS agnostic way
│
└────────────────────────────────── lib/freertos            <= OSAL FreeRTOS library to link against. Linking to the library in this path
                                                               enables the application to use OSAL APIs which will operate in FreeRTOS mode

4.2.5. FreeRTOS Examples

Example

Application Name

Description

Cores Supported

FreeRTOS Task Switch

freertos_test_task_switch

The FreeRTOS Task Switch Example test performs the following:
1. switch between ping and pong tasks using semaphores
2. switch between ping and pong tasks using direct-to-task notifications
3. switch from ping task to ISR to pong task and back to ping task using semaphores, here there is a task switch

mcu1_0, mcu1_1, mcu2_0, mcu2_1, mcu3_0, mcu3_1, c66xdsp_1, c66xdsp_2, c7x_1

FreeRTOS Unit Test

freertos_test_ut

The FreeRTOS Unit Test performs the following:
1. switch between ping and pong tasks using semaphores
2. switch between ping and pong tasks using direct-to-task notifications
3. just invoke the task switch logic (Task Yield) without any semaphores or direct-to-task notifications
4. switch from ping to ISR and back to the same task using semaphores, here there is no task switch
5. switch from ping to ISR and back to the same task using direct-to-task notify, here there is no task switch
6. switch from ping task to ISR to pong task and back to ping task using semaphores, here there is a task switch
7. switch from ping task to ISR to pong task and back to ping task using direct-to-task notify, here there is a task switch
8. switch between ping and pong tasks and do float operations in between
9. Test TaskDelay

mcu1_0, mcu1_1, mcu2_0, mcu2_1, mcu3_0, mcu3_1, c66xdsp_1, c66xdsp_2, c7x_1

4.2.6. FreeRTOS Usage and Migration Guidelines

See FreeRTOS Usage and Migration Guidelines for FreeRTOS migration & usage guidelines and comparison to SysBIOS.

4.2.7. FreeRTOS with Real-time Object View (ROV)

Real-time Object View (ROV) in CCS IDE for FreeRTOS is available for R5F, C66x cores.

See FreeRTOS Real-time Object View (ROV) for instructions related to using Real-time Object View (ROV) with FreeRTOS.

4.2.8. Additional references

Document Description

Weblink

Easy to read FreeRTOS book

https://www.freertos.org/Documentation/RTOS_book.html

FreeRTOS user docs

https://www.freertos.org/features.html

User API reference

https://www.freertos.org/a00106.html

FreeRTOS core kernel source code

https://github.com/FreeRTOS/FreeRTOS-Kernel

FreeRTOS core kernel example source code

https://github.com/FreeRTOS/FreeRTOS/tree/master/FreeRTOS

Additional FreeRTOS.org maintained libraries (POSIX, TCP, Filesystem, …)

https://www.freertos.org/FreeRTOS-Labs/index.html

https://www.freertos.org/FreeRTOS-Plus/index.html

https://github.com/FreeRTOS