MPLAB® Harmony v3 Peripheral Libraries on SAM D21: Step 4

Last modified by Microchip on 2023/11/09 09:08

Generate Code

When done, before generating the code, click the Save icon in MPLAB® Harmony Configurator (MHC) as shown in the accompanying image.

Save button

Save the configuration in its default location when prompted.

Save Database State As window

Click on the Code Generate button as shown in the accompanying image to start generating code.

Generate button

Click on the Generate button in the Generate Project window, keeping the default settings as shown in the accompanying image.

If prompted for saving the configuration, click Save.

Modified Configuration window

Generate Project window

As the code is generated, MHC displays the progress as shown in the accompanying image.

Generating Progress window

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

Examine the generated code as shown in the accompanying image.

Projects tab

MHC will include all the MPLAB Harmony library files and generate the code based on the MHC selections. The generated code would add files and folders to your Harmony project as shown.

Among the generated code, notice the Peripheral Library (PLIB) files generated for Real-Time Clock (RTC), SERCOM 2 (as I²C), SERCOM 3 (as Universal Synchronous Asynchronous Receiver Transmitter (USART)), Direct Memory Access (DMA), External Interrupt Controller (EIC), and PORT peripherals. MHC also generates the template main file (main_d21.c).

Build the project

Click on the Clean and Build icon Build Icon and verify that the project builds successfully. At this point, you are ready to start implementing your application code.

Back to Top