7.3.2. Target to debugger communication

This is the sequence of events for an application running on the ARM core to communicate with a debugger running on the host:

  1. The target application verifies that the DCC write register is free for use. It does this using the MRC instruction to read the debug communications channel control register to check that the W bit is clear.

  2. If the W bit is clear, the comms data write register is clear and the application writes a word to it using an MCR instruction to coprocessor 14. The action of writing to the register automatically sets the W bit. If the W bit is set, the debugger has not emptied the comms data write register. If the application has to send another word, it must poll the W bit until it is clear.

  3. The debugger polls the comms data control register through scan chain 2. If the debugger sees that the W bit is set, it can read the DCC data register to read the message sent by the application. The process of reading the data automatically clears the W bit in the comms data control register.

Example 7.1 shows how this works. The example code is available in the main examples directory, in ...\dcc\outchan.s.

Example 7.1. 

     AREA  OutChannel, CODE, READONLY
     MOV   r1,#3          ; Number of words to send
     ADR   r2, outdata    ; Address of data to send
     MRC   p14,0,r0,c0,c0 ; Read control register
     TST   r0, #2
     BNE   pollout        ; if W set, register still full
     LDR   r3,[r2],#4     ; Read word from outdata
                          ; into r3 and update the pointer
     MCR   p14,0,r3,c1,c0 ; Write word from r3
     SUBS  r1,r1,#1       ; Update counter
     BNE   pollout        ; Loop if more words to be written
     MOV   r0, #0x18      ; Angel_SWIreason_ReportException
     LDR   r1, =0x20026   ; ADP_Stopped_ApplicationExit
     SVC   0x123456       ; ARM semihosting (formerly SWI)
     DCB "Hello there!"

To execute the example:

  1. Assemble outchan.s:

    armasm --debug outchan.s

  2. Link the output object:

    armlink outchan.o -o outchan.axf

    The link step creates the executable file outchan.axf

  3. Load and execute the image. See your debugger documentation for details.

Copyright © 2002-2006 ARM Limited. All rights reserved.ARM DUI 0203G