Configuring the Trace Recorder

Configuring the SystemView Trace Recorder

Configuration is performed through the addition of the following files:

(1) os_cfg_trace.h

From this file you can enable and disable the recording of the beginning and end of each of the µC/OS-II API function calls. If not enabled, the trace will only have interrupt events and the µC/OS-II scheduler events.

You can also configure the maximum number of tasks and other kernel objects to include in the trace. The code below shows an example:

Listing - os_cfg_trace.h
#define OS_CFG_TRACE_API_ENTER_EN         DEF_ENABLED
#define OS_CFG_TRACE_API_EXIT_EN          DEF_ENABLED
#define OS_CFG_TRACE_MAX_TASK                  32u 
#define OS_CFG_TRACE_MAX_RESOURCES            256u


(2) SEGGER_RTT_Conf.h


From this file you can configure the maximum number of bytes for the ring buffer used to stream the trace data up to the host application running on the PC. Low numbers will result in less data footprint at the expense of possible dropped events due to overflows during the communication. The code below shows an example:

Listing - SEGGER_RTT_Conf.h
#define BUFFER_SIZE_UP                       4096u


The file SEGGER_RTT_Conf.h contains other settings that are beyond the scope of this document. For more information on this configuration file refer to the SEGGER SystemView Documentation .


(3) SEGGER_SYSVIEW_Conf.h

From this file you can configure the maximum number of bytes for the ring buffer used to stream the trace data up to the host application running on the PC. Low numbers will result in less data footprint at the expense of possible dropped events due to overflows during the communication. The code below shows an example:

Listing - SEGGER_SYSVIEW_Conf.h
#define SEGGER_SYSVIEW_RTT_BUFFER_SIZE       4096u


From this file you also get to configure the way the trace recorder will get a system timestamp and the currently active interrupt ID. This file already has that implemented for the ARM Cortex-M and Renesas RX devices. If your device is not an ARM Cortex-M or Renesas RX, then this is the place to configure those two things.


The file SEGGER_SYSVIEW_Conf.h contains other settings that are beyond the scope of this document. For more information on this configuration file refer to the SEGGER SystemView Documentation .

(4) SEGGER_SYSVIEW_Config_uCOSII.c

From this file you can configure the BSP function that returns the system clock in Hertz. For example:

Listing - SEGGER_SYSVIEW_Config_uCOSII.c - System Clock
#define SYSVIEW_TIMESTAMP_FREQ (BSP_ClkFreqGet(BSP_CLK_ID_SYSCLK)) 
#define SYSVIEW_CPU_FREQ       (BSP_ClkFreqGet(BSP_CLK_ID_SYSCLK))


From this file you also get to configure the lowest RAM address where you intend to allocate the Trace buffer. For example:

Listing - SEGGER_SYSVIEW_Config_uCOSII.c - RAM Base Address
#define SYSVIEW_RAM_BASE                  (0x20000000)
And finally, from this file you get to register each of the interrupts you are interested in. By default, the interrupts will be displayed in the Analyzer with their vector number only. So, if you want to specify a name for the interrupts, then you can do so from this file. For example:

Listing - SEGGER_SYSVIEW_Config_uCOSII.c - Interrupt Names
static void _cbSendSystemDesc(void) {
    SEGGER_SYSVIEW_SendSysDesc("N="SYSVIEW_APP_NAME",D="SYSVIEW_DEVICE_NAME",O=uCOS-II");
    SEGGER_SYSVIEW_SendSysDesc("I#15=SysTick ISR");
    SEGGER_SYSVIEW_SendSysDesc("I#77=Ethernet ISR");
    SEGGER_SYSVIEW_SendSysDesc("I#83=USB OTG FS ISR");
    SEGGER_SYSVIEW_SendSysDesc("I#104=LCD TFT ISR");
    //
    SYSVIEW_SendResourceList();
}
The file SEGGER_SYSVIEW_Config_uCOSII.h contains other settings that are beyond the scope of this document. For more information on this configuration file refer to the SEGGER SystemView Documentation.


Next Step

Initializing the Trace Recorder