The RTOS abstraction layer provides simple RTOS services like threads, semaphores, mutexes, queues, and timers. It is not intended to be a full-featured RTOS interface, but to provide just enough support to allow for RTOS independent drivers and middleware. This allows middleware applications to be as portable as possible within ModusToolbox™. This library provides a unified API around the actual RTOS. This allows middleware libraries to be written once independent of the RTOS actually selected for the application. While the primary purpose of the library is for middleware, the abstraction layer can be used by the application code. However, since this API does not provide all RTOS features and the application generally knows what RTOS is being used, this is typically an unnecessary overhead.
The Abstraction-RTOS middleware allows other middleware applications to be as portable as possible within ModusToolbox™. This library provides a unified API around the actual RTOS. This allows middleware libraries to be written once independent of the RTOS actually selected for the application.
Use Abstraction-RTOS middleware if you want to allow other middleware applications to be as portable as possible within ModusToolbox™, without dependency on a particular RTOS.
Abstraction-RTOS supports three popular kernels, but does not include them inside the asset. Those kernels need to be downloaded separately into the APP folder. Download links:
Note: No need to download FreeRTOS separately. It exists as an Infineon® library asset and can be added via Library Manager.
To connect any RTOS to the APP, add the chosen RTOS to the COMPONENTS parameter in the APP's main Makefile. For example:
You also need to include cyabs_rtos.h in your APP to use the Abstraction-RTOS APIs.
Step 1: Create an empty project for your device.
Step 2: In Library Manager, select Abstraction-RTOS to add it to your APP. Wait until the update is finished.
Step 3: Also select FreeRTOS in Library Manager, or add another RTOS kernel to the project.
Step 4: Add the code below. Build and program.
Step 5: The LED starts blinking.
To enable all functionality when using with FreeRTOS, the following configuration options must be enabled in FreeRTOSConfig.h:
Enabling configSUPPORT_STATIC_ALLOCATION requires the application to provide implementations for vApplicationGetIdleTaskMemory and vApplicationGetTimerTaskMemory functions. Weak implementations for these functions are provided as a part of this library. These can be overridden by the application if custom implementations of these functions are desired.
This library provides an API vApplicationSleep which can be used to enable tickless support in FreeRTOS. In order to enable tickless mode with this API, the following changes need to be made in FreeRTOSConfig.h:
#define configUSE_TICKLESS_IDLE 2#define portSUPPRESS_TICKS_AND_SLEEP( xIdleTime ) vApplicationSleep( xIdleTime )In tickless mode vApplicationSleep updates the number of RTOS ticks that have passed since the tick interrupt was stopped using vTaskStepTick, taking into account the sleep/deepsleep latency.
The maximum tickless idle time can be calculated as follows:
Note: The LPtimerDelay represents the duration in which the IP is configured to Wake-up the device. Wake-up can happen before its expiration if one other configured interrupt triggers during this time.
Functions cy_rtos_scheduler_suspend/cy_rtos_scheduler_resume can be called from ISR but calls need to be paired to restore the saved interrupt status correctly so a structure to save these values has been implemented. The size of this structure can be controlled with CY_RTOS_MAX_SUSPEND_NESTING. This macro is overridable and its default value is 3.
For further details on Low power support in FreeRTOS please refer to documentation here
The cy_rtos_event_* functions accept a 32-bit event as an argument. However, FreeRTOS requires 8-bits(configUSE_16_BIT_TICKS == 1) or 24-bits (configUSE_16_BIT_TICKS == 0) to run successfully. Hence the application should not reference these unsupported bits. Check the FreeRTOS implementation of eventEVENT_BITS_CONTROL_BYTES in event_group.c for internal details.
No specific requirements exist
In order to port to a new environment, the file cyabs_rtos_impl.h must be provided with definitions of some basic types for the abstraction layer. The types expected to be defined are:
The enum cy_thread_priority_t needs to have the following priority values defined and mapped to RTOS specific values:
Finally, the following macros need to be defined for memory allocations:
Coding Standards:
This section describes MISRA-C:2012 compliance and deviations for the Abstraction-RTOS.
MISRA stands for Motor Industry Software Reliability Association. The MISRA specification covers a set of 10 mandatory rules, 110 required rules and 39 advisory rules that apply to firmware design and has been put together by the Automotive Industry to enhance the quality and robustness of the firmware code embedded in automotive devices.
The MISRA specification defines two categories of deviations (see section 5.4 of the MISRA-C:2012 specification):
Project Deviations are documented in this section. Specific deviations are documented in the source code, close to the deviation occurrence. For each deviation a special macro identifies the relevant rule or directive number, and reason.
This section provides MISRA compliance analysis environment description.
| Item | Description | Version |
|---|---|---|
| Test Specification | MISRA-C:2012 Guidelines for the use of the C language in critical systems | March 2013 |
| MISRA Checking Tool | Coverity Static Analysis Tool | 2022.12.0 |
| MISRA Rule | Rule Description | Rationale |
|---|---|---|
| Rule 3.1 | The character sequences /* and // shall not be used within a comment. | Using of the special comment symbols is need for Doxygen comment support, it does not have any impact. |
Specific deviations for the following required rules are documented inline in the source code using CY_MISRA_DEVIATE_* macroses.
This library is released under the Apache License, Version 2.0. See the individual source files for the SPDX-License-Identifier or visit https://www.apache.org/licenses/LICENSE-2.0 for the full license text.
(c) Copyright 2019-2026, Infineon Technologies AG, or an affiliate of Infineon Technologies AG. All rights reserved.