FreeRTOS with SystemView

From SEGGER Wiki
Jump to navigation Jump to search

SystemView can be used to record applications which use FreeRTOS V8, V9, V10 or V11. Up until V10, the FreeRTOS source needs to be slightly modified to properly display the execution of the FreeRTOS scheduler. Starting with V11 no changes to the kernel are required.

Independent of the used version, some additional source files need to be added to the project so the application may be recorded by SystemView.

Follow these instructions to configure your system for recording with SystemView.

Supported Software

SystemView has been tested with FreeRTOS V8.2.3, V9.0.0, V10.0.0, V10.4.3 and V11.0.1. Newer versions should work accordingly.

Example Projects

These example packages include the instrumented FreeRTOS code as well as an example project, ready for use with SystemView. The V8 and V9 example projects are created with Embedded Studio and can be used with almost any Cortex-M4 device. The example for V10.4.3 and V11.0.1 are created specifically for the SEGGER Cortex-M Trace Reference Board. So if you want to use these projects on another hardware make sure to port the project accordingly. If you have trouble with your application and SystemView check for differences with the examples. If you need a starting point to create new applications, feel free to base them on the examples.

System Configuration

As reference the project from this article will be used. The configuration process works similarly for all supported FreeRTOS versions.

Note: Up until V10 the kernel needs to be patched, while starting with V11 the instrumentation was added natively. So if you are using FreeRTOS V11 and later you can skipt the section "Patching". Above you can find different example projects.


  1. Get the patch file from the SystemView install directory (in the subdirectory "Src/Sample/*") for your corresponding FreeRTOS version
    • The patch for V10.4 may also be downloaded here
  2. Place it in the FreeRTOS/Source folder in your project
    • For Windows: You may use one of the available 3rd party patching tools, e.g. git or simply a manual patch
    • For Linux: Open the terminal at the location of the patch and call "patch -p1 -r . < FreeRTOS_10_4_3.patch"

Project configuration

  1. Get the required SystemView and RTT source files either
  2. Create a new folder in your project and Embedded Studio project explorer where to place the SystemView sources
    • For the reference example "/lib/SEGGER/SystemView" is used
  3. Add all SystemView Source files and folders to that folder according to the folder structure in SystemView source
  4. Add the same files to the Embedded Studio in the project explorer accordingly
  5. At the end of FreeRTOSConfig.h or before every "FreeRTOS.h" add #include "SEGGER_SYSVIEW_FreeRTOS.h"
  6. Add the include paths for the SystemView sources
    • They may be added using the project options under "Project->Options->Preprocessor->User Include Directories". This assumes that all FreeRTOS include paths are already set. If not, see the referenced Embedded Studio article for more details.
    • "(ProjectDir)/lib/SEGGER/SystemView/SEGGER"
    • "$(ProjectDir)/lib/SEGGER/SystemView/Config"
    • "$(ProjectDir)/lib/SEGGER/SystemView/Sample/FreeRTOS"
  7. In case of using FreeRTOS V10 or older: Add the define "USE_LEGACY_TRACE_API=1"
  8. Add "traceSTART();" to main


  • At the end of FreeRTOSConfig.h or before every FreeRTOS.h add #include "SEGGER_SYSVIEW_FreeRTOS.h"
  • Check if in FreeRTOSConfig.h define INCLUDE_xTaskGetIdleTaskHandle is 1.
  • Check if in FreeRTOSConfig.h define INCLUDE_pxTaskGetStackStart is 1.
  • Unknown task names shown? Simply need to increase the value of SYSVIEW_FREERTOS_MAX_NOF_TASKS until all task names can be resolved. Keep in mind that FreeRTOS creates some tasks on its own so the number will be higher than the number of tasks that you created.
  • Task names truncated? You can set the maximum task name length with config define configMAX_TASK_NAME_LEN.