09.12.2012 Views

Cortex-A8 Technical Reference Manual - ARM Information Center

Cortex-A8 Technical Reference Manual - ARM Information Center

Cortex-A8 Technical Reference Manual - ARM Information Center

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

}<br />

// Step 9. Check for aborts.<br />

aborted := CheckForAborts();<br />

// Step 10. Read the final word from the DCC.<br />

if (!aborted) *data := ReadDCC();<br />

// Step 11. Restore the corrupted register r0.<br />

WriteRegister(0, saved_r0);<br />

Example 12-26 shows the sequence for writing a block of words to memory.<br />

Debug<br />

Example 12-26 Writing a block of words to memory (fast download)<br />

WriteWords(uint32 address, bool &aborted, uint32 *data, int nwords)<br />

{<br />

// Step 1. Save the value of r0.<br />

saved_r0 := ReadRegister(0);<br />

// Step 2. Write the value 2'b10 to DSCR[21:20] for fast mode.<br />

SetDTRAccessMode(2b10);<br />

// Step 3. Write the opcode for MCR p14, 0, r0, c5, c0 to the ITR.<br />

// Write stalls until the ITR is ready but the instruction is not issued.<br />

WriteDebugRegister(33, 0xEE000E15);<br />

// Step 4. Write the address to read from to the DTRRX<br />

// Write stalls until the ITR is ready, but the instruction is not reissued.<br />

WriteDebugRegister(33, address);<br />

// Step 5. Write the opcode for STC p14, c5, [r0], 4 to the ITR.<br />

// Write stalls until the ITR is ready but the instruction is not issued.<br />

WriteDebugRegister(33, 0xED803E00);<br />

// Step 6. Loop writing the data.<br />

// Each time a word is written to the DTR, the instruction is reissued.<br />

while (nwords > 0)<br />

{<br />

WriteDebugRegister(35, *data++);<br />

--nwords;<br />

}<br />

// Step 7. Write the value 2'b00 to DSCR[21:20] for normal mode.<br />

SetDTRAccessMode(2'b00);<br />

// Step 8. Restore the corrupted register r0.<br />

WriteRegister(0, saved_r0);<br />

// Step 9. Check the DSCR for a sticky abort.<br />

aborted := CheckForAborts();<br />

}<br />

Note<br />

As the amount of data transferred increases, these functions reach an optimum performance of<br />

one debug register access per data word transferred.<br />

Accessing secure and nonsecure coprocessor registers<br />

The sequence for accessing coprocessor registers is the same as for the PC and CPSR. That is,<br />

you must first execute an instruction to transfer the register to an <strong>ARM</strong> register, then read the<br />

value back through the DTR.<br />

Example 12-27 on page 12-85 shows the sequence for reading a coprocessor register.<br />

<strong>ARM</strong> DDI 0344K Copyright © 2006-2010 <strong>ARM</strong> Limited. All rights reserved. 12-84<br />

ID060510 Non-Confidential

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!