Build a Project for Debugging
Debug Mode
A device programmed indebug mode is not capable of independent operation. Its operation depends on an active connection through a debug tool to MPLAB X which can fully control the device. Devices programmed in debug mode will use slightly more memory and other resources than a device programmed inrelease mode in order to accommodate the background debug code that facilitates communications and control with MPLAB X. A special linker script is automatically selected by MPLAB X which will reserve any memory locations required by the background debug code. User intervention in this process is not normally required.
Click on theDebug Project buttonMain_Debug_Project.png on the toolbar or selectDebug ▸ Debug Project from the menu.

The build process in MPLAB® X is a little different from other development environments. It is not necessary to explicitly choose a "Debug" mode when performing a debug build. Instead, there is a separate button on the toolbar that encapsulates several functions that must be performed in order to build and run your application in the simulator or on a target board.

TheDebug Project button performs the following tasks:

  1. Build (make) the project indebug mode.
  2. If there are no build errors and you are working with hardware, your application is programmed into the target device using the debug tool selected in theproject options.
  3. The target device is released from reset and your code begins running unless you have selected a different option in the Embedded Generic Settings section of the Tools Options dialog.
YouDO NOT normally need to explicitly do aBuildMain_Build_Project.png orClean and BuildMain_Rebuild_Project.png first. If you do, your build and debug process will take longer becauseBuild andClean and Build both build inrelease mode. So, when you clickDebug Project MPLAB® X will have to rebuild your entire project indebug mode.