AM62Ax MCU+ SDK  09.02.00
FreeRTOS SMP Task Switch Example

Introduction

This example shows usage of direct FreeRTOS APIs, i.e not via the DPL APIs. It shows usage of task APIs, task notification APIs, semaphore and delay APIs. It also shows how to signal to FreeRTOS task from ISRs.

The example does the below

  • Creates two semaphores
  • Creates two tasks, ping and pong
  • Run tasks with core affinity
  • Ping and pong tasks signal each other using semaphores and task notifications
  • A HW ISR is also created and ping task is signaled from the ISR
  • Task delay API usage is shown

Supported Combinations

Parameter Value
CPU + OS a53ss0-0 freertos-smp
Toolchain arm.gnu.aarch64-none
Board am62ax-sk
Example folder examples/kernel/freertos/smp_task_switch

Steps to Run the Example

Note
Create a sync group for cores when running an SMP example in CCS

See Also

FreeRTOS

Sample Output

Shown below is a sample output when the application is run,The CoreID may change when you set different core affinity,
Pong CoreID = 1
Ping CoreID = 0
[FreeRTOS] ping task ... start !!!
execution time for task switches = 16669227 us
number of task switches = 2000000
time per task switch (semaphore give/take) = 8334 ns
Pong ISR CoreID = 1
execution time for task switches = 10991883 us
number of task switches = 2000000
time per task switch (direct-to-task notification give/take) = 5495 ns
Ping ISR CoreID = 0
Pong End CoreID = 1
execution time for task - ISR - task - task switches = 11043170 us
number of ISRs = 2000000
time per task - ISR - task switch (semaphore give/take) = 5521 ns
[FreeRTOS] ping task ... done !!!
Ping End CoreID = 0
All tests have passed!!