Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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:

Anchor
Listing - os_cfg_trace.h
Listing - os_cfg_trace.h

Code Block
languagecpp
titleListing - os_cfg_trace.h
linenumberstrue
#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:

Anchor
Listing - SEGGER_RTT_Conf.h
Listing - SEGGER_RTT_Conf.h

Code Block
languagecpp
titleListing - SEGGER_RTT_Conf.h
linenumberstrue
#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:

Anchor
Listing - SEGGER_SYSVIEW_Conf.h
Listing - SEGGER_SYSVIEW_Conf.h

Code Block
languagecpp
titleListing - SEGGER_SYSVIEW_Conf.h
linenumberstrue
#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:

Anchor
Listing - SEGGER_SYSVIEW_Config_uCOSII.c - System Clock
Listing - SEGGER_SYSVIEW_Config_uCOSII.c - System Clock

Code Block
languagecpp
titleListing - SEGGER_SYSVIEW_Config_uCOSII.c - System Clock
linenumberstrue
#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:

Anchor
Listing - SEGGER_SYSVIEW_Config_uCOSII.c - RAM Base Address
Listing - SEGGER_SYSVIEW_Config_uCOSII.c - RAM Base Address

Code Block
languagecpp
titleListing - SEGGER_SYSVIEW_Config_uCOSII.c - RAM Base Address
linenumberstrue
#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:

Anchor
Listing - SEGGER_SYSVIEW_Config_uCOSII.c - Interrupt Names
Listing - SEGGER_SYSVIEW_Config_uCOSII.c - Interrupt Names

Code Block
languagecpp
titleListing - SEGGER_SYSVIEW_Config_uCOSII.c - Interrupt Names
linenumberstrue
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