Skip to content

FreeRTOS Project Setup

This guide provides a step-by-step checklist to set up a Code Composer Studio (CCS) project to use the FreeRTOS real-time operating system on the TI EK-TM4C1294XL LaunchPad. You will create a minimal CCS project, add the FreeRTOS kernel source files, configure the project settings, and verify that FreeRTOS is running correctly with a simple multitasking example.

The folder structure of the FreeRTOS kernel source (after unzipping):

  • FreeRTOS.h # FreeRTOS kernel header
  • FreeRTOSConfig.h # User configuration for your project
  • startup_ccs.c # TivaWare startup file (vector table)
  • DirectoryFreeRTOS # Kernel source
    • Directoryinclude
      • FreeRTOS.h
      • task.h
      • queue.h
      • semphr.h
      • (other headers)
    • Directoryportable
      • DirectoryCCS
        • DirectoryARM_CM4F
          • port.c
          • portasm.asm
        • DirectoryMemMang
          • heap_4.c
    • tasks.c
    • queue.c
    • list.c
    • (other source files)

Follow these steps to set up a minimal project in Code Composer Studio (CCS):

  1. Open CCS and select a folder for a new workspace (we recommend a dedicated workspace).

    CCS workspace selection
  2. Create a new CCS project via File > New > CCS Project.

  3. Configure project settings:

    • Target: Tiva C Series TM4C1294NCPDT
    • Connection: Stellaris In-Circuit Debug Interface
    • Project name: e.g., Lab2_FreeRTOS
    • Compiler version: TI v20.2.7.LTS or later
    • Project templates and examples: select Empty Project

To add FreeRTOS to your project, follow these steps:

  1. Extract the ZIP and place the FreeRTOS kernel folder inside your workspace (e.g., workspace/FreeRTOS-Kernel).

    CCS project folder structure
  2. Copy the following files into your project folder (e.g., into Lab2_FreeRTOS):

    • FreeRTOS.h
    • FreeRTOSConfig.h (your project-specific configuration)
    • startup_ccs.c (startup file with vector table for FreeRTOS)
    CCS project files
  3. Remove the file tm4c1294ncpdt_startup_ccs.c that CCS created by default. Use the provided startup_ccs.c instead.

  4. Link the FreeRTOS kernel sources into your project (do not copy): drag-and-drop the FreeRTOS folder from your file explorer into CCS Project Explorer. In the popup:

    • Choose Link to files.
    • Recreate folder structure with virtual folders relative to PROJECT_LOC.
    • When prompted, allow CCS to adjust include paths automatically. Check the option “Do this for all header files…”.

    Do not copy these files into the project.
  5. Open Project > Properties > ARM Linker > Basic Options and set C system stack size to 2048.

    Setting stack size in CCS
  6. Verify include paths under Project > Properties > Build > Compiler > Include Options to confirm the FreeRTOS include paths were added correctly.

    Include paths in CCS
  7. Include TivaWare driverlib and utils in Project > Properties > Build > Compiler > Include Options.

    • C:\ti\TivaWare_C_Series-2.2.0.295\utils
    • C:\ti\TivaWare_C_Series-2.2.0.295\driverlib
    • C:\ti\TivaWare_C_Series-2.2.0.295
    Include paths in CCS
  8. Add the pre-compiled tivaware library to Project > Properties > Build > Linker > File Search Path:

    • C:\ti\TivaWare_C_Series-2.2.0.295\grlib\ccs\Debug\grlib.lib
    • C:\ti\TivaWare_C_Series-2.2.0.295\driverlib\ccs\Debug\driverlib.lib
    Linker file search path in CCS

Create a simple main.cpp (Right-click the project > New > Source File) and add the following code to verify that FreeRTOS compiles, links, and the scheduler starts correctly.

This minimal example creates a single task that toggles LED D1 (PN1) once per second. If you see the LED blinking, FreeRTOS is working. No external libraries are needed — only TivaWare driverlib and FreeRTOS.

#include <stdint.h>
#include <stdbool.h>
extern "C" {
#include "driverlib/fpu.h"
#include "driverlib/interrupt.h"
#include "driverlib/sysctl.h"
#include "driverlib/gpio.h"
#include "inc/hw_memmap.h"
#include "FreeRTOS.h"
#include "task.h"
}
// A single task: blink LED D1 every 1 second
void HeartbeatTask(void *pvParameters) {
for (;;) {
GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, GPIO_PIN_1); // LED ON
vTaskDelay(pdMS_TO_TICKS(1000));
GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, 0); // LED OFF
vTaskDelay(pdMS_TO_TICKS(1000));
}
}
int main(void) {
IntMasterDisable();
FPUEnable();
FPULazyStackingEnable();
SysCtlClockFreqSet(
SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN |
SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480,
120000000
);
// Enable GPIO Port N and configure PN1 (LED D1) as output
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPION);
while (!SysCtlPeripheralReady(SYSCTL_PERIPH_GPION)) {}
GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_1);
IntMasterEnable();
// Create a single task — just enough to prove the scheduler works
xTaskCreate(HeartbeatTask, "HB", 128, NULL, 1, NULL);
// Start scheduler (never returns)
vTaskStartScheduler();
while (1);
}

Compile and flash the project to your EK-TM4C1294XL board. You should see LED D1 blinking every second. This confirms:

  • The project compiles and links with FreeRTOS
  • The scheduler starts successfully
  • vTaskDelay() works (the LED toggles at a steady 1-second rate)