B.7.1. ARM and Thumb state breakpoints

Entry to debug state from a breakpointed instruction advances the PC by 16 bytes in ARM state, or 8 bytes in Thumb state. Each instruction executed in debug state advances the PC by one address (4 bytes). The normal way to exit from debug state after a breakpoint is to remove the breakpoint and branch back to the previously breakpointed address.

For example, if the ARM7EJ-S processor entered debug state from a breakpoint set on a given address and two debug speed instructions were executed, a branch of seven addresses must occur (four for debug entry, plus two for the instructions, plus one for the final branch). The following sequence shows ARM instructions scanned into scan chain 1. This is the Most Significant Bit (MSB) first, so the first digit represents the value to be scanned into the SYSSPEED bit, followed by the instruction:

0 EAFFFFF9 ; Branch minus seven addresses (two’s complement)

1 E1A00000 ; NOP (MOV R0, R0), SYSSPEED bit is set

After the ARM7EJ-S processor enters debug state, it must execute a minimum of two instructions before the branch, although these can both be NOPs (MOV R0, R0). For small branches, you can replace the final branch with a subtract, with the PC as the destination (SUB PC, PC, #28 in the above example).

Copyright ©  2001 ARM Limited. All rights reserved.ARM DDI 0214B