Debug in Depth
B-24
Copyright © 2001, 2004 ARM Limited. All rights reserved.
ARM DDI 0210C
B.8
Determining the core and system state in debug state
When the ARM7TDMI core is in debug state, you examine the core and system state
by forcing the load and store multiples into the instruction pipeline.
Before you can examine the core and system state, the debugger must determine if the
processor entered debug from Thumb state or ARM state, by examining bit [4] of the
EmbeddedICE-RT debug status register. When bit [4] is HIGH, the core has entered
debug from Thumb state, when bit [4] is LOW, the core has entered debug entered from
ARM state.
B.8.1
Determining the core state
When 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. The debugger can then
repeat the same sequence of instructions to determine the processor state.
To force the processor into ARM state while in debug, execute the following sequence
of Thumb instructions on the core:
STR R0, [R0]; Save R0 before use
MOV R0, PC
; Copy PC into R0
STR R0, [R0]; Now save the PC in R0
BX
PC
; Jump into ARM state
MOV R8, R8
; NOP
MOV R8, R8
; NOP
Note
Because all Thumb instructions are only 16 bits long, the simplest course of action,
when shifting scan chain 1, is to repeat the instruction. For example, the encoding for
BX R0
is
0x4700
, so when
0x47004700
shifts into scan chain 1, the debugger does not have
to keep track of the half of the bus on which the processor expects to read the data.
You can use the sequences of ARM instructions in Example B-1 and Example B-2 on
page B-25 to determine the state of the processor.
With the processor in the ARM state, the instruction to execute is shown in
Example B-1.
Example B-1 Instruction to determine core state
STM R0, {R0-R15}
Содержание ARM7TDMI
Страница 6: ...Contents vi Copyright 2001 2004 ARM Limited All rights reserved ARM DDI 0210C ...
Страница 10: ...List of Tables x Copyright 2001 2004 ARM Limited All rights reserved ARM DDI 0210C ...
Страница 14: ...List of Figures xiv Copyright 2001 2004 ARM Limited All rights reserved ARM DDI 0210C ...
Страница 46: ...Introduction 1 26 Copyright 2001 2004 ARM Limited All rights reserved ARM DDI 0210C ...
Страница 120: ...Coprocessor Interface 4 18 Copyright 2001 2004 ARM Limited All rights reserved ARM DDI 0210C ...
Страница 142: ...Debug Interface 5 22 Copyright 2001 2004 ARM Limited All rights reserved ARM DDI 0210C ...
Страница 276: ...Differences Between Rev 3a and Rev 4 C 6 Copyright 2001 2004 ARM Limited All rights reserved ARM DDI 0210C ...
Страница 282: ...Glossary Glossary 6 Copyright 2001 2004 ARM Limited All rights reserved ARM DDI 0210C ...