15.5.3. Exception tracing

To trace exceptions, an optional field is added to a branch packet. This extra field specifies the exception information. A normal branch packet is encoded in 1-5 bytes of trace data, while the exception branch is as follows:

The exception mapping is designed to enable the most frequent exceptions to be encoded within one byte. The ETM exception tracing mapping is described in Table 15.8.

Table 15.8. Exception tracing mapping

Number of bytesExceptionETMINTNUMTraced value
1 byte exceptionNone-0
1 byte exceptionIRQ1171
1 byte exceptionIRQ2182
1 byte exceptionIRQ3193
1 byte exceptionIRQ4204
1 byte exceptionIRQ5215
1 byte exceptionIRQ6226
1 byte exceptionIRQ7237
1 byte exceptionIRQ0168
1 byte exceptionUsage Fault69
1 byte exceptionNMI210
1 byte exceptionSVC1111
1 byte exceptionDebugMon1212
1 byte exceptionMemManage413
1 byte exceptionPendSV1414
1 byte exceptionSysTick1515
2 bytes exceptionReserved816
2 bytes exceptionReset017
2 bytes exceptionReserved1018
2 bytes exceptionHardFault319
2 bytes exceptionReserved920
2 bytes exceptionBusFault521
2 bytes exceptionReserved722
2 bytes exceptionReserved1323
2 bytes exceptionIRQ82424
2 bytes exceptionIRQ92525
2 bytes exceptionIRQ102626
2 bytes exceptionIRQ239512512

Figure 15.3 shows the full branch with exception packet.

Figure 15.3. Exception encoding for branch packet

The final address byte uses bits [7:6] set to 0b01 to indicate the end of the address field. Exception data follows this field. Exception byte 0 sets bit [7] to 1 if a second exception byte follows. If there is no exception present, and only address bits [6:1] change, then a single byte is used. If an exception is present, then at least two bytes signal the address.

When turning off trace immediately before entry to an exception handler, the ETM remains enabled until the exception is taken. This enables it to trace the branch address, exception type and resume information.

Copyright © 2005, 2006 ARM Limited. All rights reserved.ARM DDI 0337E