EasyManua.ls Logo

ARM Cortex-R4 - 12.11 Using the debug functionality

Default Icon
436 pages
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-57
ID073015 Non-Confidential
12.11 Using the debug functionality
This section provides some examples of using the processor debug functionality, both from the
point of view of a software engineer writing code to run on an ARM processor and of a
developer creating debug tools for the processor. In the former case, examples are given in ARM
assembly language. In the latter case, the examples are in C pseudo-language, intended to
convey the algorithms to be used. These examples are not intended as source code for a
debugger.
The debugger examples use a pair of pseudo-functions such as the following:
uint32 ReadDebugRegister(int reg_num)
{
// read the value of the debug register reg_num at address reg_num << 2
}
WriteDebugRegister(int reg_num, uint32 val)
{
// write the value val to the debug register reg_num at address reg_num >> 2
}
A basic function for using the debug state is executing an instruction through the DBGITR.
Example 12-1 shows the sequence for executing an ARM instruction through the DBGITR.
Example 12-1 Executing an ARM instruction through the DBGITR
ExecuteARMInstruction(uint32 instr)
{
// Step 1. Poll DBGDSCR until InstrCompl is set.
repeat
{
dscr := ReadDebugRegister(34);
}
until (dscr & (1<<24));
// Step 2. Write the opcode to the DBGITR.
WriteDebugRegister(33, instr);
// Step 3. Poll DBGDSCR until InstrCompl is set.
repeat
{
dscr := ReadDebugRegister(34);
}
until (dscr & (1<<24);
}
This section describes:
Debug communications channel on page 12-58
Programming breakpoints and watchpoints on page 12-60
Single-stepping on page 12-63
Debug state entry on page 12-64
Debug state exit on page 12-65
Accessing registers and memory in debug state on page 12-66
Emulating power down on page 12-74.

Table of Contents

Related product manuals