Configuring TraceAlyzer (Snapshot Mode)

Configuring the TraceAlyzer Snapshot Recorder

Configuration is performed through the addition of the following files:

(1) os_cfg_trace.c/h

These files are used to configure the optional triggering mechanism via µC/Probe. This module basically allows you to start a trace recording if the condition of user-defined trigger points in your code are met. From µC/Probe you can arm the trigger conditions and then µC/Probe will show you when recordings are ready for analysis.

The code listing below shows you an example of configuring a trigger point when a button on the board is pressed:

os_cfg_trace.h
#define  OS_CFG_TRACE_TRIG_MAX_TRIGS             16u
#define  OS_CFG_TRACE_TRIG_NAME_LEN              32u
 
#define  OS_CFG_TRACE_TRIG_TASK_STK_SIZE        128u
#define  OS_CFG_TRACE_TRIG_TASK_PRIO             20u
 
#define  OS_CFG_TRACE_TRIG_ID_SW1              1234u
  
const  OS_TRACE_TRIG_CFG_TBL  OSTraceCfgTrigTbl[] =
{
    {OS_CFG_TRACE_TRIG_ID_SW1, "Task # 1 (SWITCH 1)", 3}
};

(2) trcConfig.h

From this file you can configure the name of the embedded target device by setting the macro SELECTED_PORT. You can also configure the way the recorder behaves when the recording buffer gets full (e.g. TRACE_STORE_MODE_RING_BUFFER or TRACE_STORE_MODE_STOP_WHEN_FULL). At the same time, from this file you can configure the maximum number of events in the buffer and the maximum number of kernel objects to trace. The code listing below shows an example:

trcConfig.h
#define SELECTED_PORT                     PORT_ARM_CortexM

#define TRACE_RECORDER_STORE_MODE   TRACE_STORE_MODE_STOP_WHEN_FULL
 
#define EVENT_BUFFER_SIZE                      1000
 
#define NTask                                    32
#define NISR                                      8
#define NQueue                                   32
#define NSemaphore                               64
#define NMutex                                    8
#define NFlag                                     2
#define NMem                                      2

Note: Setting SELECTED_PORT is very important. The options include the following:


  • PORT_Atmel_AT91SAM7
  • PORT_Atmel_UC3A0
  • PORT_ARM_CortexM
  • PORT_ARM_CortexM_SysTick
  • PORT_Renesas_RX600
  • PORT_Microchip_dsPIC_AND_PIC24
  • PORT_TEXAS_INSTRUMENTS_TMS570
  • PORT_TEXAS_INSTRUMENTS_MSP430
  • PORT_MICROCHIP_PIC32MX
  • PORT_XILINX_PPC405
  • PORT_XILINX_PPC440
  • PORT_XILINX_MICROBLAZE
  • PORT_NXP_LPC210X
  • PORT_MICROCHIP_PIC32MZ
  • PORT_ARM_CORTEX_A9
  • PORT_ARM_CORTEX_M0

(3) trcKernelPort.h

In this file you need to verify that the macro to obtain the system clock frequency in Hertz exists in your project. It is usually a function that is part of your BSP. The code listing below shows an example:

trcKernelPort.h
#define TRACE_CPU_CLOCK_HZ           BSP_ClkFreqGet(BSP_CLK_ID_HCLK)
#define TRACE_PERIPHERAL_CLOCK_HZ    BSP_ClkFreqGet(BSP_CLK_ID_HCLK)

Next Step

Initializing TraceAlyzer (Snapshot Mode)