
Debug Interface
ARM7TDMI Data Sheet
ARM DDI 0029E
8-24
O
8.12.3 Watchpoint with another exception
If a watchpointed access simultaneously causes a data abort, ARM7TDMI will enter
debug state in abort mode. Entry into debug is held off until the core has changed into
abort mode, and fetched the instruction from the abort vector.
A similar sequence is followed when an interrupt, or any other exception, occurs
during a watchpointed memory access. ARM7TDMI will enter debug state in the
exception's mode, and so the debugger must check to see whether this happened.
The debugger can deduce whether an exception occurred by looking at the current
and previous mode (in the CPSR and SPSR), and the value of the PC. If an exception
did take place, the user should be given the choice of whether to service the exception
before debugging.
Exiting debug state if an exception occurred is slightly different from the other cases.
Here, entry to debug state causes the PC to be incremented by 3 addresses rather
than 4, and this must be taken into account in the return branch calculation. For
example, suppose that an abort occurred on a watchpointed access and 10
instructions had been executed to determine this. The following sequence could be
used to return to program execution.
0 E1A00000; MOV R0, R0
1 E1A00000; MOV R0, R0
0 EAFFFFF0; B -16
This will force a branch back to the abort vector, causing the instruction at that location
to be refetched and executed. Note that after the abort service routine, the instruction
which caused the abort and watchpoint will be reexecuted. This will cause the
watchpoint to be generated and hence ARM7TDMI will enter debug state again.
8.12.4 Debug request
Entry into debug state via a debug request is similar to a breakpoint. However, unlike
a breakpoint, the last instruction will have completed execution and so must not be
refetched on exit from debug state. Therefore, it can be thought that entry to debug
state adds 3 addresses to the PC, and every instruction executed in debug state
adds 1.
For example, suppose that the user has invoked a debug request, and decides to
return to program execution straight away. The following sequence could be used:
0 E1A00000; MOV R0, R0
1 E1A00000; MOV R0, R0
0 EAFFFFFA; B -6
This restores the PC, and restarts the program from the next instruction.