MPLAB X IDE generates debug macros for use with Microchip language tools. Macros passed to Microchip compilers and assemblers are shown in the table below.
Macro Name | Assoc. Tool | Function |
---|---|---|
__DEBUG | All | specifies that this is a debug build |
__MPLAB_REAL_ICE__ __MPLAB_ICD3__ __MPLAB_PK3__ __MPLAB_PICKIT2__ |
XC8 | specifies the
hardware debug tool in use The format is __MPLAB_xxx__, where xxx represents the hardware tool specifier. |
__MPLAB_DEBUGGER_REAL_ICE __MPLAB_DEBUGGER_ICD3 __MPLAB_DEBUGGER_PK3 __MPLAB_DEBUGGER_PICKIT2 |
XC16, XC32, MPASM |
specifies the
hardware debug tool in use The format is __MPLAB_DEBUGGER_xxx, where xxx represents the hardware tool specifier. |
__MPLAB_DEBUGGER_PIC32MXSK | XC32 | specifies the starter kit in use |
You can use these macros in your own code. For example:
#ifdef __DEBUG
fprintf(stderr,"This is a debugging message\n");
#endif