Building FreeRTOS with Eclipse
Using relative paths to reference the RTOS source code
The FreeRTOS download contains many different pre-configured demo application
projects, but for maintenance and
sanity reasons it contains only one copy of the RTOS source code. Ideally each demo project
would reference and build the single RTOS source code copy, and this is exactly what
most of the pre-configured RTOS demo projects do. However, historically this has not
been easy (although not impossible) to do in Eclipse, and older Eclipse based
RTOS demo projects use a batch file to copy all the necessary source files
from their default locations in the FreeRTOS directory tree into the
Eclipse project directory.
The latest versions of Eclipse have gone some way to alleviate
these problems by allowing the definition of variables that can resolve paths both
up and down the directory tree from the directory that contains the Eclipse .project
file. Newer RTOS demo applications that are built with an Eclipse based IDEs
are pre-configured to use this improved (although still comparatively awkward)
method, instead of the batch file method used previously. This page describes
how these projects are created.
Note: This page is provided for information only. The RTOS demo projects
in the official FreeRTOS download are already pre-configured, and should build
'out of the box', provided the build instructions
specific to the demo project in use are followed, and that the Eclipse version in use
is up to date.
Creating Eclipse Projects that Build Files Outside of the Project Directory
By way of example the following instructions show how to reference the FreeRTOS
source files, which reside in the /FreeRTOS/Source directory, from an Eclipse
project file, which resides in the /FreeRTOS/Demo/[project_name] directory.
Open the Project's Properties Window
Right click on the project's name in the Eclipse Project Explorer window,
then select 'Properties' from the pop up menu. The Properties window
Define a New Eclipse Variable
In the Properties window, select 'Resources->Linked Resources' to view
the path variables. Click the 'New' button to create a new variable that
will be used to point to the FreeRTOS source files directory
Define a new Eclipse variable
Name the new variable FREERTOS_ROOT, and use the pre-defined PROJECT_LOC
variable to enter a path that resolves to the /FreeRTOS/Source
Extending the PROJECT_LOC variable so it resolves to the /FreeRTOS/Source directory
Close the Properties window.
Creating a Virtual Folder
Eclipse managed make projects build all the source files
that appear in the Project Explorer window. The RTOS source files
are outside of the Eclipse project directory, so don't automatically appear in the
Project Explorer window, and must be added manually using a virtual
Right click on the folder name in the Project Explorer under which you
would like the RTOS source files to appear. Select 'New -> Folder'. The
New Folder window will open.
In the New Folder window, enter FreeRTOS as the folder name, and select
the 'Folder is not located in the file system (Virtual Folder)' radio
Creating a virtual folder in the Eclipse Project Explorer
Linking the RTOS Source Code Directory Into The Virtual Folder
Right click on the newly created virtual folder and select 'New -> Folder'
from the pop up menu to bring up the New Folder window again.
Right click the virtual folder in order to view the pop up menu
In the new folder window, enter Source as the directory name, and this
time select the 'Link to alternative location (Linked Folder)' radio
button. Enter the newly created FREERTOS_ROOT variable as the folder's location.
Using a relative path to add a linked folder into an Eclipse project
Selecting the Files To Build
The FreeRTOS/Source directory is now visible within the
Eclipse Project explorer. The directory contains the source files for
every RTOS port, so the next step is to use Eclipse resource filters to
ensure only the files necessary to build the FreeRTOS port actually being
used are visible.
Right click on the Portable directory to view the pop up menu again, this
time select 'Properties'. A pop up window that shows the proprieties of
the Portable directory will be displayed.
Viewing the properties of the RTOS Source code's Portable directory
In the Properties window, select 'Resources->Resource Filters' to view
the directory's resource filters. Create two 'Include Only' resource filters
so the only directories that are shown match the text 'MemMang' and '[compiler]',
where [compiler] is the compiler used to build the source files. By way of
example, the next
two images show the settings to use if the project is being built with the
Defining 'Include Only' resource filters on the directories
The Resource Filters window after the two filters have
At the time of writing, the MemMang directory contains four .c files,
each of which provides one of
four different options for heap memory management.
Add a resource filter to the MemMang directory
to ensure only one of the four .c files is visible.
Using a resource filter to ensure only one heap_x.c file is built,
heap_4.c in the depicted case
The [compiler] directory will contain a sub directory for each architecture
FreeRTOS supports with that compiler. Add a resource filter to the
[compiler] directory to ensure only the directory for the architecture
actually being used is visible. For example, the resource filter being
created in the image below is correct if the Renesas compiler is being
used to build a project that targets a microcontroller form the RX600 family.
Creating a resource filter to ensure only one sub directory
under the [compiler] directory is visible
Adding Linked Directories Into the Compiler's Include Path
Virtual and linked folders can be added to the compiler's include path
in the normal way.
Adding directories from the virtual and linked folders into
the compiler's include path
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.
Version 10.1.1 of the
FreeRTOS kernel is available for
immediate download. MIT
View a recording
of the "OTA Update Security and Reliability" webinar,
presented by TI and AWS.
FreeRTOS and other embedded software careers at AWS.