Debug in Depth
ARM DDI 0210C
Copyright © 2001, 2004 ARM Limited. All rights reserved.
B-25
The instruction in Example B-1 on page B-24 causes the contents of the registers to
appear on the data bus. You can then sample and shift out these values.
Note
The use of
r0
as the base register for the STM is only for illustration and you can use
any register.
After you have determined the values in the current bank of registers, you might want
to access the banked registers. To do this, you must change mode. Typically, a mode
change can occur only if the core is already in a privileged mode. However, while in
debug state, a mode change from one mode into any other mode can occur. The
debugger must restore the original mode before exiting debug state.
For example, if the debugger has been requested to return the state of the User mode
registers and FIQ mode registers and debug state was entered in Supervisor mode, the
instruction sequence can be as listed in Example B-2.
Example B-2 Determining the state of the User and FIQ mode registers
STM R0, {R0-R15};
Save current registers
MRS R0, CPSR
STR R0, R0;
Save CPSR to determine current mode
BIC R0, 0x1F;
Clear mode bits
ORR R0, 0x10;
Select user mode
MSR CPSR, R0;
Enter USER mode
STM R0, {R13,R14};
Save register not previously visible
ORR R0, 0x01;
Select FIQ mode
MSR CPSR, R0;
Enter FIQ mode
STM R0, {R8-R14};
Save banked FIQ registers
All the instructions shown in Example B-2 execute at debug speed. Debug speed is
much slower than system speed. This is because between each core clock cycle, 33
clock cycles are required to shift in an instruction or shift out data. Executing
instructions this slowly is acceptable for accessing the core state because the
ARM7TDMI core is fully static. However, you cannot use this method for determining
the state of the rest of the system.
While in debug state, only the following instructions can be scanned into the instruction
pipeline for execution:
•
data processing operations
•
load, store, load multiple, and store multiple instructions
•
MSR and MRS.
Summary of Contents for ARM7TDMI
Page 6: ...Contents vi Copyright 2001 2004 ARM Limited All rights reserved ARM DDI 0210C ...
Page 10: ...List of Tables x Copyright 2001 2004 ARM Limited All rights reserved ARM DDI 0210C ...
Page 14: ...List of Figures xiv Copyright 2001 2004 ARM Limited All rights reserved ARM DDI 0210C ...
Page 46: ...Introduction 1 26 Copyright 2001 2004 ARM Limited All rights reserved ARM DDI 0210C ...
Page 120: ...Coprocessor Interface 4 18 Copyright 2001 2004 ARM Limited All rights reserved ARM DDI 0210C ...
Page 142: ...Debug Interface 5 22 Copyright 2001 2004 ARM Limited All rights reserved ARM DDI 0210C ...
Page 282: ...Glossary Glossary 6 Copyright 2001 2004 ARM Limited All rights reserved ARM DDI 0210C ...