New Harmony Project Details

Because you are familiar with MPLAB® X IDE, we assume you have created a new "Standalone Project". Creating an "MPLAB Harmony Project" does a lot of work for you that isn't done with the creation of a "Standalone Project".

New Harmony Project Configuration Settings:

  • Adds the relative path for the project's source folder:
    • ../src
  • Changes XC32 compiler options to those recommended for Harmony:
    • xc32-gcc (General)
      • Isolate each function in a section (box checked)
    • xc32-gcc (Optimization)
      • optimization-level = 1
    • xc32-ld (General)
      • Remove unused sections (box checked)
  • Starts the MPLAB Harmony Configurator (MHC) GUI

New Files and Folders Added to Hard Drive for a New Harmony Project:

  • Creates the MPLAB® Harmony folder structure on your disc:
    • <install-dir> /apps/<your project name>
    • <install-dir> /apps/<your project name>/firmware
    • <install-dir> /apps/<your project name>/firmware/<your project name>.X (this is the project folder)
    • <install-dir> /apps/<your project name>/firmware/src
    • <install-dir> /apps/<your project name>/firmware/src/system_config
    • <install-dir> /apps/<your project name>/firmware/src/system_config/<project configuration name>
  • Creates the following Harmony files
    • <your project name>.hconfig
      • Used by MHC along with the FreeMarker template technology to generate the source code files
    • configuration.xml
      • Stores Harmony configuration settings that MHC needs to remember. A checksum is used to determine if a setting has changed:

Harmony Files created after clicking the "Generate" button:

After using MHC to configure the Harmony Framework, you will click the "Generate" button to generate the source files.


At this point, you will be asked if you want to save the current MHC configuration. If you save it, this file will be generated:

  • <project config name>.mhc
    • This file captures all the selections you make in the MHC GUI.

The MHC configuration file can be shared or copied to duplicate a complete set of configuration selections.


MHC will then generate new source files based on your selections. You will be happy to know it doesn't blindly overwrite the existing source files (unless you tell it to). You will be asked if you want to "overwrite local changes". You will probably want to leave this box unchecked. The unchecked box allows you to identify and keep any changes you may have made to source files modified by MHC. This is accomplished with the help of a merge window (diff utility) which is automatically opened for you. Clicking "Save Merge and Continue" (top right corner) will save the merged file as it is shown in the window on the right side.


The following files will be generated by MHC (Additional files may also be generated based on your Harmony Framework configuration selections):

Application and Main files:

  • app.c & app.h
    • Implements your application's logic
  • main.c
    • Contains the "main()" function and little else

System Configuration Files:

  • system_config.h
    • Defines all static build options
  • system_definitions.h
    • System-wide prototypes and definitions
  • system_init.c
    • Initializes all libraries, applications and processor config bits
  • system_interrupt.c (optional)
    • Implements all interrupt vector stubs and calls all Interrupt Service Routines (ISRs)
  • system_tasks.c
    • Calls all polled system logic and maintains system state

System configuration framework files for a specific project configuration:

  • sys_clk_static.h & sys_clk_static.c
    • Initialize the system clocks per MHC settings
  • sys_ports_static.c
    • Initialize the system I/O ports per MHC settings

The following video provides a tour of the files generated by MHC

To view the following video full screen, click on the video title (view on YouTube).

20th Annual
Microchip MASTERs Conference 2016
Register now - Deadline: July 29

JW Marriott Desert Ridge Resort-Phoenix, AZ

© 2016 Microchip Technology, Inc.
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.