User guide

The following piece of target application code, supplied in file
Install_directory\Examples\dcc\inchan.s, shows this in action:
AREA InChannel, CODE, READONLY
ENTRY
MOV r1,#3 ; Number of words to read
LDR r2, =indata ; Address to store data read
pollin
MRC p14,0,r0,c0,c0 ; Read control register
TST r0, #1
BEQ pollin ; If R bit clear then loop
read
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
SWI 0x123456 ; ARM semihosting SWI
AREA Storage, DATA, READWRITE
indata
DCB "Duffmessage#"
END
4. Create an input file on the host containing, for example, And goodbye!.
5. Assemble and link this code using the following commands:
armasm -g inchan.s
armlink inchan.o -o inchan.axf
You have created an executable image in a file called inchan. Your next steps depend on your choice of debugger.
You can load the image, enable comms channel viewing, and execute the image by using:
armsd (for command-line operation)
AXD.
Issuing commands
If you are issuing commands:
1. Load the image into armsd using the following command:
armsd -li -adp -port s=1 inchan.axf
If you view the area of memory indata, you see its initial random contents:
examine indata
2. Enable communication and open the input file, then execute the program:
ccin input
go
3. When execution completes, view memory again and you can see the input has been read in:
examine indata
Using AXD
If you are using AXD:
1. Enable channel viewing. See the description of the Control system view pop-up menu in chapter 5 of the AXD
and armsd Debuggers Guide.
2. Load the image created above into AXD.
3. Use the channel viewer in AXD. See the description of the Comms Channel processor view in chapter 5 of the
AXD and armsd Debuggers Guide
.
4. In the Send field of the Channel Viewer, type And goodbye!, and click the Send button. The Left to Send
counter should show the number of bytes stored for sending to the target.
Debug Communications Channel
Copyright ?1999 2001 ARM Limited 8-7