1 MPLAB Development Ecosystem
The MPLAB Development Ecosystem is part of Microchip’s MCU Development Tool Ecosystem. It consists of an IDE, supported compilers, code configurators, programmers/debuggers, and other integrated tools. For new projects, MPLAB Tools for VS Code is recommended to take advantage of the latest updates and features from Microchip. This section provides a comparison of using MPLAB X IDE and MPLAB Tools for VS Code. For a comparative list of features, refer to Appendix A.
1.1 Setting Up the Tools
This section explains how to set up MPLAB Tools for VS Code.
1.1.1 MPLAB Tools for VS Code
MPLAB Tools for VS Code
can be installed from the VS Code Marketplace. Tutorials are available
on the official website, with links to the Developer Help and video playlist:
- MPLAB Tools for VS Code
- This playlist features concise videos that introduce MPLAB Tools for VS Code, covering essential topics such as project workflows and new tools to help users get started quickly
Refer to this video for a quick tutorial in VS Code: Dev Tool Bits | Quickly and Easily Install MPLAB® Tools for VS Code®.
1.2 Navigating MPLAB X IDE and VS Code
For users new to the VS Code environment, there are some key differences in navigating the tools. MPLAB X has a dedicated toolbar (see Figure 1-2) for commonly used functions, such as setting up projects, building code, and launching other plug-ins. VS Code has a command palette (see Figure 1-3) where the same functions can be executed. In addition to the command palette, VS Code places common tool functions in various locations within the extension windows, which become visible when hovered over. For navigation, editors, and output windows, VS Code arranges them in a similar orientation to MPLAB X.
Refer to the VS Code User Interface (UI) document for a comprehensive guide for the VS Code UI.
1.3 Tools/Commands
This section breaks down the tools in the MPLAB X IDE and VS Code.
The figure below shows the default toolbar in MPLAB X IDE.
The following table lists commands in VS Code that execute the same functions as the toolbar icons in the Figure 1-4 when entered in the command palette. These tools are further described in the next section.
| Group | Purpose | MLPAB X IDE Icon | VS Code Command |
|---|---|---|---|
| 1 | New File… |
| |
| New Project… | >MPLAB:
Create New Project | ||
| Open Project… | >Workspaces: Add Folder to Workspace… | ||
| Undo | >Undo
| ||
| Redo | >Redo
| ||
| 2 | Set Project Configuration | >MPLAB:
Edit project properties (UI) | |
| 3 | Build for Debugging Main Project | >MPLAB
Cake: Build | |
| Clean and Build for Debugging Main Project | >MPLAB
Cake: Clean Build | ||
| 4 | Run Main Project / Make and Program Device Main Project | >MPLAB:
Program Device | |
| Debug Main Project | >Debug:
Start Debugging | ||
| 5 | MPLAB Data Visualizer | >MPLAB:
Data Visualizer | |
| 6 | MPLAB Code Configurator: Open/Close | >MPLAB
MCC: Launch |
1.3.1 Project Files and Folder
The first set of actions creates new files and projects, opens existing projects in the IDE, and enables developers to save, undo, or redo any action. The VS Code tools handle these actions in different ways.
Create New Projects
| MPLAB X IDE | MPLAB Tools for VS Code |
|---|---|
|
To create a new project in MPLAB X, use either:
A pop-up window will prompt users to enter the new project details. |
To create or add a new project in the VS Code workspace, use either:
The command palette will then prompt users to enter the new project details. Refer to this video for a quick tutorial in VS Code: Creating a New MPLAB® Project in Microsoft® VS Code®. |
Open Existing Projects
There are various ways of opening existing MPLAB projects in MPLAB X and VS Code. Here are some use cases:
- From a file browserIn any file browser, right-click the project folder and select Open with Code. This option will open the project folder in a new VS Code window.
Figure . Open with Code - From within MPLAB X or VS
Code
Table . Opening Projects From Within MPLAB X or VS Code MPLAB X IDE MPLAB Tools for VS Code MPLAB X can add multiple projects within a single instance of the IDE by using either:
-
The File menu, or
-
The Open Project... icon on the toolbar
Figure . Open Project in MPLAB X IDE If a VS Code window is already open, use the File menu and select either:
-
Open Folder…, or
-
Add Folder to Workspace…
Figure . Open Project in MPLAB Tools for VS Code The toolbar icons will only work for the project currently set as the Main Project.
Alternatively, users can right-click any open project to utilize the tools.
Figure . Set as Main Project Open Folder… reopens the current VS Code window with the selected project folder.
Figure . Open Folder in VS Code Add Folder to Workspace… allows another project folder to be added to the workspace and does not close or remove any project that is already open in the current workspace.
Figure . Add Folder to VS Code Workspace If there is more than one project in the workspace, the command palette will prompt users to choose for which project the command will be executed.
-
- Importing an MPLAB X IDE
Project in VS Code
MPLAB Tools for VS Code can detect MPLAB X projects. Once an MPLAB X project is identified by opening a folder with a .X extension, users will be prompted to import the project and include related files.
Figure . Import MPLAB X Project within VS Code Note: MPLAB X projects can be imported into VS Code. However, VS Code MPLAB projects cannot be imported into MPLAB X due to differences in the file format and extensions.Refer to these videos for quick tutorials in VS Code:
New File/Folder
To add a new file or folder, use either the File menu or the New File/Folder… icons in the MPLAB X toolbar or the VS Code workspace sidebar. Users can also right-click any folder or container and select New, then select <file type>.
| MPLAB X IDE | MPLAB Tools for VS Code |
|---|---|
|
|
|
Undo/Redo Actions
To undo or redo any action, use the Edit menu and select the appropriate action. The Edit menu includes common editing actions, with familiar keyboard shortcuts.
| MPLAB X IDE | MPLAB Tools for VS Code |
|---|---|
|
MPLAB X has Undo and Redo icons on the toolbar. |
|
1.3.2 Project Properties and Configurations
| MPLAB X IDE | MPLAB Tools for VS Code |
|---|---|
|
To configure project properties, use:
|
To configure project properties, use:
|
Users have the option to add multiple configurations and switch between them using the same steps as above.
1.3.3 Build/Compile Project
| MPLAB X IDE | MPLAB Tools for VS Code |
|---|---|
|
To build or compile, use one of the following methods:
|
To build or compile, use one of the following methods:
Refer to this video for a quick tutorial in VS Code: Dev Tool Bits | Start Building & Debugging with MPLAB® Tools for VS Code®. |
1.3.4 Run/Debug
| MPLAB X IDE | MPLAB Tools for VS Code |
|---|---|
|
To debug a project, use one of the following methods:
Afterwards, the debug functions (e.g., Continue, Step Over/Into/Out, Restart, and Stop) will be added to the toolbar. Users can add breakpoints by clicking on a line of code and access other debug functions by right-clicking in the Editor window. |
To start a debug session:
Users will be prompted to choose which debugger and target tool to use to run the code. Afterwards, the debug functions (e.g., Continue, Step Over/Into/Out, Restart, and Stop) will appear within the VS Code window. Users can add breakpoints by clicking on a line of code and access other debug functions by right-clicking in the Editor window. Users can also program and debug from the MPLAB Tools view and command palette. Program the target tool with:
Initiate the debug session by:
|
|
To run the program on a connected device, use either:
|
Another option is to click the drop-down arrow beside the Debug icon in the editor window and select any of the Debug or Run options. Refer to this video for a quick tutorial in VS Code: Configuring and Running a Debug Session in Microsoft® VS Code®. |
1.3.5 MPLAB Data Visualizer
MPLAB Data Visualizer is a free debugging tool that graphically displays run-time variables in an embedded application.
| MPLAB X IDE | MPLAB Tools for VS Code |
|---|---|
|
To launch the MPLAB Data Visualizer, click the MPLAB DV icon on the toolbar. |
To launch MPLAB Data Visualizer, use the command palette and type
Refer to this video for a quick tutorial in VS Code: Dev Tool Bits | Dive into the Details with MPLAB® Data Visualizer in VS Code®. |
1.3.6 MPLAB Content Manager (CM) and Code Configurator (MCC)
MCC Content Manager
The MCC Content Manager allows users to download versions of supported drivers and libraries for a selected device.
| MPLAB X IDE | MPLAB Tools for VS Code |
|---|---|
|
MPLAB X IDE users can open the Content Manager before launching MCC by using:
The MCC Content Manager can also be opened from within MCC. However, the stand-alone Content Manager cannot be opened while MCC is already running, as this may result in unexpected or corrupted content. |
For VS Code users, the MCC Content Manager can only be opened from within the MCC’s Resources Panel. Refer to the next section on how to launch MCC. |
MPLAB Code Configurator (MCC)
The MPLAB Code Configurator (MCC) is a free graphical programming environment that generates seamless, easy-to-understand C code. MCC has content libraries that support different sets of microcontroller families.
-
MCC Melody: Supports 8-bit PIC® and AVR® MCUs, and dsPIC® DSCs
-
MPLAB Harmony: Supports all 32-bit MIPS® and Arm® Cortex®-based MCU and MPU devices
| MPLAB X IDE | MPLAB Tools for VS Code |
|---|---|
|
Launch MCC by using:
|
Launch MCC by typing For VS Code, users can also name the MCC configuration. By
default, MCC uses Refer to these videos for tutorials on how to use MCC in VS Code:
|
Generated File Structure
The generated file and folder structure differs between MCC Melody and Harmony, as well as between MPLAB X IDE and VS Code MPLAB extensions.
MCC Melody
| MPLAB X IDE | MPLAB Tools for VS Code |
|---|---|
|
MCC Melody source and header files are generated inside a
folder named |
Inside the project folder, MCC generates a folder named after
the MCC configuration (e.g., MCC Melody generates both the
|
MPLAB Harmony
| MPLAB X IDE | MPLAB Tools for VS Code |
|---|---|
|
MPLAB Harmony source and header files are generated inside a folder named src, located outside of the project folder. Note: MPLAB Harmony warns users if it
detects an existing
src folder outside the
project folder. If this src folder belongs
to a different Harmony project, move the current project
folder into another folder before generating. |
MPLAB Harmony generates the |
1.4 Connecting Evaluation Kits
Upon connecting evaluation kits, such as the Curiosity Nano and Curiosity Pro, a kit information page describes the kit with links to user guides, example projects from MPLAB Discover, reference designs, and schematics.
| MPLAB X IDE | MPLAB Tools for VS Code |
|---|---|
|
MPLAB X automatically opens these kit windows. This window can also be manually opened by going to the Window menu and selecting Kit Window. |
The Kit Window is opened from:
|
1.5 I/O View
MPLAB I/O View is a powerful debugging tool that allows developers to graphically inspect and modify the Input/Output (I/O) memory map and peripheral registers of a target device during a debug session.
| MPLAB X IDE | MPLAB Tools for VS Code |
|---|---|
|
In MPLAB X, the IO view is opened from the Window Menu>Debug>IO View. |
In VS Code, the I/O view is an extension that can be accessed by
typing |
