
Debug Support
8-30
Copyright 1999, 2000 ARM Limited. All rights reserved.
ARM DDI 0144B
After determining the values in the current bank of registers, you might want to access
banked registers. This can only be done by changing mode. Normally, a mode change
can only occur if the core is already in a privileged mode. However, while in debug
state, a mode change from any mode into any other mode might occur.
Note
The debugger must restore the original mode before exiting debug state.
For example, assume that the debugger has been asked to return the state of the User
mode and FIQ mode registers, and debug state has been entered from supervisor mode.
The instruction sequence might be:
STMIA r0, {r0-r15}
MRS
r0, CPSR
STR
r0, {r0}
BIC
r0,r0, #0x1F
ORR
r0,r0, #0x10
MSR
CPSR_c, r0
STMIA r0, {r13-r14}
ORR
r0,r0, #0x01
MSR
CPSR_c, r0
STMIA r0, {r8-r14}
; Save current registers
; Save CPSR to determine current mode
; Clear mode bits
; Select USER mode
; Enter USER mode
; Save registers not previously visible
; Select FIQ mode
; Enter FIQ mode
; Save banked FIQ registers
All these instructions are said to execute at debug speed. Debug speed is much slower
than system speed. This is because 67 scan clocks occur between each core clock to
shift an instruction in, or shift data out. Executing instructions at debug speed presents
no problems for accessing the core state because the ARM9TDMI core is fully static.
However, this method cannot be used for determining the state of the rest of the system.
While in debug state, you can only insert the following instructions into the instruction
pipeline for execution:
all data processing operations
all load, store, load multiple and store multiple instructions
MSR
and
MRS
.
8.8.2
Determining system state
To meet the dynamic timing requirements of the memory system, any attempt to access
system state must occur synchronously. Therefore, the ARM9TDMI core must be
forced to synchronize back to system speed. The 33rd bit of scan chain 1, SYSSPEED,
controls this.