CMSIS-FreeRTOS  
CMSIS-RTOS2 compliant FreeRTOS Implementation
Example projects

This pack contains two example projects:

The first example shows how to configure a simple application using FreeRTOS with CMSIS-RTOS2, whereas the second example shows how to use the FreeRTOS with CMSIS-RTOS2 in an application that utilizes TrustZone secure/non-secure execution.

Provided examples use the CMSIS Solution Project File Format and can be build for multiple Cortex-M targets

The Examples solution defines projects and build information for each project.

Build and Run

The Examples solution supports only "Debug" Build-Type which is optimized for debugging. It disables compiler optimization and retains all debug related information. By default, Arm Compiler 6 is used to build the projects.

Targets

Each example can be built for multiple target processors. The below table lists supported target processors together with the corresponding context target-types and model executable that shall be used for running the application image.

Target processor Target-Type Model Executable
Cortex-M0 CM0 FVP_MPS2_Cortex-M0
Cortex-M0+ CM0plus FVP_MPS2_Cortex-M0plus
Cortex-M3 CM3 FVP_MPS2_Cortex-M3
Cortex-M4 CM4 FVP_MPS2_Cortex-M4
Cortex-M7 CM7 FVP_MPS2_Cortex-M7
Cortex-M23 CM23 FVP_MPS2_Cortex-M23
Cortex-M23 CM23_noTZ FVP_MPS2_Cortex-M23
Cortex-M33 CM33 FVP_MPS2_Cortex-M33
Cortex-M33 CM33_noTZ FVP_MPS2_Cortex-M33
Cortex-M55 CM55 FVP_Corstone_SSE-300
Cortex-M55 CM55_noTZ FVP_Corstone_SSE-300
Cortex-M85 CM85 FVP_Corstone_SSE-310
Cortex-M85 CM85_noTZ FVP_Corstone_SSE-310

Build in VS Code using Arm Keil Studio Pack extensions

To build a project using Keil Studio extensions open CMSIS view, open "Manage CMSIS Solution" view and select "Active Context" and "Active Projects". Build Type is automatically selected since there is only one option.

Once the context and projects are selected one can build them by selecting "Build" in CMSIS view.

Build via command line

To build the project via command line one can use the following command syntax:

cbuild Examples.csolution.yml --context <project-name>.<build-type>+<target-type>

To list the available contexts execute the following command:

cbuild list contexts Examples.csolution.yml

Execute on Virtual Hardware Target

Arm Virtual Hardware Target simulation models are used to execute the example application images.

To execute application image (axf or elf) on an simulation model use the following command syntax:

<model-executable> -f ./Target/<target_type>/fvp_config.txt -a ./out/<project>/<project>.axf

Hello World

The Hello World application can be used as a starting point when developing new application. Using it, one can verify initial system setup and configuration.

The application is simple and shows how to use CMSIS-RTOS2:

  • how to initialize and start the RTOS kernel
  • how to create a new thread
  • how to retarget stdout

Build via command line

The following cbuild command may be used to build Hello World example project for Cortex-M3:

cbuild Examples.csolution.yml --context Hello.Debug+CM3 --update-rte

Execute via command line

To execute simulation model and run Hello World project executable for Cortex-M3 use the following command:

FVP_MPS2_Cortex-M3 -f ./Target/CM3/fvp_config.txt -a ./out/Hello/Hello.axf

When executed, application outputs the following to the serial terminal:

(Press Ctrl + C to stop the simulation model.)

TrustZone

The TrustZone application explains how to setup projects for booting and execution from TrustZone secure to non-secure domain and vice versa.

The application shows:

  • how to boot from the secure domain and switch the execution to the non-secure domain
  • how to create the interface functions between secure and non-secure domain
  • how to use the secure/non-secure interface functions

Build via command line

TrustZone example must always be build in two steps:

  1. Build secure side project for Cortex-M55
    cbuild Examples.csolution.yml --context TZ_Secure.Debug+CM55 --update-rte
  2. Build non-secure side project for Cortex-M55
    cbuild Examples.csolution.yml --context TZ_NonSecure.Debug+CM55 --update-rte

Execute via command line

To execute simulation model and run TrustZone project executable for Cortex-M55 use the following command:

FVP_Corstone_SSE-300 -f ./Target/CM55/fvp_config.txt -a ./out/TZ_NonSecure/TZ_NonSecure.axf -a ./out/TZ_Secure/TZ_Secure.axf

When executed, application outputs the following to the serial terminal:

(Press Ctrl + C to stop the simulation model.)