Over a million developers have joined DZone.

Building FreeRTOS Apps for the ARM Cortex-M4 on i.MX7 With Eclipse

Instead spending lots of money with commercial IDEs, it is possible to build FreeRTOS applications for the ARM Cortex-M4 on the NXP i.MX with free, open source tools.

· IoT Zone

Access the survey results 'State of Industrial Internet Application Development' to learn about latest challenges, trends and opportunities with Industrial IoT, brought to you in partnership with GE Digital.

Command line tools to build applications are great. But productivity goes up if I can use the standard Eclipse environment with GNU tools. This tutorial is about how to use standard and free GNU and Eclipse tools to build my FreeRTOS application for the ARM Cortex-M4 on i.MX7:

Eclipse used to build FreeRTOS applications for M4 on i.MX7

Eclipse used to build FreeRTOS applications for M4 on i.MX7


In my earlier article (see Tutorial: Running FreeRTOS on NXP i.MX7Dual Cortex-M4F) I used cmake, cygwin, and the ARM Launchpad GNU toolchain to build a demo application. That’s fine, but to be really productive, an IDE like Eclipse is preferred. NXP and Toradex offer some examples for IAR Embedded Workbench and ARM DS-5. The IAR IDE and toolchain is proprietary (not Eclipse) and expensive (there is a free 32k Byte version). On the other side, the ARM DS-5 is Eclipse-based, but also very expensive. NXP offers the unlimited and free-of-charge Eclipse-based Kinetis Design Studio (KDS), but for unknown reasons NXP does not provide any example projects with it for the i.MX parts. So, you either have to spend a lot of money or to use command line tools. Time to change this.

In this tutorial, I'm using KDS V3.2.0, which uses the GNU ARM Eclipse plugins and the GCC ARM Embedded (launchpad) tools. The cool thing is, because KDS is using standard components, I can build such an IDE with the toolchain and plugins myself (see “Going to Mars: Building a DIY Eclipse IDE for ARM Embedded Microcontrollers“).

I’m showing the required project settings in the next steps for the ‘hello world’ project. This project (and others) can be found on my GitHub site.


Project Creation

Create a new C/C++ project with the wizard, with the standard settings:

Creating Default Project with Eclipse

Creating Default Projects with Eclipse


Add FreeRTOS and application files to the project. Below shows the files for the ‘hello world’ demo application, where I’m using Eclipse Virtual Groups and linked files. But of course you can copy the files too.

Application and FreeRTOS Files

Project Settings

In the project settings, configure the Target Processor as ARM Cortex-M4 with hardware floating point unit:

Target Processor Settings

Target Processor Settings

In the Optimization settings that the following are turned on:

  • -ffunction-section
  • -fdata-sections
  • -ffreestanding
  • -fno-builtin
Optimization Settings

Optimization Settings


In the compiler preprocessor settings, have the two following defines added:


For a ‘release’ build you can use __NDEBUG instead of __DEBUG.

Preprocessor Settings

Preprocessor Settings

In order for the compiler to find the header files, specify all the paths needed. How they are specified depends on how your organize the source files. For the ‘hello world’ demo I’m using relative paths to the project directory ({$ProjDirPath}). You can copy and paste the paths below:

Include Paths

Include Paths


In the linker setting, specify the linker file to be used with the -T option (I’m using below the one using the tightly coupled memory (TCM)):

GNU Linker File

GNU Linker File

The path to linker file is specified with the -L option:

Path to Linker File

Path to Linker File

Use the newlib-nano library with the nosys option (–specs=nosys.specs):



Binary File

With u-boot we load a bin (binary) file. To create it, enable ‘Create Flash Image’ under the Toolchains tab. Press the ‘Apply’ button.

Create Flash Image

Create Flash Image

Back in the Tool Settings, specify to create a raw binary file:

Raw Binary File

Raw Binary File


Build it, and you should get the binary file you can load with u-boot (see Tutorial: Running FreeRTOS on NXP i.MX7Dual Cortex-M4F).

Binary File Created

Binary File Created


The IoT Zone is brought to you in partnership with GE Digital.  Discover how IoT developers are using Predix to disrupt traditional industrial development models.

freertos ,arm cortex-m ,ide ,iot

Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}