Getting Started with USB on SAM MCUs Using MPLAB® Harmony v3: Step 4

Generate Code

1

By default, the Autosave MPLAB® Code Configuration (MCC) configuration file option is enabled. That means MCC automatically saves your MCC configurations.

mcc_autosave.png
Figure 1: Auto save Option

2

Now, generate the code by using MCC. From the left side tab, Resource Management (MCC), go to Project Resources and click on the Generate button.

generate_code.png
Figure 2: Generate Code

3

Navigate to the Projects tab in MPLAB X IDE to view the project tree structure.

4

Once this process completes, switch to the MPLAB X IDE window. You may now examine the generated code through the Projects tab. MCC will include all the requisite MPLAB Harmony v3 Framework files and generate the configuration code dynamically based on your MCC selections. MCC will then automatically organize and add the generated code as files and folders to your 32-bit MPLAB Harmony 3 Project.

MCC generates a default template main file main.c and application files app_sensor.c/.h app_eeprom.c/.h app_usb.c/.h based on your MCC configuration. These will be used for the Sensor, EEPROM and USB Task state machines.

generated_files.png
Figure 3: Generated Application Files

You will also notice that the Peripheral Library (PLIB) files are generated for the TC, TWIHS, AFEC, and PIO peripherals. The files for the USB Device Stack Middleware, I²C Drivers, and the Timer System Service are generated as well.

generated_files_expanded.png
Figure 4: Generated Harmony v3 Framework Files

5

Build the code by clicking on the Clean and Build Main Project in the MPLAB X IDE and verify that the project builds successfully.

clean_and_build_icon.png
Figure 5: Clean and Build option

At this point, you are ready to start implementing your application code.



Next Step >

Table of Contents

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