Build a Project for Debugging
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 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. 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 the Debug Project button Main_Debug_Project.png on the toolbar or select Debug ▸ 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.

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 Main_Build_Project.png or Clean and Build Main_Rebuild_Project.png 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 will have to rebuild your entire project in debug mode.
© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.