FreeRTOS on the EK-TM4C123GXL LaunchPad Board

From EdWiki

FreeRTOS on the EK-TM4C123GXL LaunchPad Board

Getting latest FreeRTOS working in CCS under ubuntu, and the GNU GCC compiler that ships with CCS, on a EK-TM4C123GXL Launchpad from ground zero. This getting started guide demonstrates the use of FreeRTOS on the EK-TM4C123GXL LaunchPad Board.

FreeRTOS Demo Application

The application blinks the user-selected LED at a user-selected frequency.

  • To select the LED press the left button
  • To select the frequency press the right button.
  • The UART outputs the application status at 115,200 baud, 8-n-1 mode.

This application utilizes FreeRTOS to perform the tasks in a concurrent fashion.
The following tasks are created:

  • An LED task, which blinks the user-selected on-board LED at a user-selected rate (changed via the buttons).
  • A Switch task, which monitors the buttons pressed and passes the information to LED task.

In addition to the tasks, this application also uses the following FreeRTOS resources:

  • A Queue to enable information transfer between tasks.
  • A Semaphore to guard the resource, UART, from access by multiple tasks at the same time.
  • A non-blocking FreeRTOS Delay to put the tasks in blocked state when they have nothing to do.


Install Code Composer Studio and Tivaware for C Series (Skip this step if you have working CCS6.2.x.x OR CCS7.x.x.x & Tivaware for C Series Installed)

Fetch FreeRTOS Source

Create FreeRTOS CCS Demo Project

With the project created, we are now going to import FreeRTOS Source first.

Right-click on the project (freertos_on_tm4c123) in the "Project Explorer", and make a New folder, Call it "FreeRTOS".

Now we'll import the necessary FreeRTOS (source/header) files into this folder:

Import FreeRTOS Source Files

Next, we will import the FreeRTOS example program, drivers and uartstdio files from Tivaware Examples.

Import Tivaware FreeRTOS Demo Source Files

Create Path/Build variable CCS

With FreeRTOS and tivaware in our project, we need to make sure the C/C++ compiler is configured properly to search the include and portable folders since FreeRTOS (and our project) depend on it.

Configure FreeRTOS Demo Project Include Search Path

There are few GCC options we're going to tune.

Configure FreeRTOS Demo Project GCC Options

FreeRTOS requires the use of several hardware interrupts/peripherals to function, notably the SysTick feature for its RTOS tick and the software interrupt calls SVCall and PendSV for its internal operation. Let's configure these interrupt handlers.

Configure FreeRTOS Demo Project Interrupt Handlers

Link the TivaWare libdriver.a file to FreeRTOS Demo Project

To get FreeRTOS into a state where we can compile it, a FreeRTOSConfig.h file is required and it looks for it. Add this file inside the FreeRTOS/include folder since we have that folder in our include path already:

After inluding FreeRTOS/include/FreeRTOSConfig.h, let's try to build our project:

Build FreeRTOS Demo Project

Now let's make FreeRTOS actually run.

FreeRTOS Demo Project Debug Configuration

Load, Debug, Run - FreeRTOS Demo Project

Demo Project


External Link