Skip to main content

FreeRTOS on the Cortex-M4 of a Verdin iMX8M Mini

The i.MX 8M Mini applications processor is a feature and performance-scalable multicore platform including a Cortex-M4 core. This secondary core typically runs an RTOS optimized for microcontrollers or a bare-metal application. Toradex provides FreeRTOS™, a free professional-grade real-time operating system for microcontrollers, along with drivers and several examples that can be used on our Verdin iMX8M Mini platform. The FreeRTOS™ port is based on NXP's MCUxpresso SDK for the i.MX 8M Mini.


For more information about the basics of utilizing the Cortex-M4 processor present in your i.MX Toradex Board, check M4 Control Tool for i.MX platforms


The Cortex-M4 CPU core lives side by side with the Cortex-A53 based primary CPU cores. Both CPU complexes have access to the same interconnect and hence have equal access to all peripherals (shared bus topology). The graphic below is an incomplete and simplified drawing of the architecture with emphasis on the relevant sub systems to understand the heterogeneous asymmetric multicore architecture.

i.MX 8M Mini Heterogeneous Asymmetric Multicore Architecture Block Diagram

There are several types of memory available. The Cortex-M4 provides local memory (Tightly Coupled Memory, TCM), which is relatively small but can be accessed by the CPU without any latency. For applications requiring more memory, the system DRAM is accessible by the M4 cores. From a performance perspective the TCM memory should be used whenever possible.

A traditional microcontroller typically has internal NOR flash where the firmware is stored and executed from. This is not the case on the Verdin iMX8M Mini: There is no NOR flash where the firmware can be flashed onto. Instead, the firmware needs to be stored on the mass storage device such as an SD card or the internal eMMC flash. The available mass storage devices are not "memory mapped", and hence application can not be executed directly from any of the cores (no Execution-In-Place, XIP). Instead, code need to be loaded into one of the available memory sections before the CPU can start executing it.

The M4 firmware can be placed in the common boot container, so it will be loaded and started by the boot ROM, or it can be placed on a mass storage device. In this case U-Boot needs to be configured to load and execute the M4 firmware.

Memory areas

The two CPU platforms use a different memory layout to access individual sub systems. This table lists some important areas and their memory location for each of the cores side by side. The full list can be found in the i.MX 8M Mini reference manual.

DDR Address2GB(*1)0x00000000-0x3FFFFFFF0x40000000-0xBFFFFFFF
TCML for M4128KB0x007E0000-0x007FFFFF0x1FFE0000-0x1FFFFFFF
TCMU for M4128KB0x00800000-0x0081FFFF0x20000000-0x2001FFFF

(*1): Full DRAM range is 0x1_00000000 - 0x2_FFFFFFFF. Only a part (2048MB) of the DRAM is accessible by the M4 cores.

The Cortex-M4 CPU has two buses connected to the main interconnect (modified Harvard architecture). One bus is meant to fetch data (system bus) whereas the other bus is meant to fetch instructions (code bus). To get optimal performance, the program code should be located and linked for a region which is going to be fetched through the code bus, while the data area (e.g. bss or data section) should be located in a region which is fetched through the system bus.

The TCML and TCMU regions can be accessed with zero wait-states and thus provides massively better performance than DRAM, even if it is cached. Therefore it is advisable to place all code and data in the TCM whenever possible.

Get the FreeRTOS Source Code

The FreeRTOS source code is currently only available on NXP's MCUXpresso web page:

Here are the steps to download the resources (as of 2020-08-06)

  1. Register and log into MCUXpresso
  2. On the main page, Explore and Filter Devices
  3. Select Board on the left side
  4. Navigate to Processors i.MX 8M Mini Quad MIMX8MMx MIMX8MM6xxxKZ
  5. Click the button to Build MCUXpresso SDK
  6. On the SDK Builder page, select the latest SDK Version (2.8.0 as of 2020-08-06), the toolchain (GCC Arm Embedded) and the Host OS (Linux) for this example. Make sure to check the box to include FreeRTOS into the SDK. You can also include the CMSIS DSP Library.
  7. Click the Download SDK button to get the source code.

Send Feedback!