CMSIS-RTOS2
Version 2.1.2
Real-Time Operating System: API and RTX Reference Implementation
|
CMSIS-RTOS2 is a generic API that is agnostic of the underlying RTOS kernel. Application programmers call CMSIS-RTOS2 API functions in the user code to ensure maximum portability from one RTOS to another. Middleware using CMSIS-RTOS2 API takes advantages of this approach by avoiding unnecessary porting efforts.
A typical CMSIS-RTOS2 API implementation interfaces to an existing real-time kernel. The CMSIS-RTOS2 API provides the following attributes and functionalities:
The CMSIS-RTOS2 API is designed to optionally incorporate multi-processor systems and/or access protection via the Cortex-M Memory Protection Unit (MPU).
In some RTOS implementations threads may execute on different processors, thus message queues may reside in shared memory resources.
The CMSIS-RTOS2 API encourages the software industry to evolve existing RTOS implementations. RTOS implementations can be different and optimized in various aspects towards the Cortex-M processors. Optional features may be for example
A CMSIS-RTOS2 implementation is typically provided as a library. To add the RTOS functionality to an existing CMSIS-based application, the RTOS library (and typically one or more configuration files) needs to be added. There is a single new header file cmsis_os2.h available. This is the only header file required for a completely portable application. In such a case, user provided memory for control blocks, objects data and thread stack cannot be used. Alternatively, you can include an implementation specific header file (for example rtx_os.h) which provides definitions also for resource allocation (such as size of control blocks, required memory for object data and thread stack). This is optional and implies that the application code is not completely portable.
Once the files are added to a project, the user can start working with the CMSIS-RTOS functions. A code example is provided below:
Code Example
The file cmsis_os2.h is a standard header file that interfaces to every CMSIS-RTOS2 compliant real-time operating systems (RTOS). Each implementation is provided the same cmsis_os2.h which defines the interface to the CMSIS-RTOS2.
Using the cmsis_os2.h along with dynamic object allocation allows to create source code or libraries that require no modifications when using on a different CMSIS-RTOS2 implementation.
Header file cmsis_os2.h