![]() |
CMSIS-RTOS2
Version 2.0.0
Real-Time Operating System: API and RTX Reference Implementation
|
The RTX objects (thread, mutex, semaphore, timer, message, event and memory pool) require dedicated RAM memory. Objects can be created using osobjectNew() calls and deleted using osobjectDelete() calls. The related object memory needs to be available during the life-time of the object.
RTX5 offers three different memory allocation methods for objects:
It possible to intermix all the memory allocation methods in the same application.
The global memory pool allocates all objects from a one memory area. This method of memory allocation is the default configuration setting of RTX5.
When pool does not provide sufficient memory the creation of the object fails and the related osobjectNew() function returns NULL.
Enabled in System Configuration.
Object-specific Memory Pools avoids memory fragmentation with a dedicated fixed-size memory management for each object type. This type of memory pools are fully time deterministic, which means object creation and destruction takes always the same fixed amount of time. As a fixed-size memory pool is specific to an object type the handling of out-of-memory situations is simplified.
Object-specific memory pools are selectively enabled for each object type, e.g: mutex or thread using the RTX configuration file:
When memory pool does not provide sufficient memory the creation of the object fails and the related osobjectNew() function returns NULL.
In contrast to the dynamic memory allocations the static memory allocation requires compile-time allocation of object memory.
The following code example shows how to create an OS object using static memory.
Code Example: