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
- 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 | r5fss0-0 freertos |
m4fss0-0 freertos |
a53ss0-0 freertos |
a53ss0-1 freertos |
Toolchain | ti-arm-clang |
arm.gnu.aarch64-none |
Board | am64x-evm, am64x-sk |
Example folder | examples/kernel/freertos/task_switch |
Steps to Run the Example
See Also
FreeRTOS
Sample Output
Shown below is a sample output when the application is run,
[FreeRTOS] ping task ... start !!!
execution time for task switches = 1526081 us
number of task switches = 2000000
time per task switch (semaphore give/take) = 763 ns
execution time for task switches = 1117010 us
number of task switches = 2000000
time per task switch (direct-to-task notification give/take) = 558 ns
execution time for task - ISR - task - task switches = 2140666 us
number of ISRs = 2000000
time per task - ISR - task switch (semaphore give/take) = 1070 ns
[FreeRTOS] ping task ... done !!!
All tests have passed!!
a53 core0: on UART0(/dev/ttyUSB0)
[FreeRTOS] ping task ... start on a53_core0 !!!
execution time for task switches = 3083718 us
number of task switches = 2000000
time per task switch (semaphore give/take) = 1541 ns
execution time for task switches = 2512564 us
number of task switches = 2000000
time per task switch (direct-to-task notification give/take) = 1256 ns
execution time for task - ISR - task - task switches = 4625202 us
number of ISRs = 2000000
time per task - ISR - task switch (semaphore give/take) = 2312 ns
[FreeRTOS] ping task ... done on a53_core0!!!
All tests have passed on a53_core0!!!
a53 core1: on UART1(/dev/ttyUSB2)
[FreeRTOS] ping task ... start on a53_core1 !!!
execution time for task switches = 3083718 us
number of task switches = 2000000
time per task switch (semaphore give/take) = 1541 ns
execution time for task switches = 2512564 us
number of task switches = 2000000
time per task switch (direct-to-task notification give/take) = 1256 ns
execution time for task - ISR - task - task switches = 4625202 us
number of ISRs = 2000000
time per task - ISR - task switch (semaphore give/take) = 2312 ns
[FreeRTOS] ping task ... done on a53_core1!!!
All tests have passed on a53_core1!!!