Debug
ARM DDI 0301H
Copyright © 2004-2009 ARM Limited. All rights reserved.
13-43
ID012310
Non-Confidential, Unrestricted Access
13.12 Debugging in a cached system
Debugging must be non-invasive in a cached system. In processor based systems, you can
preserve the contents of the cache so the state of the target application is not altered, and to
maintain memory coherency during debugging.
To preserve the contents of the level one cache, you can disable the Instruction Cache and Data
Cache line fills so read misses from main memory do not update the caches. You can put the
caches in this mode by programming the operation of the caches during debug using CP14 c10.
See
CP14 c10, Debug State Cache Control Register
on page 13-23. This facility is accessible
from both the core and DBGTAP debugger sides.
In Debug state, the caches behave as follows, for memory coherency purposes:
•
Cache reads behave as for normal operation.
•
Writes are covered in
Data cache writes
.
•
ARMv6 includes CP15 instructions for cleaning and invalidating the cache content, See
c7, Cache operations
on page 3-69. These instructions enable you to reset the processor
memory system to a known safe state, and are accessible from both the core and the
DBGTAP debugger side.
When the processor is in Secure User mode and
SPIDEN
is not asserted, only the User mode
CP15 registers are accessible with the exception of Invalidate Instruction Cache Range and
Flush Entire BTAC that are always accessible in Debug state.
13.12.1 Data cache writes
The problem with Data Cache writes is that, while debugging, you might want to write some
instructions to memory, either some code to be debugged or a BKPT instruction. This poses
coherency issues on the Instruction Cache. In processor based systems, CP14 c10, the Debug
State Cache Control Register, enables you to use the following features:
•
You can put the processor in a state where data writes work as if the cache is enabled and
every region of memory is Write-Through. See
CP14 c10, Debug State Cache Control
Register
on page 13-23.
•
ARMv6 architecture provides CP15 instructions for invalidating the Instruction Cache,
specifically Invalidate Instruction Cache range and Flush Entire Branch Target Address
Cache, that
c7, Cache operations
on page 3-69 describes, to ensure that, after a write,
there are no out-of-date words in the Instruction Cache.