Microchip Technology XC8 Standard Compiler (Workstation) SW006021-1 SW006021-1 ユーザーズマニュアル

製品コード
SW006021-1
ページ / 518
MPLAB
®
 XC8 C Compiler User’s Guide
DS52053B-page 142
 2012 Microchip Technology Inc.
5.3.10
REAL ICE Support
The compiler supports log and trace functions (instrumented trace) when using Micro-
chip’s REAL ICE debugger. See the REAL ICE documentation for more information on 
the instrumented trace features.
Only native trace is currently supported by the compiler. Not all devices support instru-
mented trace, and the IDE you are using also needs to have instrumented trace sup-
port for your target device, as well.
The log and trace macro calls need to be added by hand to your source code in MPLAB 
IDE. They have the following form.
__TRACE(id);
__LOG(id, expression);
MPLAB IDE v8 will automatically substitute an appropriate value for id when you com-
pile; however, you may specify these by hand if required. The trace id should be a 
constant in the range of 0x40 to 0x7f, and the log id is a constant in the range of 0x0 
to 0x7f. Each macro should be given a unique number so that it can be properly iden-
tified. The same valid number can be used for both trace and log macros.
The expression can be any integer or 32-bit floating point expression. Typically, this 
expression is simply a variable name so the variable’s contents are logged.
Macros should be placed in the C source code at the desired locations. They will trigger 
information to be sent to the debugger and IDE when they are executed. Adding trace 
and log macros will increase the size of your code as they contribute to the program 
image that is downloaded to the device.
Here is an example of these macros that you might add.
inpStatus = readUser();
if(inpStatus == 0) {
__TRACE(id);
recovery();
}
__LOG(id, inpStatus);