SPMA085 June 2022 TM4C1230C3PM , TM4C1230C3PM , TM4C1230D5PM , TM4C1230D5PM , TM4C1230E6PM , TM4C1230E6PM , TM4C1230H6PM , TM4C1230H6PM , TM4C1231C3PM , TM4C1231C3PM , TM4C1231D5PM , TM4C1231D5PM , TM4C1231D5PZ , TM4C1231D5PZ , TM4C1231E6PM , TM4C1231E6PM , TM4C1231E6PZ , TM4C1231E6PZ , TM4C1231H6PGE , TM4C1231H6PGE , TM4C1231H6PM , TM4C1231H6PM , TM4C1231H6PZ , TM4C1231H6PZ , TM4C1232C3PM , TM4C1232C3PM , TM4C1232D5PM , TM4C1232D5PM , TM4C1232E6PM , TM4C1232E6PM , TM4C1232H6PM , TM4C1232H6PM , TM4C1233C3PM , TM4C1233C3PM , TM4C1233D5PM , TM4C1233D5PM , TM4C1233D5PZ , TM4C1233D5PZ , TM4C1233E6PM , TM4C1233E6PM , TM4C1233E6PZ , TM4C1233E6PZ , TM4C1233H6PGE , TM4C1233H6PGE , TM4C1233H6PM , TM4C1233H6PM , TM4C1233H6PZ , TM4C1233H6PZ , TM4C1236D5PM , TM4C1236D5PM , TM4C1236E6PM , TM4C1236E6PM , TM4C1236H6PM , TM4C1236H6PM , TM4C1237D5PM , TM4C1237D5PM , TM4C1237D5PZ , TM4C1237D5PZ , TM4C1237E6PM , TM4C1237E6PM , TM4C1237E6PZ , TM4C1237E6PZ , TM4C1237H6PGE , TM4C1237H6PGE , TM4C1237H6PM , TM4C1237H6PM , TM4C1237H6PZ , TM4C1237H6PZ , TM4C123AE6PM , TM4C123AE6PM , TM4C123AH6PM , TM4C123AH6PM , TM4C123BE6PM , TM4C123BE6PM , TM4C123BE6PZ , TM4C123BE6PZ , TM4C123BH6PGE , TM4C123BH6PGE , TM4C123BH6PM , TM4C123BH6PM , TM4C123BH6PZ , TM4C123BH6PZ , TM4C123BH6ZRB , TM4C123BH6ZRB , TM4C123FE6PM , TM4C123FE6PM , TM4C123FH6PM , TM4C123FH6PM , TM4C123GE6PM , TM4C123GE6PM , TM4C123GE6PZ , TM4C123GE6PZ , TM4C123GH6PGE , TM4C123GH6PGE , TM4C123GH6PM , TM4C123GH6PM , TM4C123GH6PZ , TM4C123GH6PZ , TM4C123GH6ZRB , TM4C123GH6ZRB , TM4C123GH6ZXR , TM4C123GH6ZXR , TM4C1290NCPDT , TM4C1290NCPDT , TM4C1290NCZAD , TM4C1290NCZAD , TM4C1292NCPDT , TM4C1292NCPDT , TM4C1292NCZAD , TM4C1292NCZAD , TM4C1294KCPDT , TM4C1294KCPDT , TM4C1294NCPDT , TM4C1294NCPDT , TM4C1294NCZAD , TM4C1294NCZAD , TM4C1297NCZAD , TM4C1297NCZAD , TM4C1299KCZAD , TM4C1299KCZAD , TM4C1299NCZAD , TM4C1299NCZAD , TM4C129CNCPDT , TM4C129CNCPDT , TM4C129CNCZAD , TM4C129CNCZAD , TM4C129DNCPDT , TM4C129DNCPDT , TM4C129DNCZAD , TM4C129DNCZAD , TM4C129EKCPDT , TM4C129EKCPDT , TM4C129ENCPDT , TM4C129ENCPDT , TM4C129ENCZAD , TM4C129ENCZAD , TM4C129LNCZAD , TM4C129LNCZAD , TM4C129XKCZAD , TM4C129XKCZAD , TM4C129XNCZAD , TM4C129XNCZAD
FreeRTOS is a real-time operating system for embedded systems. It has been widely ported to many architecture platforms due to its compact size and being distributed under free open source licensing. This application report will demonstrate how to use the FreeRTOS kernel on the Texas Instruments TM4C family of Arm® Cortex®-M4F microcontrollers. Example projects are provided to demonstrate how to use fundamental FreeRTOS features and how to build basic real-world applications for TM4C's peripherals.
The source code for all example projects discussed in this application report can be downloaded from the following link http://www.ti.com/lit/zip/spma085.
TivaWare™ and Code Composer Studio™ are trademarks of Texas Instruments.
Arm® and Cortex® are registered trademarks of Arm Limited (or its subsidiaries) in the US and/or elsewhere.
All trademarks are the property of their respective owners.
The microcontroller market continues to see a steady increase in the utilization of embedded real-time operating systems (RTOS) to manage applications. The increased focus and need for RTOS solutions has led to a number of open source RTOS offerings including the widely used FreeRTOS. This application report will introduce how to use FreeRTOS with the TM4C Arm Cortex-M4F microcontroller series and provides another supported option for users to select from when choosing an RTOS to use on TM4C devices.
Included with this application report are example projects for both the TM4C123x and the TM4C129x device families. Many of these projects are based on the bare metal examples provided in the TivaWare Software Development Kit (SDK). The TivaWare™ SDK includes Driver Library (DriverLib) APIs for all peripherals that are the building blocks for any application on a TM4C microcontroller. The provided example projects illustrate how to use DriverLib APIs within the FreeRTOS kernel to create simple real-world applications with basic device peripherals. Coverage for additional peripherals is planned for future collateral releases.
The kernel examples are centered on showcasing fundamental RTOS features using the FreeRTOS kernel on TM4C micrcontrollers. These examples keep the usage of TM4C peripherals to a minimum and provide a simple starting point for new users to learn how to use the following key features of the FreeRTOS kernel.
The peripheral examples do not introduce new RTOS concepts but instead extend on those foundations to build basic real-world applications. These examples demonstrate key concepts such as how to plug in hardware interrupts into the kernel and how to minimize overhead when inside a hardware interrupt that is not controlled by the RTOS scheduler. The concepts used in these examples can be adapted to many other peripherals. The peripherals that are demonstrated in this report are as follows with additional peripheral examples planned for future collateral.
The following steps demonstrate how to download the latest version of TivaWare and FreeRTOS:
The FreeRTOS folder from the new download will need to be either moved or copied to the TivaWare library under C:\ti\TivaWare_C_Series-2.2.0.295\third_party. Make sure to first rename or move the existing FreeRTOS folder in the TivaWare library if there is a desire to retain it as a backup as shown in Figure 2-4.
The collateral provided include new hardware driver files that were created to provide a single source for basic pinout configurations for each LaunchPad Evaluation Kit. The files are located under the Driver Files directory. These files are referenced in all examples that use device pins, so this step is required as part of the first time setup.
The rtos_hw_drivers.c and rtos_hw_drivers.h files for each specific LaunchPad should be copied into the TivaWare folders for that LaunchPad under the drivers directory. For EK-TM4C123GXL this path would be TivaWare_C_Series-2.2.0.295\examples\boards\ek-tm4c123gxl\drivers and for EK-TM4C1294XL this path would be TivaWare_C_Series-2.2.0.295\examples\boards\ek-tm4c1294xl\drivers.
The provided example projects are designed with the purpose of offering a compact and streamlined foundation that can be used to begin application development. In order to achieve this, the FreeRTOS kernel is used in conjunction with the TivaWare Driver Library (DriverLib) without any additional abstraction layers added. The configuration and handling of specific peripherals are contained within dedicated task files, which allow for easy re-use across multiple projects.
At this time, POSIX is not included as part of the architecture. The FreeRTOS + POSIX solution currently is a partial implementation that is only offered via GitHub. Details about that offering can be read about at this link.
In addition to DriverLib, TivaWare also includes some utilities to complement specific applications such as outputting UART messages over a terminal or using external memory sources. Be aware that these utilities were created for bare metal applications and may include APIs that were not designed to be thread safe. For the simplicity of demonstrations, there are times certain non-thread safe APIs are used in example projects. These are clearly highlighted as non-thread safe, and they are only used to demonstrate what is being executed as part of the example project. For UART communication, a thread safe UART example is provided which can be used for any application that requires utilizing UART console messaging for either debug purposes or the final product.