FreeRTOS Examples

The Sapphire SoC supports the popular FreeRTOS real-time operating system, and includes example software projects targeting the RTOS. For more details on using FreeRTOS, go to their web site at https://www.freertos.org.

Download the FreeRTOS

By default, the RISC-V IDE is bundled with FreeRTOS version 202212.01. It will be auto detected when creating or importing projects. Follow these steps if you need a different version FreeRTOS.
  1. Download the FreeRTOS zip file from https://www.freertos.org.
  2. Unzip the folder to any directory.
  3. Point to the folder when importing existing project or creating new project.

After you have downloaded the FreeRTOS, you use the software projects in the same manner as the other example software.

freertosDemo

This example shows how the FreeRTOS schedular handles two program executions using task and queue allocation. Generally, the FreeRTOS queue is used as a thread FIFO buffer and for intertask communication. This example creates two tasks and one queue; the queue sends and receives traffic. The receive traffic (or receive queue) blocks the program execution until it receives a matching value from the send traffic (or send queue).

Tasks in the send queue sit in a loop that blocks execution for 1,000 miliseconds before sending the value 100 to the receive queue. Once the value is sent, the task loops, i.e., blocks for another 1,000 miliseconds.

When the receive queue receives the value 100, it begins executing its task, which sends the message Blink to the UART peripheral and toggles an LED on the development board.

Hello world, this is FreeRTOS
Blink
Blink
Blink