Building Projects

The MPLAB® X IDE Build Process

MPLAB® X Integrated Development Environment (IDE) uses the GNU make program to control the build process. The make utility decides which files need to be built and then invokes the appropriate build tool (e.g., assembler, compiler, linker) for those files and their dependencies. make determines what needs to be built based on a script-like document called a makefile, which is generated by MPLAB X IDE to describe your project to make.

Build Methods

There are several ways that make can build your code, based on which one of the following methods you use to start the build process.

Build Main Project

Build Main Project is the simplest of the build methods. All it does is call make, which will build any files within a project that have changed since the last build (uses the file timestamp). The first time it is invoked, it will build the entire project, but subsequent builds will be much faster for larger projects.

Clicking the small down arrow beside the icon provides options for this icon:

  • Build Project
    • Build the project and create the production image (HEX file).
  • Build for Debugging
    • Build the project and create the debug image (ELF file).
  • Build with PRO Comparison
    • If you use an MPLAB XC C compiler in Free mode, you can build in PRO mode as well and see a comparison output of differences, if any exist.

Clean and Build Main Project

Clean and Build Main Project deletes any intermediate files generated by previous builds and then invokes make to rebuild all files in the project, regardless of whether or not they have changed since the last build. Clicking the small down arrow beside the icon provides the same options as the Build Main Project icon.

Debug Main Project

Debug Main Project invokes make much like Build Main Project, but it links in additional code required by the debugger. After a successful build, it will automatically program the target device with the debug image (ELF file). When programming is complete, the debug session will start.

Run Main Project

Run Main Project is similar to Debug Main Project but it does NOT link in any debug code. It invokes make just like Build Main Project. Then after a successful build, it will automatically program the target device with the production image (HEX file), then release the target device from reset so that it begins running autonomously. No debug functions are available in this mode.

Make and Program Device Main Project

Make and Program Device Main Project invokes make just like Build Main Project. Then after a successful build, it will automatically program the target device with the production image (HEX file). Click on the small down-arrow beside the icon to see programming options. No debug code is linked in and no debug functions are available in this mode.

View the Build Process

The output of the build process can be viewed in the Output window.

output-window-location.png

Customize the Build Process

You can customize the build process by right-clicking the Project name in the Projects window, scrolling to the bottom of the menu, and selecting Properties.

build-properties-menu.png

This selection will open the Project Properties dialogue box. This allows you to include/exclude files from the build process, change the device family pack and compiler versions used to build the project, change the target device, etc. Select Building from the left side categories to add macros to that run before or after the build process.

build-options-menu.png
© 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.