![]() |
Event Recorder and Component Viewer
Version 1.4.0
MDK Debugger Views for Status and Event Information
|
The following steps enable the MDK debugger views for static information and dynamic events.
For User Code:
For MDK Middleware, Keil RTX5, and FreeRTOS:
The software packs for MDK Middleware, CMSIS, CMSIS-FreeRTOS already contain the relevant *.SCVD files and the related event annotations in the C source code.
To use the Event Recorder in an application, you need to:
For uninterrupted recording of program resets, the RAM for the Event Recorder component should be placed to a memory region that is not cleared (or initialized) by a system restart (reset), and which differs from the RAM area that is used for Flash programming. The memory required for the Event Recorder is calculated with the formula:
In this example we configure 0x800 bytes (as it is easier) which can more than 64 records.
Use either a linker script, or configure this uninitialized RAM in uVision with these steps:
In the Options for Target dialog, on the Utilities tab, click on Settings for "Use Target Driver for Flash Programming". Note the "RAM for Algorithm" area:
In the Options for Target dialog, define a Read/Write memory area that is not initialized and which does not overlap with the area from the first step.
For example, split IRAM1 into two regions. Reduce size of IRAM1 by 0x800 and create an IRAM2 area with start 0x2001F800 and size 0x800. Enable NoInit for this IRAM2 region.
In the Options for Component Class 'Compiler' dialog (opens with right-click on EventRecorder.c in the Project window), on the Memory tab, assign Zero Initialized Data to the IRAM2 region.
To avoid display problems in System Analyzer, set the Time Stamp Clock Frequency [Hz] to the initially expected value:
The Event Recorder timer is a 32-bit counter that can overflow. To avoid overflow problems, send a "heartbeat" event within the limits of this 32-bit counter.
Calculation Example
Assuming that your application is running at 168 MHz, you can calculate the time between two heartbeats like the following:
So you need to generate an event every 25 s. This can be an event with an event ID that you don't need and thus filter from the display in Event Recorder or an event that you use to check if your application is still running.
To to stream dynamic event information, insert calls to the Event Data Recording functions on relevant code locations:
These Event Data Recording functions receive as first parameter an id event identifier used for filtering and displaying. The macro EventID may be used to compose id values to include level
and component
numbers.
Example:
When executing this example in the µVision debugger, use the menu command View - Analysis Windows - Event Recorder to open the Event Recorder window. This should show the following output:
You may create an *.SCVD (Software Component View Description) file to format the event output so that matches the application. The event output is created using the /component_viewer/events.
SCVD file example
In the µVision debugger, this *.SCVD file is specified in the dialog Options for Target -> Debug -> Manage Component Viewer Description Files. Click on Add Component Viewer Description File and add the related .SCVD file.
The Event Recorder displays the events as shown below.
The described groups and events also show up in the filter dialog.
The software packs for MDK Middleware and CMSIS already contain SCVD files that match the related event annotations in the C source code. However, you need to select the right component Variant. For MDK Middleware, you need to select the Debug variants, whereas for Keil RTX5, you need to add the Source variant.
The example below enables event recording for the MDK-Middleware File System component:
The Event Recorder can be used to retarget printf output. This is especially interesting for targets without ITM, such as Cortex-M0/M0+/M23. Steps to enable this:
EventRecorder.h
and call the EventRecorderInitialize()
function in main().Refer to the example Retarget STDOUT via Event Recorder in "I/O Retargeting".
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: