Source Organization
[Getting Started]



Basic directory structure

The FreeRTOS download includes source code for every processor port, and every demo application. Placing all the ports in a single download greatly simplifies distribution, but the number of files may seem daunting. The directory structure is however very simple, and the FreeRTOS real time kernel is contained in just 3 files (4 if co-routines are used).

From the top, the download is split into two sub directories:

FreeRTOS
    ¦
    +-Demo      Contains the demo application.
    ¦
    +-Source    Contains the real time kernel source code.

The majority of the real time kernel code is contained in three files that are common to every processor architecture (four if co-routines are used). These files, tasks.c, queue.c and list.c, are in the source directory.

Each processor architecture requires a small amount of kernel code specific to that architecture. The processor specific code is contained in a directory called Portable, under the Source directory.

The download also contains a demo application for every processor architecture and compiler port. The majority of the demo application code is common to all ports and is contained in a directory called Common, under the Demo directory. The remaining sub directories under Demo contain build files for building the demo for that particular port.

FreeRTOS
    ¦
    +-Demo
    ¦   ¦
    ¦   +-Common    The demo application files that are used by all the ports.
    ¦   +-Dir x     The demo application build files for port x
    ¦   +-Dir y     The demo application build files for port y
    ¦
    +-Source
        ¦
        +-Portable  Processor specific code.


The following subsections provide more details of the Demo and Source directories.



RTOS source code directory list
[the Source directory]

To use FreeRTOS you need to include the real time kernel source files in your makefile. It is not necessary to modify them or understand their implementation.

The real time kernel source code consists of three files that are common to all microcontroller ports (four if co-routines are used), and a single file that is specific to the port you are using. The common files can be found in the FreeRTOS/Source directory. The port specific files can be found in subdirectories contained in the FreeRTOS/Source/Portable directory.

For example:

FreeRTOS/Portable/MemMang contains the sample memory allocators as described in the memory management section.



Demo application source code directory list
[the Demo directory]

The Demo directory tree contains a demo application for each port. Most of the code for the demo application is common to every port. The code that is common to every port is located in the FreeRTOS/Demo/Common directory. See the demo application section for more details. Port specific code, including the demo application project files, can be found in sub directories contained in the FreeRTOS/Demo directory.

For example:



Creating your own application

When writing your own application it is preferable to use the demo application makefile (or project file) as a starting point. You can leave all the files included from the Source directory included in the makefile, and replace the files included from the Demo directory with those for your own application. This will ensure both the RTOS source files included in the makefile and the compiler switches used in the makefile are both correct.



The Directory tree

The directory tree is shown below - including a brief description of each node - please note this is not necessarily a complete up to date list:
FreeRTOS
 ¦
 +-Demo             Contains all directories associated with the demo application, one sub directory per port.
 ¦   ¦
 ¦   +-Common                   Demo application files common to all ports
 ¦   ¦   +-Minimal                 Minimal version of common demo application files
 ¦   ¦   +-Full                    Full version of common demo application files
 ¦   ¦   +-include                 Demo application header files
 ¦   ¦
 ¦   +-ARM7_AtmelSAM7S64_IAR    Demo application source code for the AT91SAM7S64 port using the IAR compiler
 ¦   ¦   +-ParTest
 ¦   ¦   +-serial
 ¦   ¦
 ¦   +-ARM7_AT91SAM7X256_Eclipse Demo application source code for the AT91SAM7X port using GCC and Eclipse
 ¦   ¦   +-Webserver
 ¦   ¦   +-USB
 ¦   ¦
 ¦   +-ARM7_LPC2106_GCC         Demo application source code for the LPC2106 port
 ¦   ¦   +-ParTest
 ¦   ¦   +-serial
 ¦   ¦
 ¦   +-ARM7_LPC2129_Keil_RVDS   Demo application source code for the LPC2109 port using the Keil/ARM/RVDS compiler
 ¦   ¦   +-ParTest
 ¦   ¦   +-serial
 ¦   ¦
 ¦   +-ARM7_AT91FR40008_GCC     Demo application source code for the AT91 port using the GCC compiler
 ¦   ¦   +-ParTest
 ¦   ¦   +-serial
 ¦   ¦
 ¦   +-ARM7_STR75x_IAR          Demo application source code for the STR75x port using the IAR compiler
 ¦   ¦   +-ParTest
 ¦   ¦   +-serial
 ¦   ¦
 ¦   +-ARM7_STR71x_IAR          Demo application source code for the STR71x port using the IAR compiler
 ¦   ¦   +-ParTest
 ¦   ¦   +-serial
 ¦   ¦
 ¦   +-ARM9_STR91X_IAR          Demo application source code for the STR912 port using the IAR compiler
 ¦   ¦   +-ParTest
 ¦   ¦   +-serial
 ¦   ¦   +-webserver
 ¦   ¦
 ¦   +-ARM9_AT91SAM9XE_IAR      Demo application source code for the AT91SAM9XE port using the IAR compiler
 ¦   ¦   +-ParTest
 ¦   ¦   +-serial
 ¦   ¦
 ¦   +-ARM7_LPC2138_Rowley      Demo application project for the LPC2138 ARM7 port using the CrossStudio tools
 ¦   ¦
 ¦   +-ARM7_LPC2138_Eclipse     Demo application project for the LPC2138 ARM7 port using GCC and Eclipse.
 ¦   ¦
 ¦   +-ColdFire_MCF5282_Eclipse Demo application project for the ColdFire V2 port using GCC and Eclipse.
 ¦   ¦
 ¦   +-ColdFire_MCF52221_CodeWarrior  Demo application project for the ColdFire V2 port using CodeWarrior
 ¦   ¦
 ¦   +-HCS12_CodeWarrior_small  Demo application source code for the HCS12 port small memory model
 ¦   ¦   +-ParTest
 ¦   ¦   +-serial
 ¦   ¦
 ¦   +-HCS12_CodeWarrior_banked Demo application source code for the HCS12 port banked memory model
 ¦   ¦   +-ParTest
 ¦   ¦   +-serial
 ¦   ¦
 ¦   +-H8S                      Demo application source code for the H8/S port
 ¦   ¦   +-ParTest
 ¦   ¦   +-serial
 ¦   ¦
 ¦   +-NEC_78K0R_IAR            Demo application source code for the NEC 78K0R using the IAR compiler
 ¦   ¦   +-ParTest
 ¦   ¦   +-serial
 ¦   ¦
 ¦   +-NEC_V850ES_IAR           Demo application source code for the NEC V850ES using the IAR compiler
 ¦   ¦   +-ParTest
 ¦   ¦   +-serial
 ¦   ¦
 ¦   +-MSP430X_MSP430F5438_IAR  Demo application source code for the MSP430X port using the IAR tools
 ¦   ¦
 ¦   +-MSP430X_MSP430F5438_CCS4 Demo application source code for the MSP430X port using the CCS4 tools
 ¦   ¦
 ¦   +-MSP430                   Demo application source code for the MSP430F449 port
 ¦   ¦   +-ParTest
 ¦   ¦   +-serial
 ¦   ¦
 ¦   +-AVR32_UC3                Demo application source code for the AVR32 port using the GCC and IAR compiler
 ¦   ¦   +-AT32UC3A
 ¦   ¦       +-GCC              Make file to build the standard AVR32 demo using the GCC compiler
 ¦   ¦       +-IAR              Make file to build the standard AVR32 demo using the IAR compiler
 ¦   ¦
 ¦   +-AVR_ATMega323_WinAVR     Demo application source code for the AVR port using the GCC compiler
 ¦   ¦   +-ParTest
 ¦   ¦   +-serial
 ¦   ¦
 ¦   +-AVR_ATMega323_IAR        Demo application source code for the AVR port using the IAR compiler
 ¦   ¦   +-ParTest
 ¦   ¦   +-serial
 ¦   ¦
 ¦   +-PIC32_MPLAB              Demo application source code for PIC32 (MIPS M4K) port using MPLAB and the C32 compiler
 ¦   ¦   +-ParTest
 ¦   ¦   +-serial
 ¦   ¦
 ¦   +-PIC18_MPLAB              Demo application source code for PIC18 port using the MPLAB compiler
 ¦   ¦   +-ParTest
 ¦   ¦   +-serial
 ¦   ¦
 ¦   +-PIC18_WIZC               Demo application source code for PIC18 port using the WizC compiler
 ¦   ¦   +-ParTest
 ¦   ¦   +-serial
 ¦   ¦
 ¦   +-PIC24_MPLAB              Demo application source code for PIC24 port using the MPLAB compiler
 ¦   ¦   +-ParTest
 ¦   ¦   +-serial
 ¦   ¦
 ¦   +-dsPIC_MPLAB              Demo application source code for dsPIC port using the MPLAB compiler
 ¦   ¦   +-ParTest
 ¦   ¦   +-serial
 ¦   ¦
 ¦   +-Cygnal                   Demo application source code for Cygnal (Silicon labs) 8051 port
 ¦   ¦   +-ParTest
 ¦   ¦   +-serial
 ¦   ¦
 ¦   +-Flshlite                 Demo application source for Flashlite 186 port
 ¦   ¦   +-FileIO
 ¦   ¦   +-serial
 ¦   ¦   +-ParTest
 ¦   ¦
 ¦   +-Microblaze               Demo application source for Xilinx Microblaze port. Now deprecated. See demo below
 ¦   ¦   +-serial
 ¦   ¦   +-ParTest
 ¦   ¦
 ¦   +-MicroBlaze_Spartan-6_EthernetLite  Demo application source for Xilinx Microblaze port with lwIP example
 ¦   ¦   +-serial
 ¦   ¦   +-ParTest
 ¦   ¦
 ¦   +-CORTEX_A2F200_IAR_and_Keil Demo application source for the SmartFusion A2F Cortex-M3 port using the IAR and Keil tools
 ¦   ¦
 ¦   +-CORTEX_A2F200_SoftConsole Demo application source for the SmartFusion A2F Cortex-M3 port using the SmartFusion tools (GCC and Eclipse)
 ¦   ¦
 ¦   +-CORTEX_STM32F100_Atollic Demo application source for the STM32F100 Cortex-M3 port using the TrueStudio tools
 ¦   ¦
 ¦   +-CORTEX_STM32F103_IAR     Demo application source for the STM32F103 Cortex-M3 port using the IAR tools
 ¦   ¦
 ¦   +-CORTEX_STM32F103_Primer_GCC Demo application source for the STM32F103 Cortex-M3 port using the GCC and RIDE tools
 ¦   ¦
 ¦   +-CORTEX_STM32L152_IAR     Demo application source for the STM32L152 Cortex-M3 port using the IAR Embedded Workbench
 ¦   ¦
 ¦   +-CORTEX_LM3S102_GCC       Demo application source for the LM3S102 Cortex-M3 port using the GCC tools
 ¦   ¦
 ¦   +-CORTEX_LM3S102_Keil      Demo application source for the LM3S102 Cortex-M3 port using the Keil/RVDS tools
 ¦   ¦
 ¦   +-CORTEX_LM3S102_Rowley    Demo application source for the LM3S102 Cortex-M3 port using Rowley CrossWorks
 ¦   ¦
 ¦   +-CORTEX_LM3S316_IAR       Demo application source for the LM3S314 Cortex-M3 port using IAR
 ¦   ¦
 ¦   +-CORTEX_LM3S811_GCC       Demo application source for the LM3S811 Cortex-M3 port using the GCC tools
 ¦   ¦
 ¦   +-CORTEX_LM3S811_IAR       Demo application source for the LM3S811 Cortex-M3 port using IAR
 ¦   ¦
 ¦   +-CORTEX_LM3S811_KEIL      Demo application source for the LM3S811 Cortex-M3 port using Keil
 ¦   ¦
 ¦   +-CORTEX_LM3Sxxxx_IAR_Keil Demo application source for the LM3S6965, LM3S2965, LM3S1962 and LM3S8962 Cortex-M3 port using IAR and Keil
 ¦   ¦
 ¦   +-CORTEX_LM3Sxxxx_Eclipse  Demo application source for the LM3S6965, LM3S2965, LM3S1962 and LM3S8962 Cortex-M3 port using Eclipse with GCC
 ¦   ¦
 ¦   +-CORTEX_LM3Sxxxx_Rowley   Demo application source for the LM3S6965, LM3S2965, LM3S1962 and LM3S8962 Cortex-M3 port using Rowley CrossWorks with GCC
 ¦   ¦
 ¦   +-CORTEX_MB9B500_IAR_Keil  Demo application source for the Fujitsu FM3 MB9BF506N using the IAR and Keil tools
 ¦   ¦
 ¦   +-CORTEX_CY8C5588_PSoC_Creator_GCC   Demo application source for the PSoC 5 Cortex-M3 using GCC tool-chain
 ¦   ¦
 ¦   +-CORTEX_CY8C5588_PSoC_Creator_Keil  Demo application source for the PSoC 5 Cortex-M3 using Keil/RVDS tool-chain
 ¦   ¦
 ¦   +-CORTEX_CY8C5588_PSoC_Creator_RVDS  Demo application source for the PSoC 5 Cortex-M3 using ARM/RVDS tool-chain
 ¦   ¦
 ¦   +-CORTEX_MPU_LM3Sxxxx_Rowley FreeRTOS-MPU Demo application source for the LM3S6965, LM3S2965, LM3S1962 and LM3S8962 Cortex-M3 port using Rowley CrossWorks with GCC
 ¦   ¦
 ¦   +-CORTEX_MPU_LPC1768_GCC_RedSuite  FreeRTOS-MPU Demo application source for the LM3S6965, LM3S2965, LM3S1962 and LM3S8962 Cortex-M3 port using RedSuite with GCC
 ¦   ¦
 ¦   +-CORTEX_M4F_STM32F407ZG-SK  Demo application source for the STM32F407 Cortex-M4F using the IAR Embedded Workbench
 ¦   ¦
 ¦   +-CORTEX_M4F_M0_LPC43xx_Keil Demo application source for the LPC4350 Cortex-M4F (with Cortex-M0 co-processor) using the Keil/RVDS tools
 ¦   ¦
 ¦   +-RX600_RX62N-RDK_GNURX    Demo application for the RX62N using the GCC tools.  Includes an embedded web server.  Targets the RDK hardware.
 ¦   ¦
 ¦   +-RX600_RX62N-RDK_IAR      Demo application for the RX62N using the IAR tools.  Includes an embedded web server.  Targets the RDK hardware.
 ¦   ¦
 ¦   +-RX600_RX62N-RDK_Renesas  Demo application for the RX62N using the GCC tools.  Includes an embedded web server.  Targets the RDK hardware.
 ¦   ¦
 ¦   +-RX600_RX62N-RSK_GNURX    Demo application for the RX62N using the GCC tools.  Includes an embedded web server.  Targets the RSK hardware.
 ¦   ¦
 ¦   +-RX600_RX62N-RSK_IAR      Demo application for the RX62N using the IAR tools.  Includes an embedded web server.  Targets the RSK hardware.
 ¦   ¦
 ¦   +-RX600_RX62N-RSK_Renesas  Demo application for the RX62N using the GCC tools.  Includes an embedded web server.  Targets the RSK hardware.
 ¦   ¦
 ¦   +-SuperH_SH7216_Renesas    Demo application for the SuperH SH7216
 ¦   ¦
 ¦   +-TriCore_TC1782_TriBoard_GCC Demo application for the TriCore TC1782 using the HighTec GCC tools
 ¦   ¦
 ¦   +-uIP_Demo_IAR_ARM7        Embedded web server demo using uIP and the IAR development tools
 ¦   ¦
 ¦   +-lwIP_Demo_Rowley_ARM7    Embedded web server demo using lwIP and the Rowley development tools
 ¦   ¦
 ¦   +-lwIP_AVR32_UC3           Embedded web and TFTP server demo using lwIP and GCC on the AT32UC3A0512 AVR32
 ¦   ¦
 ¦   +-uIP_Demo_Rowley_ARM7     Embedded web server demo using uIP and the Rowley development tools
 ¦   ¦
 ¦   +-WizNET_DEMO_GCC_ARM7     Embedded web server demo application using the WizNET coprocessor with I2C interface
 ¦   ¦
 ¦   +-WizNET_DEMO_TERN_186     Embedded web server demo application using the WizNET coprocessor with mapped interface
 ¦   ¦
 ¦   +-WIN32-MingW              FreeRTOS Windows simulator, using MingW (GCC) and Eclipse
 ¦   ¦
 ¦   +-WIN32-MSVC               FreeRTOS Windows simulator, using Visual Studio 2010 Express
 ¦   ¦
 ¦   +-MB91460_Softune          Demo application source for the MB91460 series of microcontrollers from Fujitsu
 ¦   ¦
 ¦   +-MB96340_Softune          Demo application source for the MB96340 series of microcontrollers from Fujitsu
 ¦   ¦
 ¦   +-PC                       Demo application source for PC port
 ¦       +-FileIO
 ¦       +-ParTest
 ¦       +-serial
 ¦
 +-Source           Contains all directories associated with the scheduler source code
    ¦
    ¦               3 core scheduler files common to all ports (4 is using co-routines)
    ¦
     +-include                  Scheduler header files
     ¦
     +-portable                 Scheduler port layer for all ports
         ¦
         +-MemMang                  Sample memory allocators can be used for all ports		 
         ¦
         ¦
         +-BCC                      Scheduler port layer for ports using Borland compiler
         ¦   +-Flsh186                  Scheduler port files for Flashlite 186 port
         ¦   +-common                   Scheduler port files common to all BCC DOS based ports
         ¦   +-PC                       Scheduler port files for PC port
         ¦
         ¦
         +-CodeWarrior              Scheduler port layer for ports using CodeWarrior compiler
         ¦   +-ColdFire_V1              Scheduler port files for ColdFire V1 family using CodeWarrior compiler
         ¦   +-ColdFire_V2              Scheduler port files for ColdFire V2 family using CodeWarrior compiler
         ¦   +-HCS12                    Scheduler port files for HCS12 family using CodeWarrior compiler
         ¦
         ¦		 
         +-GCC                      Scheduler port layer for ports using GCC compiler
         ¦   +-ARM7_AT91FR40008         Scheduler port files for AT91 family using GCC compiler
         ¦   +-ARM7_AT91SAM7            Scheduler port files for AT91 SAM family using GCC compiler
         ¦   +-ARM7_LPC2000             Scheduler port files for LPC2000 family using GCC compiler
         ¦   +-ARM7_LPC23xx             Scheduler port files for LPC23xx family using GCC compiler
         ¦   +-ARM_CM3                  Scheduler port files for all ARM Cortex-M3 devices using GCC compiler
         ¦   +-ARM_CM3_MPU              FreeRTOS-MPU scheduler port files for all ARM Cortex-M3 devices that contain an MPU using GCC compiler
         ¦   +-ATmega323                Scheduler port files for AVR family using GCC compiler
         ¦   +-AVR32_UC3                Scheduler port files for all AVR32 UC3 devices using GCC compiler
         ¦   +-ColdFire_V2              Scheduler port files for all ColdFire V2 devices using GCC compiler
         ¦   +-Cortus_APS3              Scheduler port files for Cortus APS3 using GCC compiler
         ¦   +-H8S2329                  Scheduler port files for H8/S using GCC compiler
         ¦   +-HCS12                    Scheduler port files for HCS12 using GCC compiler
         ¦   +-Microblaze               Scheduler port files for Microblaze using GCC compiler. Now deprecated
         ¦   +-MicroblazeV8             Scheduler port files for Microblaze V8 using GCC compiler		 
         ¦   +-MSP430F449               Scheduler port files for MSP430 using GCC compiler
         ¦   +-NiosII                   Scheduler port files for NiosII using GCC compiler
         ¦   +-PPC405_Xilinx            Scheduler port files for Xilinx implementation of PowerPC 405 using GCC compiler
         ¦   +-PPC440_Xilinx            Scheduler port files for Xilinx implementation of PowerPC 440 using GCC compiler
         ¦   +-RX600                    Scheduler port files for RX600 using GCC compiler
         ¦   +-STR75x                   Scheduler port files for STR75x using GCC compiler
         ¦   +-TriCore_1782             Scheduler port files for TriCore using GCC compiler		 
         ¦
         ¦
         +-IAR                      Scheduler port layer for ports using IAR compiler
         ¦   +-78K0R                    Scheduler port files for 78K0R family using IAR compiler		 
         ¦   +-ARM_CM3                  Scheduler port files for all Cortex-M3 devices using IAR compiler		 
         ¦   +-ARM_CM4F                 Scheduler port files for all Cortex-M4F devices using IAR compiler		 
         ¦   +-ATmega323                Scheduler port files for AVR family using IAR compiler
         ¦   +-AtmelSAM7S64             Scheduler port files for SAM7 family using IAR compiler
         ¦   +-AtmelSAM9XE              Scheduler port files for SAM9XE family using IAR compiler
         ¦   +-AVR32_UC3                Scheduler port files for all AVR32 UC3 devices using IAR compiler
         ¦   +-LPC2000                  Scheduler port files for LPC2000 family using IAR compiler		 
         ¦   +-MSP430                   Scheduler port files for MSP430 using IAR compiler		 
         ¦   +-MSP430X                  Scheduler port files for MSP430X using IAR compiler		 		 
         ¦   +-RX600                    Scheduler port files for RX600 using IAR compiler		 
         ¦   +-STR71x                   Scheduler port files for STR71x family using IAR compiler
         ¦   +-STR91x                   Scheduler port files for STR91x family using IAR compiler
         ¦   +-V850ES                   Scheduler port files for V850ES family using the IAR compiler
         ¦
         ¦
         +-Keil                     *See the RVDS directory*
         ¦
         ¦
         +-MPLAB                    Scheduler port layer for ports using Microchip C18 compiler
         ¦   +-PIC18                    Scheduler port files for PIC18 family using Microchip C18 compiler
         ¦   +-PIC24_dsPIC              Scheduler port files for PIC24 and dsPIC families using the Microchip compiler
         ¦   +-PIC32MX                  Scheduler port files for PIC32MX family using the Microchip compiler
         ¦
         ¦
         +-oWatcom                  Scheduler port layer for ports using Open Watcom compiler
         ¦   +-Flsh186                  Scheduler port files for Flashlite 186 port
         ¦   +-common                   Scheduler port files common to all OW DOS based ports
         ¦   +-PC                       Scheduler port files for PC real mode port
         ¦
         ¦
         +-Paradigm                 Scheduler port layer for ports using Paradigm compiler
         ¦   +-Tern_EE                  Scheduler port files for Tern 186 port
         ¦      +-small                    Small memory model port for Tern 186
         ¦      +-large_untested           Large memory model port for Tern 186 - untested!
         ¦
         ¦
         +-Renesas                  Scheduler port layer for ports using Renesas compiler
         ¦   +-RX600                    Scheduler port files for RX600 devices using the Renesas compiler
         ¦   +-SH2A_FPU                 Scheduler port files for SuperH 2A family including FPU support
         ¦
         ¦
         +-Rowley                   Scheduler port layer for ports using Rowley CrossWorks compiler
         ¦   +-ARM7                     The Rowley IDE uses GCC as its compiler, so see the GCC ports		 
         ¦   +-MSP430F449               Scheduler port files for MSP430 family using Rowley compiler
         ¦
         ¦
         +-RVDS                     Scheduler port layer for ports using RVDS/Keil compiler
         ¦   +-ARM7_LPC21xx             Scheduler port files for LPC21xx family using the RVDS compiler
         ¦   +-ARM_CM3                  Scheduler port files for all ARM Cortex-M3 devices using the RVDS compiler
         ¦   +-ARM_CM4F                 Scheduler port files for all ARM Cortex-M4F devices using the RVDS compiler
         ¦
         ¦
         +-SDCC                     Scheduler port layer for ports using SDCC compiler
         ¦   +-Cygnal                   Scheduler port files for Cygnal 8051 using SDCC compiler (out of date)
         ¦
         ¦
         +-Softune                  Scheduler port layer for ports using Softune compiler
             +-MB91460                  Scheduler port files for MB91460 and family using the Softune compiler
             +-MB96340                  Scheduler port files for MB96340 and family using the Softune compiler






Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2012 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOS distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd..