RTOS Trace


FreeRTOS trace is a third party library developed by Percepio; please check them out here. What you can do is to capture the RTOS trace on the micro-sd card on your SJ2 board which you can later plot out to be able to visualize everything that the RTOS is trying to do.



To get started, you first need to install a Windows trace file viewer. This will open up the trace file saved by the SJ2 board for you to visualize all of the data. You can evaluate the product or get student license for free. Please proceed by visiting the following link:




Now that you have installed the Percepio Trace, it is time to configure the SJ2 software to generate the trace. This is super easy to do:

  1. First, make sure you have a micro SD card installed on the SJ2 board and formatted in FAT32 format
  2. Go to FreeRTOSConfig.h and change this macro #define configENABLE_TRACE_ON_SD_CARD 0

That is pretty much it... you can now compile, and flash the new application and the software will save a file called trace.psf onto the SD card's file system. If you do not see the SD Card blinky light a few times each second, you have likely not loaded the correct application onto the board.



FreeRTOS Trace can be enabled at FreeRTOS_config.h You can open up an example trace from this Gitlab link which has a pre-existing RTOS trace file generated by the SJ2 board.

There is no general need on how to use the API on the SJ2 board related to the RTOS trace, and the bulk of the "usage" is actually opening up the trace file in Percepio Tracalyzer program. The one thing you could do is "printf" trace data that can be visualized in the trace.

void trace_print(void) {
  traceString trace_channel = xTraceRegisterString("trace channel description");
  vTracePrintF(trace_channel, "%d: %d", 1, 234);


Revision #2
Created 4 years ago by Preet Kang
Updated 3 years ago by Preet Kang