![]() |
Event Recorder
Version 1.0.1
MDK Debugger Views for Status and Event Information
|
A Software Component Viewer Description (*.SCVD) file in SCVD File Format (XML) defines the content that is displayed in the Component Viewer and Event Recorder.
The debugger can load multiple *.SCVD files as typically each software component has an individual description file.
The Component Viewer reads specific memory locations from the target hardware using a standard debug unit (for example a ULINK debug adapter) that is connected via JTAG or SWD to the CoreSight Debug Access Port (DAP). The address of these memory locations is typically defined by symbols that represent variables, arrays, or starting point of linked lists. The *.SCVD file specifies these symbols and customizes the formatting in the Component Viewer window of the debugger.
Benefits of the Event Recorder:
The software component Event Recorder provides an API (function calls) for event annotations in the application code or software component libraries. These API functions record event timing and data information while the program is executing. The Event Filter which is controlled from the target application or the debugger allows to specify the event ids that are stored in the event buffer that is located in the memory of the target system. This event buffer may be continuously read by the debug unit and displayed in the Event Recorder window of the debugger.
During program execution, the debugger reads the content of the event buffer using a standard debug unit (for example a ULINK debug adapter) that is connected via JTAG or SWD to the CoreSight Debug Access Port (DAP). The Event Recorder requires no trace hardware and can be therefore used on any Cortex-M processor.
Using Event Recorder explains formatting in the Event Recorder debug window of the event data information that is obtained via event annotations in the user application.
Benefits of the Event Recorder:
The following sections describe:
This section describes how the Event Recorder collects event data, generates time stamps, and transfers this information via a debug unit to a host computer.
The Event Recorder is implemented in the target application using the software component :Compiler:Event Recorder which adds the source file EventRecorder.c to the application. Each event is stored in a 16-byte structure that is composed of a 16-bit id, 32-bit time stamp, two 32-bit data values and consistency check values.
To store these events, a circular buffer is provided that can store a minimum of 8 events. The size of this circular buffer is configurable with the #define EVENT_RECORD_COUNT.
The Event Data Recording functions get a parameter id that is composed of level, component number, and message number as shown below:
id | bits | Description |
---|---|---|
message number | 0..7 | identifies the event message information of the software component |
component number | 8..15 | identifies the software component (also used for filtering, see table below) |
level | 16..17 | specifies the class of the message for filtering (see table below) |
— (reserved) | 18..31 | set to 0 |
The level specifies the category of the event message and can be used for filtering:
level | Message relates to ... |
---|---|
EventLevelError = 0 | Run-time error |
EventLevelAPI = 1 | API function call |
EventLevelOp = 2 | Internal operation |
EventLevelDetail = 3 | Additional detailed information of operations |
The component number specifies the software component that the event message belongs to and can be also used for filtering:
component number | Relation to software components |
---|---|
0x0 .. 0x3F (0 .. 63) | software components of the user application |
0x40 .. 0x7F (64 .. 127) | third party middleware components |
0x80 .. 0xEF (128 .. 239) | MDK middleware components |
0xF0 .. 0xFC (240 .. 253) | RTOS kernel |
0xFD (253) | Inter-process communication layer (multiprocessor systems) |
0xFE (254) | printf-style debug outputs |
0xFF (255) | Event Recorder messages |
Filtering for events reduces the amount of data transmitted from the target to the debugger. To filter for events, use the button Configure Target Event Recording:
A new window opens up that lets you filter for events that you are interested in:
Using the Component Viewer does not require any additional configuration.
Selecting the software component Compiler:I/O:Event Recorder to a project will add the file EventRecorderConf.h that is used to define the configuration parameters of the Event Recorder. It uses Configuration Wizard Annotations that show a graphical representation of the settings in MDK:
Option | #define | Description |
---|---|---|
Number of Records | EVENT_RECORD_COUNT | Specifies the number or records stored in the Event Record Buffer. Each record is 16 bytes. |
Time Stamp Source | EVENT_TIMESTAMP_SOURCE | Specifies the timer that is used as time base. Refer to Time stamp source below for more information. |
SysTick Configuration | If the SysTick timer is used as time stamp source the following setting are relevant. | |
SysTick Input Clock Frequency [Hz] | SYSTICK_CLOCK | Defines SysTick input clock that is typical identical with processor clock. |
SysTick Interrupt period [us] | SYSTICK_PERIOD_US | Defines time period of the SysTick timer interrupt. |
The following time stamp sources can be set:
Source | Description |
---|---|
DWT Cycle Counter | Default setting. The DWT cycle counter is part of that CoreSight debug interface. It is neither available in Cortex-M0/M0+ nor in simulation. |
SysTick | System tick timer is available on all Cortex-M processors. But in power-down modes it might be disabled. |
User Timer (Normal Reset) | User-defined timer that is reset by a system reset. |
User Timer (Power-On Reset) | User-defined timer which is only reset during a power-on reset. |
First make sure the Time Stamp Source is set to SysTick. If your clock is 168 MHz, set the SysTick Input Clock Frequency to 168,000,000. The period only plays a minor role as the Event Recorder does only rely on the timer counter. Selecting 1000 us is a safe option that allows the Event Recorder configuration to calculate a valid reload value.
In the EventRecorder.c source code file, the time stamp functions EventRecorderTimerInit and EventRecorderTimerGet are defined as __WEAK
. Override them in your application when using a User Timer. If your timer peripheral is reset by a hardware reset, please select the option "User Timer (Normal Reset)". If your timer peripheral is only reset after a power-on reset, please select the option "User Timer (Power-On Reset)".
As the DWT Cycle Counter is not available in simulation, you can specify an alternative in a simulation initialization file, for example Debug_Sim.ini:
Refer to the MyComponent SCVD Example to see how it is used in a µVision project.
Technical data of Event Recorder firmware
Target: Cortex-M3 using DWT cycle counter as timer
Parameter | ARMCC V5.06 | ARMCC V5.06 | ARMCC V6.6 | ARMCC V6.6 |
---|---|---|---|---|
Compiler options | -O3 | -O3 -Otime | -Os | -O3 |
ROM size | 1276 bytes | 1966 bytes | 1422 bytes | 2022 bytes |
RAM size @8 records (min) | 288 bytes | 288 bytes | 288 bytes | 288 bytes |
RAM size @64 records (default) | 1184 bytes | 1184 bytes | 1184 bytes | 1184 bytes |
EventRecord2 (id+8bytes) | 208 cycles | 172 cycles | 184 cycles | 171 cycles |
EventRecord4 (id+16bytes) | 376 cycles | 306 cycles | 317 cycles | 303 cycles |
EventRecordData (id+8bytes) | 297 cycles | 253 cycles | 264 cycles | 245 cycles |
EventRecordData (id+16bytes) | 470 cycles | 396 cycles | 393 cycles | 385 cycles |
EventRecordData (id+24bytes) | 610 cycles | 513 cycles | 505 cycles | 496 cycles |
EventRecordData (id+32bytes) | 743 cycles | 645 cycles | 623 cycles | 619 cycles |
Individual ROM size for Event Recorder instrumentation functions for inlining: