Debug
ARM DDI 0363G
Copyright © 2006-2011 ARM Limited. All rights reserved.
12-66
ID073015
Non-Confidential
WritePC(state->pc);
// Step 4. Writing the PC corrupts R0 therefore, restore R0 now.
WriteRegister(0, state->r0);
// Step 5. Write the restart request bit in the DBGDRCR.
WriteDebugRegister(36, 1<<1);
// Step 6. Poll the RESTARTED flag in the DBGDSCR.
repeat
{
dscr := ReadDebugRegister(34);
}
until (dscr & (1<<1));
}
12.11.6 Accessing registers and memory in debug state
This section describes the following:
•
Reading and writing registers through the DCC
•
•
Reading the CPSR in debug state
•
Writing the CPSR in debug state
•
•
•
•
Accessing coprocessor registers
Reading and writing registers through the DCC
To read a single register, the debugger can use the sequence that
shows. This
sequence depends on two other sequences,
Executing an ARM instruction through the DBGITR
Target to host data transfer (host end)
Example 12-13 Reading an ARM register
uint32 ReadARMRegister(int Rd)
{
// Step 1. Execute instruction MCR p14, 0, Rd, c0, c5, 0 through the DBGITR.
ExecuteARMInstruction(0xEE (Rd<<12));
// Step 2. Read the register value through DBGDTRTX.
reg_val := ReadDCC();
return reg_val;
}
shows a similar sequence for writing an ARM register.
Example 12-14 Writing an ARM register
WriteRegister(int Rd, uint32 reg_val)
{
// Step 1. Write the register value to DBGDTRRX.
WriteDCC(reg_val);