USB Audio Speaker Tutorial: Step 5

Step 5: Generate Harmony Code

1

Generate and save the configuration as shown below :

image_77.png

2

Resolve code generation merge conflicts.

When the Generate button is clicked, MHC will modify and generate source files based on the options selected in MHC. If MHC generates code that will change a pre-existing file, it will show you the code it generated, and allow you to confirm if you want to add it to your source code. The following screen shots will guide you on which changes need to be merged (i.e., accepted).

For this lab, you should not get any merge conflicts because you haven't added any of your own code to files generated or modified by the MHC.

3

Examine what was done after “Generating Code”.

The app folder contains files related to your specific application. In the following steps, you will add your application code to the existing app.c and app.h files. You will also add other application specific source files to the project.

The framework folder under the app folder (app/system_config/pic32mz_ef_sk_meb2/framework) contains customized Harmony Framework files. These files have been generated by MHC in response to your specific MHC selections.

Also note MHC has generated three custom graphics source files for you, based on the selections you made in the previous two steps. It has placed these new source files in the Source Files/app/system_config/pic32mz_ef_sk_meb2 folder.

image_78.png
Click image to enlarge.
Click image to enlarge.

Harmony groups all source files supporting a specific hardware platform into their own system_config folder (named pic32mz_ef_sk_meb2 in this case). Doing this enables one MPLAB X IDE project to support multiple hardware platforms by using its project configurations feature. "Project configurations" includes or excludes hardware specific configuration folders based on the target hardware you select for a specific build.

The framework folder under the Source Files folder contains standard Harmony Framework files that have been added to your project by MHC (based on your MHC selections). To be clear, unlike the framework files found under the app folder, these files have not been modified by MHC. They are some of the standard Harmony Framework files included in the Harmony Framework download.

You can see MHC has added driver folders (Source Files/framework/driver) for each driver you told MHC you need.

It has also added another folder named gfx under the Source Files/framework folder for the Graphics Library files.

Last, MHC added the system folder to hold files needed to implement Harmony System Services.

image_79.png
Click image to enlarge.
Click image to enlarge.

If you were to build the project now, the build would fail (linker error: undefined reference to APP_DISPLAY_VolumeMuteChange). The event handler of the display object calls this function. You will add the application display code to implement this API in the next step.

image_80.png



Next Step >

© 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.