Difference between revisions of "FreeRTOS with SystemView"

From SEGGER Wiki
Jump to: navigation, search
(System Configuration)
(Troubleshooting)
Line 47: Line 47:
 
* Check if in FreeRTOSConfig.h define <code>INCLUDE_xTaskGetIdleTaskHandle</code> is 1.
 
* Check if in FreeRTOSConfig.h define <code>INCLUDE_xTaskGetIdleTaskHandle</code> is 1.
 
* Check if in FreeRTOSConfig.h define <code>INCLUDE_pxTaskGetStackStart</code> is 1.
 
* Check if in FreeRTOSConfig.h define <code>INCLUDE_pxTaskGetStackStart</code> 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.
   
 
[[Category:SystemView]]
 
[[Category:SystemView]]

Revision as of 11:16, 16 November 2022

SystemView can be used to record applications which use FreeRTOS V8, V9 or V10. To properly display execution of the FreeRTOS scheduler, the FreeRTOS source needs to be slightly modified. Follow these instructions to configure your system for recording with SystemView.

Supported Software

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

Example Projects

These example packages include the modified 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. is created specifically for the SEGGER Cortex-M Trace Reference Board. So if you want to use that project 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 and patching process should work for all supported FreeRTOS versions similarly. Above you can find different example projects. The example project referenced below is the one for FreeRTOS V10.4.3.

The patch files and SystemView source for FreeRTOS V10.4 or later can be found here: FreeRTOSV10.4.zip

  1. Get the patch file from the SystemView install folder (or the link above) for your corresponding FreeRTOS version and place it in the FreeRTOS/Source folder in your project.
  2. Apply the patch either with a patch tool or manually.
    1. On Linux there is a native patch tool: open terminal in the folder the patch is located at and call: patch -p1 -r . < FreeRTOS_10_4_3.patch
    2. On windows use one of the available 3rd party patching tools e.g. git or do a manual patch.
  3. Create a new folder in your project and Embedded Studio project explorer where to place the SystemView sources at. For the referenced example /lib/SEGGER/SystemView is used.
  4. Add all SystemView Source files and folders to that folder according to the folder structure in SystemView source.
  5. Add the same files to the Embedded Studio in the project explorer accordingly.
  6. At the end of FreeRTOSConfig.h or before every FreeRTOS.h add #include "SEGGER_SYSVIEW_FreeRTOS.h"
  7. Add additional include paths for SystemView sources. You can add this in 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.
    1. (ProjectDir)/lib/SEGGER/SystemView/SEGGER
    2. $(ProjectDir)/lib/SEGGER/SystemView/Config
    3. $(ProjectDir)/lib/SEGGER/SystemView/Sample/FreeRTOS
  8. Add traceSTART(); to main

Troubleshooting

  • 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.