Build a Project for Debugging

Last modified by Microchip on 2024/06/24 06:34

Debug Mode
A device programmed in debug mode is not capable of independent operation. Its operation depends on an active connection through a debug tool to MPLAB® X IDE which can fully control the device. Devices programmed in debug mode will use slightly more memory and other resources than a device programmed in release mode in order to accommodate the background debug code that facilitates communications and control with MPLAB X IDE. A special linker script is automatically selected by MPLAB X IDE which will reserve any memory locations required by the background debug code. User intervention in this process is not normally required.​

Click on the Debug Project button Build Project Icon on the toolbar or select Debug > Debug Project from the menu.

The build process in MPLAB X IDE 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.

The Debug Project button performs the following tasks:

  1. Build (make) the project in debug 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 the project 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.

You DO NOT normally need to explicitly do a Build  Build Iconor Clean and Build Rebuild Project Icon first. If you do, your build and debug process will take longer because Build and Clean and Build both build in release mode. So, when you click Debug Project, MPLAB® X IDE will have to rebuild your entire project in debug mode.