by Crossware
25. October 2011 10:36
A question we have just been asked is "How to see the output of the ARM LPC2103 on Crossware?".
We will assume that the user is interested in outputting messages from the excecuting ARM chip.
Here is a simple method of doing that.
Create a new project selecting the NXP LPC2103 as the target chip, accepting all defaults offered by the New Project Wizard.
Add:
printf("Hello world\n");
to main(). For example:
main()
{
printf("Hello world\n");
while (1)
{
}
}
Use the Headers Wizard to add the include file stdio.h to the xstdsys.h. (Or manually add #include <stdio.h> to just above main().)
Build the project.
Run the program in the simulator and the Hello world message will appear in the Debug view.
Run the program on the hardware using the Jaguar USB debugger interface and the Hello world message will also appear in the Debug view.
How does this work?
The ARM7 debug communication channel (DCC) is being used to route the message to the Debug view. A special putch() routine in the library sends the output to the DCC. When you add printf() to your program, putch() is required as the output function. If you do not include your own version of putch() in your program then this special library version will be automatically included. When debugging with Jaguar, Jaguar captures the output from the DCC and the debugger writes it to the Debug view. When simulating, the DCC is simulated and so the output is captured and written to the debug view in a similar way.
This use of the DCC is often referred to as 'semi-hosting'. For more information on semi-hosting see the ARM Simulator and Debugger User Guide via the Books view or refer to this and following pages of the online version of the guide:
http://www.crossware.com/smanuals/sdarm/semi_overview.html
44e4c98f-278e-40fc-bd15-ab73ef3f51c1|1|5.0
Tags:
Blog