
Debug Interface
ARM7TDMI Data Sheet
ARM DDI 0029E
8-19
O
8.10.2 Clock switch during test
When under serial test conditions—ie when test patterns are being applied to the
ARM7TM core through the JTAG interface—ARM7TDMI must be clocked using
DCLK
. Entry into test is less automatic than debug and some care must be taken.
On the way into test,
MCLK
must be held LOW. The TAP controller can now be used
to serially test ARM7TDMI. If scan chain 0 and
INTEST
are selected,
DCLK
is
generated while the state machine is in the RUN-TEST/IDLE state. During EXTEST,
DCLK
is not generated.
On exit from test, BYPASS must be selected as the TAP controller instruction. When
this is done,
MCLK
can be allowed to resume. After INTEST testing, care should be
taken to ensure that the core is in a sensible state before switching back. The safest
way to do this is to either select BYPASS and then cause a system reset, or to insert
MOV PC, #0 into the instruction pipeline before switching back.
8.11 Determining the Core and System State
When ARM7TDMI is in debug state, the core and system’s state may be examined.
This is done by forcing load and store multiples into the instruction pipeline.
Before the core and system state can be examined, the debugger must first determine
whether the processor was in THUMB or ARM state when it entered debug. This is
achieved by examining bit 4 of ICEbreaker’s Debug Status Register. If this is HIGH,
the core was in THUMB state when it entered debug.
8.11.1 Determining the core’s state
If the processor has entered debug state from THUMB state, the simplest course of
action is for the debugger to force the core back into ARM state. Once this is done, the
debugger can always execute the same sequence of instructions to determine the
processor's state.
To force the processor into ARM state, the following sequence of THUMB instructions
should be executed on the core:
STR R0, [R0]
MOV R0, PC
STR R0, [R0]
BX
PC
MOV R8, R8
MOV R8, R8
; Save R0 before use
; Copy PC into R0
; Now save the PC in R0
; Jump into ARM state
; NOP
; NOP
Note
Since all THUMB instructions are only 16 bits long, the simplest course of action when
shifting them into Scan Chain 1 is to repeat the instruction twice. For example, the
encoding for
BX R0
is 0x4700. Thus if 0x47004700 is shifted into scan chain 1, the
debugger does not have to keep track of which half of the bus the processor expects
to read the data from.