Debug Only Features Added to Source Code

Last modified by Microchip on 2024/01/19 14:46

Whenever you build by selecting a debugger option, MPLAB® X IDE adds the __DEBUG macro as an extra option to tell the compiler to plan space for the debug executive, which the debugger will load after loading the user application. You can also conditionally compile code based on this macro. This allows you to add debug-only functionality to your code that will automatically be deleted when building a production (non-debug) image.

/*******************************************************************************
 *  Debug_Only Features Example - Adding a Debug Variable
 *
 ******************************************************************************/


#if defined (__DEBUG)
unsigned char debugVariable;
#endif