App 07
App 07
CortexÒ-M3/M4 Debug
Components Programmer’s
Model
e149
e150 APPENDIX G
31:8 – – – Reserved
7:0 CPICNT R/W – Current CPI counter value.
Increments on the additional
cycles (the first cycle is not
counted) required to execute
all instructions except those
recorded by DWT_LSUCNT.
This counter also increments
on all instruction fetch stalls.
If CPIEVTENA is set, an
event is emitted when the
counter overflows.
31:8 – – – Reserved
7:0 EXCCNT R/W – Current interrupt overhead
counter value. Counts the total
cycles spent in interrupt
processing (for example entry
stacking, return unstacking,
pre-emption). An event is
emitted on counter overflow
(every 256 cycles).
Appendix G e161
31:8 – – – Reserved
7:0 SLEEPCNT R/W – Sleep counter. Counts the
number of cycles during
which the processor is
sleeping. An event is
emitted on counter overflow
(every 256 cycles).
31:8 – – – Reserved
7:0 LSUCNT R/W – LSU counter. This counts the
total number of cycles that the
processor is processing an
LSU operation. The initial
execution cost of the
instruction is not counted. For
example, an LDR that takes
two cycles to complete
increments this counter one
cycle. Equivalently, an LDR
that stalls for two cycles (and
so takes four cycles),
increments this counter three
times. An event is emitted on
counter overflow (every 256
cycles).
31:8 – – – Reserved
7:0 FOLDCNT R/W – This counts the total
number folded instructions.
e162 APPENDIX G
31:4 – – – Reserved
3:0 MASK R/W – Mask on data during
comparison. This is the size
of the ignore mask (aligned to
LSB). 0 ¼ all bits are
compared, 1 ¼ bits 1 to bit 31
are compared, .. and 15 ¼
bit 15 to bit 31 are compared.
Note for DWT FUNCTION register (table G.21) and FUNCTION values (in table G.22):
• Functions 4’b1100 to 4’b1111 are not available in CortexÒ -M3 r0p0 to r1p1
• Data value is only sampled for accesses that do not fault (MPU or bus fault).
The PC is sampled irrespective of any faults. The PC is only sampled for the first
address of a burst.
Appendix G e163
31:25 – – – Reserved
24 MATCHED RO 0 This bit is set when the
comparator matches, and
indicates that the operation
defined by FUNCTION has
occurred since this bit was last
read. This bit is cleared on
read.
23:20 – – – Reserved
19:16 DATAVADDR1 R/W – Identity of a second linked
address comparator for data
value matching when
DATAVMATCH ¼¼ 1 and
LNK1ENA ¼¼ 1.
15:12 DATAVADDR0 R/W – Identity of a linked address
comparator for data value
matching when
DATAVMATCH ¼¼ 1.
11:10 DATAVSIZE R/W – Defines the size of the data in
the COMP register is to be
matched.
00 ¼ byte
01 ¼ half-word
10 ¼ word
11 ¼ Unpredicatable
9 LNK1ENA RO 0 Read only configure
information:
0 ¼ DATAVADDR1 not
supported
1 ¼ DATAVADDR1 supported
8 DATAVMATCH R/W – This bit is only available in
comparator 1. When
DATAVMATCH is set, this
comparator performs data
value compares.
The comparators given by
DATAVADDR0 and
DATAVADDR1 provide the
address for the data
comparison. If DATAVMATCH
is set in DWT_FUNCTION1,
the FUNCTION setting for the
comparators given by
DATAVADDR0 and
(Continued)
e164 APPENDIX G
4’b0000 Disabled
4’b0001 EMITRANGE ¼ 0, sample and emit PC through ITM
EMITRANGE ¼ 1, emit address offset through ITM
4’b0010 EMITRANGE ¼ 0, emit data through ITM on read and write.
EMITRANGE ¼ 1, emit data and address offset through ITM on
read or write.
4’b0011 EMITRANGE ¼ 0, sample PC and data value through ITM on
read or write.
EMITRANGE ¼ 1, emit address offset and data value through
ITM on read or write.
4’b0100 Watchpoint on PC match
4’b0101 Watchpoint on data read
4’b0110 Watchpoint on data write
Appendix G e165
31:4 – – – Reserved
3 PRIVMASK[3] R/W 0 If set to 1, enable
unprivileged code to access
port 24 to 31, and byte 3 of
the ITM Trace Enable
Register
2 PRIVMASK[2] R/W 0 If set to 1, enable
unprivileged code to access
port 16 to 23, and byte 2 of
(Continued)
e168 APPENDIX G
Table G.26 ITM Trace Privileged Register (ITM->TPR, 0xE0000E40, privileged access
only)dCont’d
Table G.27 ITM Trace Control Register (ITM->TCR, 0xE0000E80, privileged access
only)
31:24 – – – Reserved
23 BUSY RO –
22:16 TraceBusID R/W 0 ID used by the Advanced Trace
Bus (ATB) interface
15:12 – – – Reserved
11:10 GTSFREQ R/W 0 Global Timestamp frequency
(available on Cortex-M3 r2p1 or
after, and on Cortex-M4).
00 ¼ Disable global timestamp
01 ¼ Generate timestamp
request when the ITM defect a
change in bit[47:7] of a global
timestamp counter. (Approx
every 128 cycles)
10 ¼ Generate timestamp
request when the ITM defect a
change in bit[47:13] of a global
timestamp counter. (Approx
every 8192 cycles)
11 ¼ Generate timestamp after
every packet if the FIFO is
empty.
Appendix G e169
Table G.27 ITM Trace Control Register (ITM->TCR, 0xE0000E80, privileged access
only)dCont’d
31:1 – – – Reserved
0 ATVALIDM WO – Only use with integration test
(on-chip connectivity test).
Do not use in normal
applications.
When in integration test
mode, i.e., bit 0 of ITM-
>IMCR is set, this bit is used
to control the ATVALIDM
output of the ATB (trace bus)
e170 APPENDIX G
31:1 – – – Reserved
0 ATREADYM RO – Only use with integration test
(on-chip connectivity test).
Do not use in normal
applications.
When in integration test
mode, i.e. bit 0 of ITM-
>IMCR is set, this bit is used
to read the ATREADYM
input of the ATB (trace bus)
31:1 – – – Reserved
0 INTEGRATION R/W 0 Only use with integration
test (on-chip connectivity
test). Do not use in normal
applications.
Set to 1 to enable
integration test mode.
Table G.31 ITM Lock Access Register (ITM->LAR, 0xE0000FB0, privileged access
only)
Table G.32 ITM Lock Status Register (ITM->LSR, 0xE0000FB4, privileged access
only)
31:3 – – – Reserved
2 ByteAcc RO 0 Always 0 to indicate that the
unlocking write has to be
done with word size transfers.
Byte size transfer unlocking
sequence is not supported.
1 Access RO 1 When 1, it indicates that write
access to the component is
blocked.
When 0, it indicates that write
accesses are allowed.
0 Present RO 1 Always 1, indicates that a lock
mechanism is present.
Table G.34 TPIU Support Sync Port Size Register (TPI->SSPSR, 0xE0040000)
Reset
Bits Name Type Value Description
31:4 – – – Reserved
3 4BIT RO – If set to 1, the Trace Port can
operate in 4 bit mode (device-
specific)
2 3BIT RO 0 Always 0 because the Trace
Port cannot run with 3 bit width
1 2BIT RO – If set to 1, the Trace Port can
operate in 2 bit mode (device-
specific)
0 1BIT RO – If set to 1, the Trace Port can
operate in 1 bit mode (device-
specific)
Table G.35 TPIU Current Sync Port Size Register (TPI->CSPSR, 0xE0040004)
Bits Name Type Reset Value Description
31:4 – – – Reserved
3:0 PORTSIZE R/W 1 Port size. It can be one of the
following:
0x8 ¼ 4 bit mode.
0x2 ¼ 2 bit mode.
0x1 ¼ 1 bit mode. Set to 1
when using SWV mode.
31:13 – – – Reserved
12:0 PRESCALER R/W 0 Divisor for Trace Clock is
Prescaler þ 1
e174 APPENDIX G
31:2 – – – Reserved
1:0 PROTOCOL R/W 1 Trace port protocol
00 ¼ Trace port mode
(parallel pins)
01 ¼ Serial Wire Viewer
mode (Manchester).
(default setting)
10 ¼ Serial Wire Viewer
mode (NRZ).
11 ¼ Reserved
Table G.38 TPIU Formatter and Flush Status Register (TPI->FFSR, 0xE0040300)
Bits Name Type Reset Value Description
31:4 – – – Reserved
3 FtNonStop RO 1 Formatter cannot be
stopped.
2 TCPresent RO 0 TRACECTRL pin not present.
1 FtStopped RO 0 Formatter stopped. This is
always 0 because formatter
start stop is not supported.
0 FlInProg RO 0 Flush in progress (Trace bus
buffer flush). The Cortex-M3/
M4 TPIU always output trace
data if a data is in the buffer
and flush control is not
supported.
Table G.39 TPIU Formatter and Flush Control Register (TPI->FFCR, 0xE0040304)
Bits Name Type Reset Value Description
31:9 – – – Reserved
8 TrigIN RO 1 Indicate a trigger on TRIGIN
being asserted
7:2 – – – Reserved
1 EnFCont R/W 1 Formatter enable
0 – – – Reserved
Appendix G e175
31:1 – – – Reserved
0 TRIGGER RO 0 TRIGGER input value
31:30 – – – Reserved
29 ITM ATVALID RO – Value of ATVALID signal on
the ATB (trace bus)
connected to the ITM
28:27 Byte count RO – Number of bytes of ITM trace
data since last read of
Integration ITM Data
Register.
26 ETM ATVALID RO – Value of ATVALID signal on
the ATB (trace bus)
connected to the ETM
25:24 Byte count RO – Number of bytes of ETM
trace data since last read of
Integration ETM Data
Register.
23:16 ETM Data 2 RO – ETM trace data. The TPIU
15:8 ETM Data 1 RO – FIFO discard the data when
7:0 ETM Data 0 RO – this register is read.
31:1 – – – Reserved
0 ATREADY R/W 0 ATREADY output(s) of ATB
interface
e176 APPENDIX G
31:1 – – – Reserved
0 ATVALID RO 0 Read the OR result of
ATVALID from upstream ATB
sources
31:30 – – – Reserved
29 ITM ATVALID RO – Value of ATVALID signal on
the ATB (trace bus)
connected to the ITM
28:27 Byte count RO – Number of bytes of ITM
trace data since last read of
Integration ITM Data
Register.
26 ETM ATVALID RO – Value of ATVALID signal on
the ATB (trace bus)
connected to the ETM
25:24 Byte count RO – Number of bytes of ETM
trace data since last read of
Integration ETM Data
Register.
23:16 ITM Data 2 RO – ITM trace data. The TPIU
15:8 ITM Data 1 RO – FIFO discard the data when
7:0 ITM Data 0 RO – this register is read.
31:1 – – – Reserved
1:0 Mode R/W 0 Only use with integration
test (on-chip connectivity
test). Do not use in normal
applications.
00 ¼ Normal operation
01 ¼ Integration test mode
10 ¼ Integration data test
mode
11 ¼ reserved.
Appendix G e177
31:12 – – – Reserved
11 Asynchronous Serial RO 1 Set to 1, indicates that
Wire Output (NRZ) Asynchronous Serial
Wire Output (NRZ) is
supported.
10 Asynchronous Serial RO 1 Set to 1, indicates that
Wire Output Asynchronous Serial
(Manchester) Wire Output (NRZ) is
supported.
9 Parallel Trace Port mode RO 1 Set to 1, indicates that
Trace Port mode is
supported.
8:6 Minimum buffer size RO 3’b010 Indicate 4 bytes FIFO
5 Asynchronous RO 1 Indicates Trace Port can
TRACECLKIN run asynchronously to
the processor’s clock
4:0 Number of inputs RO 0/1 Number of trace input:
0x0 ¼ 1 input (Cortex-
M3/M4 device without
ETM)
0x1 ¼ 2 inputs (Cortex-
M3/M4 device with ETM)
31:8 – – – Reserved
7:4 SubType RO 1 The Device Type reads as
3:0 Major Type RO 1 0x11 and indicates this
device is a trace sink and
specifically a TPIU
e178 APPENDIX G
31:30 – – 0 Reserved
29 MasterType R/W 1 Controls the HMASTER signal
on the AHB which indicate the
transfer source.
0 ¼ core
1 ¼ debug
This can be overridden by
chip design configuration
(FIXMASTERTYPE signal)
28:26 – – 0 Reserved
25 HPROT R/W 1 AHB HPROT[1]: Privileged (0)
and unprivileged (1) control
24 – – 1 Reserved
23:12 – – 0 Reserved
11:8 Mode R/W 0 Mode of operation bits:
0 ¼ normal download/upload
mode
Other values are reserved.
Appendix G e179