7.3.3. Debugger to target communication

This is the sequence of events for message transfer from a debugger running on the host to the application running on the core:

  1. The debugger polls the comms data control register R bit. If the R bit is clear, the comms data read register is clear and data can be written there for the target application to read.

  2. The debugger scans the data into the comms data read register through scan chain 2. The R bit in the comms data control register is automatically set by this.

  3. The target application polls the R bit in the comms data control register. If it is set, there is data in the comms data read register that can be read by the application, using an MRC instruction to read from coprocessor 14. The R bit is cleared as part of the read instruction.

The target application code shown in Example 7.2 shows this in action. The example code is available in the main examples directory, in ...\dcc\inchan.s, .

To execute the example:

  1. Create an input file on the host containing, for example, And goodbye!.

  2. Assemble inchan.s:

    armasm --debug inchan.s

  3. Link the output object:

    armlink inchan.o -o inchan.axf

    The link step creates the executable file inchan.axf

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

Example 7.2. 

     AREA  InChannel, CODE, READONLY
     MOV   r1,#3          ; Number of words to read
     LDR   r2, =indata    ; Address to store data read
     MRC   p14,0,r0,c0,c0 ; Read control register
     TST   r0, #1
     BEQ   pollin         ; If R bit clear then loop
     MRC   p14,0,r3,c1,c0 ; read word into r3
     STR   r3,[r2],#4     ; Store to memory and
                          ; update pointer
     SUBS  r1,r1,#1       ; Update counter
     BNE   pollin         ; Loop if more words to read
     MOV   r0, #0x18      ; Angel_SWIreason_ReportException
     LDR   r1, =0x20026   ; ADP_Stopped_ApplicationExit
     SVC   0x123456       ; ARM semihosting (formerly SWI)

     DCB   "Duffmessage#"
Copyright © 2002-2006 ARM Limited. All rights reserved.ARM DUI 0203G