Chapter 6 S12Z Debug (S12ZDBGV2) Module
S12ZVHY/S12ZVHL Family Reference Manual Rev. 1.05
Freescale Semiconductor
215
NOTE
When a CPU indexed jump instruction is executed, the destination address
is stored to the trace buffer on instruction completion, indicating the COF
has taken place. If an interrupt occurs simultaneously then the next
instruction carried out is actually from the interrupt service routine. The
instruction at the destination address of the original program flow gets
executed after the interrupt service routine.
In the following example an IRQ interrupt occurs during execution of the
indexed JMP at address MARK1. The NOP at the destination (SUB_1) is
not executed until after the IRQ service routine but the destination address
is entered into the trace buffer to indicate that the indexed JMP COF has
taken place.
LD X,#SUB_1
MARK1:
JMP
(0,X)
; IRQ interrupt occurs during execution of this
MARK2:
NOP
;
SUB_1:
NOP
; JMP Destination address TRACE BUFFER ENTRY 1
; RTI Destination address TRACE BUFFER ENTRY 3
NOP
;
ADDR1:
DBNE
D0,PART5
; Source address TRACE BUFFER ENTRY 4
IRQ_ISR: LD
D1,#$F0
; IRQ Vector $FFF2 = TRACE BUFFER ENTRY 2
ST D1,VAR_C1
RTI
;
The execution flow taking into account the IRQ is as follows
LD
X,#SUB_1
MARK1:
JMP
(0,X)
;
IRQ_ISR: LD
D1,#$F0
;
ST
D1,VAR_C1
RTI
;
SUB_1:
NOP
NOP
;
ADDR1:
DBNE
D0,PART5
;
The Normal Mode trace buffer format is shown in the following tables. Whilst tracing in Normal or Loop1
modes each array line contains 2 data entries, thus in this case the DBGCNT[0] is incremented after each
separate entry. Information byte bits indicate if an entry is a source, destination or vector address.
The external event input can force trace buffer entries independent of COF occurrences, in which case the
EEVI bit is set and the PC value of the last instruction is stored to the trace buffer. If the external event
coincides with a COF buffer entry a single entry is made with the EEVI bit set.
Normal mode profiling with timestamp is possible when tracing from a single source by setting the
STAMP bit in DBGTCRL. This results in a different format (see
).
Table 6-47. Normal and Loop1 Mode Trace Buffer Format without Timestamp
Mode
8-Byte Wide Trace Buffer Line
7
6
5
4
3
2
1
0