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 7, The FreeRTOS Scheduler; this one only sets up tasks and blinks LEDs. Follow these steps:
- Initialize the RTOS using osStatus_t osKernelInitialize (void), checking the return value before continuing:
osStatus_t status;status = osKernelInitialize();assert(status == osOK);