ARM Technical Support Knowledge Articles

Detecting data accesses or accesses to a range of addresses with AXD and Multi-ICE

Applies to: ARM Developer Suite (ADS), Multi-ICE

Answer

Most ARM cores include special hardware resources intended for software debugging in a block called Embedded-ICE logic. These resources are normally used automatically by the debugger during a debug session.

The Embedded-ICE logic contains two or more watchpoint units. Each watchpoint unit compares the core's address, data and control buses with the values programmed in its internal registers: when they are the same, the watchpoint unit stops the core and makes it enter debug state.

AXD and Multi-ICE use the core's watchpoint units to set:

  • Breakpoints: the core stops before executing an instruction
  • Watchpoints: the core stops straight after writing to an address in memory

This functionality is enough to debug most programs, but AXD also lets you program the watchpoint units manually, so you can set other types of breakpoints such as:

  • Breakpoint in a range of addresses
  • Watchpoint in a memory read
  • Watchpoint when writing a certain value to a specific location

The Embedded-ICE logic registers, including the watchpoint units, can be accessed in AXD in the register window and from the command line interface (CLI)

In order to program breakpoints manually you require at least one free watchpoint unit. A good way to ensure that a watchpoint unit is free is to:

1) Check that you have no breakpoints set, not even a breakpoint on main().
Use "Execute->Delete All Breakpoints".

2) Then ensure vector catching is disabled with the CLI command:
spp vector_catch 0

If you are not using semihosting, you could also disable that with:
spp semihosting_enabled 0
which frees up the other watchpoint unit too.

3) Now check that the watchpoint unit is free:
Look in the register window and expand "EICE Watch n". The 'E' flag of the control register indicates if the unit is enabled ('E') or disabled ('e').

Information about the debug resources of each core and how to program the watchpoint units is available in its Technical Reference Manual (TRM).

For example, if you want to detect any read from a particular address, you should perform the following:

1) Specify the address to monitor in 'Address Value'.
2) Set the 'Address Mask' and 'Data Value' to 0
3) Set the 'Data Mask' to 0xFFFFFFFF, so that all data bits are ignored
4) Set the 'Control Value' to 'Read D Word', and enable the watchpoint unit, by setting bit 8 ('E')
5) Set the 'Control Mask' to '0xF9'

You can now run your code, and program execution will be stop on the next instruction after the data read was performed.

This setup procedure may be automated by using a scriptfile containing, for example:

spp vector_catch 0
spp semihosting_enabled 0
sreg "EICE Watch 0|Address Value" 0x0000F418
sreg "EICE Watch 0|Address Mask" 0
sreg "EICE Watch 0|Data Value" 0
sreg "EICE Watch 0|Data Mask" 0xFFFFFFFF
sreg "EICE Watch 0|Control Value" 0x10C
sreg "EICE Watch 0|Control Mask" 0x0F9

Article last edited on: 2008-09-09 15:47:28

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential