EasyManua.ls Logo

ARM Cortex-R4 - Page 336

Default Icon
436 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Debug
ARM DDI 0363G Copyright © 2006-2011 ARM Limited. All rights reserved. 12-62
ID073015 Non-Confidential
For a simple watchpoint, you can program the settings for the other control bits as Table 12-44
shows:
Example 12-8 shows the code for setting a simple aligned watchpoint.
Example 12-8 Setting a simple aligned watchpoint
SetSimpleAlignedWatchpoint(int watch_num, uint32 address, int size)
{
// Step 1. Disable the watchpoint being set.
WriteDebugRegister(112 + watch_num, 0);
// (Step 2. Write address to the DBGDSWVR, leaving the bottom 3 bits zero.
WriteDebugRegister(96 + watch_num, address & 0xFFFFFF8);
// Step 3. Determine the byte address select value to use.
case (size) of
{
when 1:
byte_address_select := (1 << (address & 7));
when 2:
byte_address_select := (3 << (address & 6));
when 4:
byte_address_select := (15 << (address & 4));
when 8:
byte_address_select := 255;
}
// Step 4. Write the mask and control register to enable the watchpoint.
breakpoint
WriteDebugRegister(112 + watch_num, 23 | (byte_address_select << 5));
}
Setting a simple unaligned watchpoint
Using the byte address select bits, certain unaligned objects up to a doubleword (64 bits) can be
watched in a single watchpoint. However, this cannot cover all cases, and in many cases a
second watchpoint might be required.
Table 12-44 Values to write to DBGWCR for a simple watchpoint
Bits Value to write Description
[31:29]
0b000
Reserved
[28:24]
0b00000
Watchpoint address mask
[23:21]
0b000
Reserved
[20]
0b0
Enable linking
[19:16]
0b0000
Linked BRP number
[15:13]
0b00
Reserved
[12:5] Derived from address Byte address select
[4:3]
0b10
Load/Store access control
[2:1]
0b11
Privileged access control
[0]
0b1
Watchpoint enable

Table of Contents

Related product manuals