Event Recorder  Version 1.0.0
MDK Debugger Views for Status and Event Information
 All Files Functions Macros Groups Pages
Theory of Operation

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.

Event id

The Event Data Recording functions get an 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 .. 0xF7 (128 .. 247) MDK middleware components
0xF8 .. 0xFD (248 .. 253) RTOS kernel
0xFE (254) Inter-process communication layer (multiprocessor systems)
0xFF (255) Event Recorder messages

Filtering

The Level and Component Number can be filtered by the Event Recorder to reduce the number of events stored in the circular buffer.

Todo:
Explain how bits in the event filter array refer to event filtering

Time Stamp

Todo:
explain the time stamp generation

API Functions

Todo:
high-level description of API functions
Todo:
should we provide 1-bit for processor (on multi-processor apps) + 1-bit for mode (Thread / Main)?
Todo:
Text below is just a place holder

an 16-bit event ID and a 2-bit event is rhas a event ID is

ISD51 adds a serial interrupt function (the ISD51 Interrupt) for the 8051 UART to your user program. When ISD51 connects to the µVision Debugger, the 8051 enters the ISD51 interrupt function. While program execution is stopped, the 8051 program runs only the ISD51 interrupt function. When the µVision Debugger issues a Go command, the 8051 exits the ISD51 interrupt function and executes the user program.

If no breakpoints are set or if only hardware breakpoints or Flash breakpoints are set, the 8051 executes the user program at full speed. Flash breakpoints are easily configured for many 8051 devices with IAP and Flash block sizes 128 bytes and smaller.

If software breakpoints are set, the 8051 enters the ISD51 interrupt function after each 8051 CPU instruction. The ISD51 interrupt checks to see if the 8051 program reached a breakpoint address and, if so, begins communication with the µVision Debugger. 8051 programs execute considerably slower (about 100x) when software breakpoints are used.

The µVision Debugger sends an 0xA5 character to the ISD51 interrupt function to halt the user program and start communication with the debugger. Therefore, the 8051 program must be started when the µVision Debugger is invoked.

Calls to Event Data Recording functions provide event number, time, and data of such program check points. These Event Data Recording store information in the Event Buffer on the target hardware. Event Data Recording execute fast, can be called from interrupt service

The MDK Debugger reads during program execution the content of this Event Buffer using a standard debug unit (such as ULINK) connect 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.

To display the data stored in the Event Buffer in a human readable way, you need to create a Software Component Viewer Description file. Application Note 283 explains how to create such an XML based description file.

while of debugging at once and has various advantages:

  • Adding RTOS awareness to a development tool does not require complex DLL programming.
  • Users can add code execution visibility to the debug process at little (memory) cost.
  • Saving the event data in local memory ensures fast recording.
  • Collecting the data from the on-chip memory is done using simple read commands. These commands work on all Cortex-M processor based devices and require only JTAG or SWD connectivity to the debug adapter.
  • For ARM Cortex-M3/M4/M7 processor based devices, the Event Recorder is interrupt safe, which means that you can call the event recording functions even from interrupt service routines.
  • Using the Debug Exception and Monitor Control Register (DEMCR) for creating time stamps reduces code overhead (available on ARM Cortex-M3/M4/M7).