Projects in MPLAB® X IDE

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

Working With Projects in MPLAB® X IDE

In MPLAB® X Integrated Development Environment (IDE), you always work inside a project even if your program is contained in a single source file. Each project must have a makefile so the IDE can build the project. A project's makefile can be generated by the IDE or you can use a makefile that was previously created outside the IDE. Projects with IDE-generated makefiles are called Managed Projects, because they are "managed" by the IDE, and they come in several varieties. Projects that use makefiles created outside the IDE are called User Makefile Projects.

You work with projects through the IDE's Projects Window.

Projects window

Information
Project:

A Project is a group of source files and associated information about how to compile and link the source files and run the resulting program. The IDE stores project information in a project folder that includes a makefile and metadata files. Your source directories do not need to be physically located in the project folder.

Project Directory Structure

diagram of an MPLLAB X project directory structure

Italicized directory names are the only ones you have any control over with respect to naming. The structure is fixed and may not be altered without destroying the integrity of the project.

MyProjects
The directory specified as the project location when the project was created. Any directory may be chosen for the project location, but it is usually best to keep it close to the root directory (e.g. C:\ on Windows) to keep file paths short.
ProjectName.X
The project directory created by the IDE to contain all of the project files. The directory's name is simply the project's name with a ".X" appended. In most cases, this is where all of your source files and header files will be placed. You may also create subdirectories for them or place them in directories external to your project.
build
Contains all of the intermediate files (*.o, *.o.d) generated by the compiler and/or assembler that are used by the linker to create the output files. The intermediate files are sorted by project configuration and then by debug versus production images.
dist
Contains all of the output files (*.elf, *.hex) generated by the linker. The output files are sorted by project configuration and then by debug versus production images.
default
This directory (under both build and dist) contains files for the default project configuration. If you don't create any project configurations, this directory will be named default, otherwise, there will be one or more directories at this level with the names of the project configurations you created.
debug
Contains files generated when the project was built in debug mode.
production
Contains files generated when the project was built in release mode.
nbproject
Contains your project's settings, such as which files are included, which tools are selected, and so on.
private
Contains project settings unique to your machine.

More About Projects