Creating a simple CMSIS-RTOS v2 application

Armed with an understanding of the differences between the native FreeRTOS API and the CMSIS-RTOS v2 API, we can develop a bare-bones application with two tasks that blink some LEDs. The goal of this application is to develop code that is only dependent on the CMCSIS-RTOS API rather than the FreeRTOS API. All the code found here resides in main_taskCreation_CMSIS_RTOSV2.c.

This example is similar to those found in Chapter 7The FreeRTOS Scheduler; this one only sets up tasks and blinks LEDs. Follow these steps:

  1. Initialize the RTOS using osStatus_t osKernelInitialize (void), checking the return value before continuing:
osStatus_t status;status = osKernelInitialize();assert(status == osOK);

Get Hands-On RTOS with Microcontrollers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.