FreeRTOS for Infineon MCUs

August 31, 2026 ยท View on GitHub

Overview

This package provides the FreeRTOS kernel port and integration assets for Infineon MCUs. It enables deterministic task scheduling, inter-task communication, and low-power operation in ModusToolbox applications.

This README is self-contained for both developers and LLM assistants in offline workspace use.

FreeRTOS integration in this asset is core-based rather than platform-dependent: select sources and configuration by CPU core (CM0, CM0+, CM4, CM33, CM55, CM7, or CR4).

Features

  • FreeRTOS kernel integration for Arm Cortex-M0, M0+, M4, M33, M55, M7, and Cortex-R4 (CR4)
  • Core RTOS primitives: tasks, queues, semaphores, mutexes, event groups, stream/message buffers, and software timers
  • Configurable scheduling and memory strategies, including multiple heap allocation schemes
  • Tickless idle support for low-power operation, including DSRAM use cases through application sleep hooks
  • TrustZone integration flow for CM33 nonSecure and Secure projects

When to Use

Use this middleware when your application needs deterministic multi-tasking on Infineon MCUs and requires a production-proven RTOS kernel with configurable memory and power behavior.

Typical scenarios include:

  • Migrating from a super-loop application to prioritized tasks
  • Combining real-time response with low-power operation
  • Building one codebase across multiple Infineon MCU families
  • Requiring explicit control over heap strategy, stack sizing, and interrupt-safe API usage

How to use

1. Check prerequisites

  • ModusToolbox software environment
  • Supported toolchain (GCC_ARM, IAR, or Arm/LLVM depending on BSP)
  • Target BSP for your board

Supported cores and notes:

CoreSupport notes
CM0 / CM0+Uses simplified NVIC model; priority macros are handled differently
CM4 / CM7 / CM55Standard Cortex-M FreeRTOS priority model
CM33Supports standard flow and TrustZone flow
CR4Supported only on GCC_ARM

Security note:

  • Use FreeRTOS kernel v10.6.202 or later to avoid known CVE-2024-28115 exposure in older versions.

2. Add middleware and enable component

Use an already-generated Empty Application as the starting point. In that project, hardware initialization and BSP-specific baseline setup are already present.

  1. Add this middleware to your application in ModusToolbox Library Manager.
  2. Enable the component in your Makefile:
COMPONENTS+=FREERTOS

3. Add FreeRTOS configuration

  1. Copy FreeRTOSConfig.h from the core-specific folder under Source/portable for your target core.
  • Example for CM0: Source/portable/COMPONENT_CM0/FreeRTOSConfig.h
  1. Remove the warning line from the copied file:
#warning This is a template.

4. Add application code and start scheduler

Use a minimal task-based application like this:

#include "cybsp.h"
#include "FreeRTOS.h"
#include "task.h"

#define BLINKY_TASK_NAME            ("Blinky")
#define BLINKY_TASK_STACK_SIZE      (configMINIMAL_STACK_SIZE)
#define BLINKY_TASK_PRIORITY        (tskIDLE_PRIORITY + 1)
#define USER_LED_TOGGLE_PERIOD_MS   100u

static void blinky_task(void *arg)
{
    (void)arg;

    for (;;)
    {
        /* Toggle the USER LED state */
        Cy_GPIO_Inv(CYBSP_USER_LED_PORT, CYBSP_USER_LED_PIN);

        vTaskDelay(500);
    }
}

int main(void)
{
    BaseType_t retval;
    cy_rslt_t result;

    /* Initialize the device and board peripherals */
    result = cybsp_init() ;
    if (result != CY_RSLT_SUCCESS)
    {
        CY_ASSERT(0);
    }

    __enable_irq();

    retval = xTaskCreate(blinky_task, BLINKY_TASK_NAME, BLINKY_TASK_STACK_SIZE, NULL, BLINKY_TASK_PRIORITY, NULL );

    if (pdPASS == retval)
    {
        vTaskStartScheduler();
    }

    for (;;)
    {
        /* vTaskStartScheduler never returns */
    }
}

Expected outcome:

  • Scheduler starts without assertion failures
  • Periodic task runs with expected delay
  • Visible output (for example UART print or LED toggle) repeats as configured

5. TrustZone flow for CM33 (if applicable)

For CM33 TrustZone projects:

  • In nonSecure project, enable:
COMPONENTS+=FREERTOS FREERTOS_TZ
  • In Secure project, enable:
COMPONENTS+=FREERTOS_TZ
  • For nonSecure tasks that call NSC APIs, allocate secure context:
portALLOCATE_SECURE_CONTEXT(configMINIMAL_SECURE_STACK_SIZE);

6. Common issues and fixes

  • Scheduler does not start:
    • Check heap settings and available RAM
    • Verify at least one task is created successfully
  • Assertion related to interrupt priority:
    • Ensure configMAX_SYSCALL_INTERRUPT_PRIORITY is valid for your core
    • Ensure unused LSB bits in configMAX_SYSCALL_INTERRUPT_PRIORITY are 0 for newer kernels
  • Unexpected malloc/free behavior with multiple tasks:
    • Consider enabling configUSE_NEWLIB_REENTRANT
    • For GCC/newlib, use compatible C library hook implementation (for example via clib-support)
  • Low-power mode not entered:
    • Enable configUSE_TICKLESS_IDLE
    • Provide a valid vApplicationSleep hook for your power flow

7. Key configuration parameters

Most frequently tuned settings in FreeRTOSConfig.h:

  • configCPU_CLOCK_HZ
  • configMAX_SYSCALL_INTERRUPT_PRIORITY
  • configHEAP_ALLOCATION_SCHEME
  • configTOTAL_HEAP_SIZE
  • configMINIMAL_STACK_SIZE
  • configMINIMAL_SECURE_STACK_SIZE
  • configUSE_TICKLESS_IDLE
  • configUSE_NEWLIB_REENTRANT
  • configMAX_PRIORITIES
  • configENABLE_FPU
  • FREERTOS_CONFIG_BWC_DISABLED

Low-power note for DSRAM:

  • When DSRAM mode is enabled, configMINIMAL_STACK_SIZE should be at least 256.

9. Doxygen HTML main page

This README is intended to be the main entry page for generated Doxygen HTML documentation in the asset packaging flow.

Release Notes and Changelog

  • RELEASE.md - Detailed release history, validated versions, and known issues

License

This software is distributed under the license terms provided with this asset.

  • LICENSE - Primary license terms for this middleware package
  • EULA - End User License Agreement distributed with this asset

(c) (2019-2026), Infineon Technologies AG, or an affiliate of Infineon Technologies AG. All rights reserved.