FreeRTOS is a popular free real-time operating system that is suited for embedded systems. There are hundreds of pre-setup ports for specific processor architecture/compiler combinations. I won’t go into detail explaining the FreeRTOS API, this is extremely well documented on the FreeRTOS website. Instead, below is a quick reference guide.

Child Pages

Common Mistakes When Using FreeRTOS
Common mistakes/traps designers make when using the FreeRTOS operating system.
Compiling FreeRTOS With C++
Information on how to use the FreeRTOS operating system in a C++ environment.
FreeRTOS And Watchdogs
ContentsOverviewA Simple ApproachA Better ApproachCan I Use The System Tick?Overview The multi-tasked nature of FreeRTOS presents challenges when implementing a watchdog. A Simple Approach A simple approach to implementing a watchdog in a multi-tasked FreeRTOS application is to create a new watchdog task whose responsibility is to feed the watchdog at a constant rate. However, … Continue reading FreeRTOS And Watchdogs
FreeRTOS Quick Reference Guide
A quick reference code guide (cheat sheet) for the FreeRTOS embedded operating system.
FreeRTOS Tips And Tricks
FreeRTOS tips and tricks.
The Idle Task
Information on how to use the idle task provided by the FreeRTOS operating system.

Getting The Code

You can either download it from: or checkout the official SVN repository (I recommend this way) using the following command:

Tips For Minimising The Amount Of RAM Used By FreeRTOS

  • Reduce the number of available task priorities (set in FreeRTOSConfig.h, these are configMAX_PRIORITIES  and configMAX_CO_ROUTINE_PRIORITIES )
  • Reduce the stack size for each of the tasks/co-routines.
  • Use co-routines ONLY (no tasks). There are disadvantages to doing this though…

Memory Guide

Extra consideration of memory is needed when using FreeRTOS! You have to know and understand heaps and stacks.
Queues are stored on the heap, as are semaphores. You can view the remaining heap size by calling the function xPortGetFreeHeapSize(); .

Fat File System

As of v7.5.0, FreeRTOS has supported the Fat SL embedded file system library, provided by HCC Embedded. It supports a standard range of file operations (e.g. f_open() , f_write()).

Error Checking

FreeRTOS provides the macro  configASSERT(). An assertion is triggered if the parameter passed to configASSERT() is zero. It behaviour in a similar manner to the standard-C assert() macro. It is up to the user to provide an actual implementation on configASSERT(), it is not defined by FreeRTOS, just used through-out their code. An example definition is shown below (taken from the FreeRTOS website):

It is recommended that you make use of it in your code for once-only and continuous error checking!

Long File Name Warning

Some of the files in the demo folder are nested deeply within others, giving large file paths. When the FreeRTOS directory is itself put in a resonably large directory, this can easily result in file paths over 260 characters, which on a Windows system, will cause issues (such as the SCM Mercurial not working correctly, or errors when trying to copy/cut/paste directories). Long file names include:



 Document Description Reference
Embedded Computer - RTOS vs. GPOS
 A good article pitching and comparing a RTOS against a GPOS.