Atmel CAVR-4 Manuale Utente

Pagina di 323
CAVR-4
Part1. Using the compiler
The CLIB runtime environment
91
C-SPY runtime interface 
The low-level debugger interface is used for communication between the application 
being debugged and the debugger itself. The interface is simple: C-SPY will place 
breakpoints on certain assembler labels in the application. When code located at the 
special labels is about to be executed, C-SPY will be notified and can perform an action.
THE DEBUGGER TERMINAL I/O WINDOW
When code at the labels 
?C_PUTCHAR
 and 
?C_GETCHAR
 is executed, data will be sent to 
or read from the debugger window.
For the 
?C_PUTCHAR
 routine, one character is taken from the output stream and written. 
If everything goes well, the character itself is returned, otherwise 
-1
 is returned.
When the label 
?C_GETCHAR
 is reached, C-SPY returns the next character in the input 
field. If no input is given, C-SPY waits until the user has typed some input and pressed 
the Return key.
To make the Terminal I/O window available, the application must be linked with the 
XLINK option With I/O emulation modules selected. See the AVR® IAR Embedded 
Workbench™ IDE User Guide
.
TERMINATION
The debugger stops executing when it reaches the special label 
?C_EXIT
Checking module consistency
For information about how to check module consistency, see Checking module 
consistency
, page 77 
in the chapter The DLIB runtime environment.