Chapter 6 S12Z Debug (S12ZDBGV2) Module
S12ZVHY/S12ZVHL Family Reference Manual Rev. 1.05
Freescale Semiconductor
213
6.4.5
Trace Buffer Operation
The trace buffer is a 64 lines deep by 64-bits wide RAM array. If the TSOURCE bit is set the DBG module
can store trace information in the RAM array in a circular buffer format. Data is stored in mode dependent
formats, as described in the following sections. After each trace buffer entry, the counter register
DBGCNT is incremented. Trace buffer rollover is possible when configured for End- or Mid-Aligned
tracing, such that older entries are replaced by newer entries. Tracing of CPU activity is disabled when the
BDC is active.
The RAM array can be accessed through the register DBGTB using 16-bit wide word accesses. After each
read, the internal RAM pointer is incremented so that the next read will receive fresh information. Reading
the trace buffer whilst the DBG is armed returns invalid data and the trace buffer pointer is not
incremented.
In Detail mode the address range for CPU access tracing can be limited to a range specified by the
TRANGE bits in DBGTCRH. This function uses comparators C and D to define an address range inside
which accesses should be traced. Thus traced accesses can be restricted, for example, to particular register
or RAM range accesses.
The external event pin can be configured to force trace buffer entries in Normal or Loop1 trace modes. All
tracing modes support trace buffer gating. In Pure PC and Detail modes external events do not force trace
buffer entries.
If the external event pin is configured to gate trace buffer entries then any trace mode is valid.
6.4.5.1
Trace Trigger Alignment
) it is possible to align the trigger with the end, the middle, or
the beginning of a tracing session.
If End or Mid-Alignment is selected, tracing begins when the ARM bit in DBGC1 is set and State1 is
entered. The transition to Final State if End-Alignment is selected, ends the tracing session. The transition
to Final State if Mid-Alignment is selected signals that another 32 lines are traced before ending the tracing
session. Tracing with Begin-Alignment starts at the trigger and ends when the trace buffer is full.
6.4.5.1.1
Storing with Begin-Alignment
Storing with Begin-Alignment, data is not stored in the trace buffer until the Final State is entered. Once
the trigger condition is met the DBG module remains armed until 64 lines are stored in the trace buffer.
Table 6-46. Tracing Alignment
TALIGN
Tracing Begin
Tracing End
00
On arming
At trigger
01
At trigger
When trace buffer is full
10
On arming
When 32 trace buffer lines have
been filled after trigger
11
Reserved