Getting Started Application Development Using MPLAB® for VS Code®

Last modified by Microchip on 2026/11/20 18:54

Purpose

In this tutorial, you’ll develop an application for the SAMA7D65 Curiosity Pro board using the MPLAB® for VS Code®. You’ll gain hands-on experience configuring peripherals with MPLAB Code Configurator (MCC) and follow the end-to-end development workflow, from project setup through a successful build.

Overview

In this tutorial, you will gain hands‑on experience developing an application for the SAMA7D65 Curiosity Pro Development Board using the MPLAB for VS Code and Microchip’s code‑generation tools. The tutorial demonstrates a complete development workflow, from project creation and peripheral configuration to code generation using a practical, hardware‑based example.

The application developed in this tutorial is a user-input-based LED ON/OFF by pressing the USER button on the SAMA7D65 Curiosity Pro Development Board. This example will help you understand how core peripherals are configured and integrated in an MPU‑based system while maintaining an MCU‑like development experience.

After completing this tutorial, you will know how to:

  • Create a new application project using MPLAB for VS Code
  • Add and configure peripheral support using MCC
  • Generate C source code using MCC and integrate it into the project
  • Configure project settings, enabling you to efficiently develop and build applications

SAMA7D65 Curiosity Pro

  • One USB Type-C® cable
  • Power the board via the USB Type-C connector on the USBA port (J3) or via the DC jack connector (J1)
  • Jumper Settings:
    • Close Jumper J85 to enable VDDBU
    • Close 2-3 on Jumper J65 for DBGU Tx interface on FTDI
    • Close 2-3 on Jumper J67 for DBGU Rx interface on FTDI
  • One OpenOCD Debug Probe DV22S07A and one USB Type-C cable

Ensure all the required software from the "OpenOCD Debugging Prerequisites (Bare Metal and MPLAB® Harmony)" page is installed before proceeding.

Procedure

Part 1: Creating an Application Using MPLAB for VS Code

The first step is to launch VS Code.

To create a new MPLAB Harmony project, go to View > Command Palette > MPLAB: Welcome > Create New Project.

Create New Project


The next step in creating an MPLAB Harmony project is to define the following:

Enter the project name in the Specify Project Name text box as shown in the accompanying image.

Create MPLAB Project window 1/5

Select a Custom Location for the project.

Project folder location window

Choose SAMA7D65 MPU.

Create MPLAB Project window 3/5

Select Application Standard application project (default).

Create MPLAB Project window 4/5

Choose the latest MPLAB XC32 Compiler (in this example v5.10) as shown in the accompanying image.

Create MPLAB Project window 5/5


Once the project creation is complete, you will be in Restricted Mode. To enable all features, you need to trust the folders.

Confirm by clicking the Trust button and proceed to the next step.Workspace Trust window

Observe that the MPLAB Harmony project for the SAMA7D65 Curiosity Pro Development board has been created, and the initial setup is complete.​​​

MPLAB Harmony project


Now create the MCC configuration to add the necessary peripheral libraries essential for application creation.

Go to View > Command Palette > MPLAB MCC: Launch.

Adding necessary peripheral libraries

Now, click Create New MCC Config.

Adding necessary peripheral libraries

Select the project to associate it with.

Associate MCC Config to Project or Create Standalone window

Select Proceed With Default Values.

Configure MCC Config window

A Visual Studio Code pop-up will prompt you to download the latest SAMA7D65 DFP pack. Click Yes.

Visual Studio Code pop up


In addition to the required packages (csp), download the optional packages bsp, and core.

Click on Device Resource, then Content Manager.

Device Resources pane

Choose bsp and core and then click Select Latest Version. Click on the Apply drop-down arrow to view Compatibility Warnings. Change the requested version for the corresponding package and then click Apply with warnings. The content download will take some time, so be patient and wait until all content is downloaded.

 MCC Content Manager tab


The Project Graph window will be displayed.

From the Device Resource window, click the Add button next to SAMA7D65 Curiosity Pro BSP.

Project Graph

Board Support Packages will be reflected in the Project Graph.

Project Graph

The project graph will appear as shown in the accompanying image:

Project Graph


Refer to the user interface sections of the SAMA7D65 Curiosity Pro User Guide to verify the pin assignments for the user LED and Push Buttons Switches.

RGB LED section

Push Button Switches section


Now launch Pin Configuration tool in the Project Graph.

To do this, go to the Project Graph and choose Pin Configuration from the Plugins drop-down menu to configure the required pinout, referring to the SAMA7D65 Curiosity Pro User Guide for correct assignments.

Pin Configuration tool

Now enable Interrupt for USER BUTTON. To do this, go to the Pin Settings tab and look for the PC10 pin number in Pin ID. Now select the PIO interrupt settings to Both Edge from the drop-down list for PC10. Once done close the window.

MPLAB Harmony Configurators


Generate the code by clicking the Generate button. Wait until the code generation is complete.

code generation complete message


Now you can observe that C code for all the added peripherals is being generated.

​C code for all the added peripherals


Write main.c to create your own application integrating the USER button and the LED output.

Add MPLAB® AI Coding Assistant to VS Code. 

MPLAB AI Coding Assistant

The sample user-input-based LED ON/OFF application and main.c file can be found in the folder under sama7d65_led_button\config.mcc\src.

You can copy this main.c  to your project.

This completes the application development.

Back to Top

Part 2: Project Setup for Successful Builds

To build the project successfully, confirm the compiler details. To do this, go to Command Palette and launch MPLAB: Edit project properties (UI). Go to Toolchain and confirm that XC32 compiler is chosen.

Compiler Settings


By default, MPLAB X IDE only generates ELF and HEX format output files. To generate application output in binary format, a post-build step needs to be added to the project properties. To do this, go to Overview > Post-build Steps > Add Item. Then add the following command:

${MP_CC_DIR}/xc32-objcopy -O binary %{TargetDirRelative}/%{ConfigurationName}.elf %{TargetDirRelative}/harmony.bin

Add post-build step


This step is only necessary for using the cortex-debug extension with the on board FTDI debugger. This not necessary for using the MPLAB extensions with the MPLAB PICkit® 5 in-circuit debugger/programmer.

Note that the OpenOCD configuration files are in the project folder and in the openocd directory:

sama7d6.cfg defines settings such as the interface, target device, transport, reset behavior, and JTAG/SWD parameters, which are essential for establishing the debug session.

launch.json specifies details such as the executable file, GDB path, OpenOCD server connection, configuration files, and debug actions like reset, halt, load, and run.

Copy the launch.json file from the GitHub® folder to the user project/.vscode.

Add required files to the project


Copy at91bootstrap.elf from GitHub into the ./binaries folder of the project directory. This at91bootstrap is used to debug an MPLAB Harmony application in VS Code.

Add at91bootstrap

Project properties are configured with the required settings to ensure a successful and error-free build of the application.

Back to Top

Results

You have successfully created and built an application for the SAMA7D65 using MPLAB for VS Code. You configured the required peripherals using MCC and set up the necessary project properties to ensure a successful build.

Back to Top