Building Projects

The MPLAB X Build Process

MPLAB X uses the GNUmake program to control the build process.make is a utility that 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 amakefile which is generated by MPLAB X to describe your project tomake.

Build Methods

Any time you want to build your code, debug your code, run your code, or program a target device, themake utility will be invoked. There are several ways thatmake can build your code, based on which one of the following methods you use to start the build process.

Build Project

Build Project is the simplest of the build methods. All it does is callmake which will build any files within a project that have changed since the last build. The first time it is invoked, it will build the entire project, but subsequent builds will be much faster for larger projects. For users of MPLAB 8, this is the equivalent of doing a "Make" in "Release" mode.

Clean and Build Project

Clean and Build Project deletes any intermediate files generated by previous builds and then invokesmake to rebuild all files in the project, regardless of whether or not they have changed since the last build. For users of MPLAB 8, this is the equivalent of doing a "Build All" in "Release" mode.

Debug Project

Debug Project invokesmake much likeBuild Project, but it links in additional code required by the selected hardware debug tool (e.g. MPLAB REAL ICE, MPLAB ICD3 or MPLAB PICkit 3). After a successful build, it will automatically proceed to program the target device and run the code via the selected debugger. For users of MPLAB 8, this is equivalent to doing a "Make" in "Debug" mode, programming the target (via the tool selected in the Debugger menu) and running the program through the debug tool.

Run Project

Run Project is similar toDebug Project but it does NOT link in any debug code. It invokesmake just likeBuild Project. Then after a successful build, it will automatically program the target device via the selected debugger or programmer and then release the target device from reset so that it begins running autonomously. No debug functions are available in this mode. For users of MPLAB 8, this is equivalent to doing a "Make" in "Release" mode, programming the target (via the tool selected in the Programmer menu) and doing a "Release from Reset".

Program Target

Program Target invokesmake just likeBuild Project. Then after a successful build, it will automatically program the target device via the selected debugger or programmer. No debug code is linked in and no debug functions are available in this mode. For users of MPLAB 8, this is equivalent to doing a "Make" in "Release" mode and then programming the target (via the tool selected in the Programmer menu). If the device was programmed in-circuit, it will not run until disconnected from the programmer/debugger.