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
Figure 1-1. MPLAB Tools Within the VS Code Extensions Marketplace

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.

Figure 1-2. MPLAB X IDE Windows
Figure 1-3. MPLAB Tools for VS Code Windows

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.

Figure 1-4. MPLAB X IDE Default Toolbar

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.

Table 1-1. MPLAB X IDE Icons and MPLAB Tools for VS Code Commands
Group Purpose MLPAB X IDE Icon VS Code Command
1 New File…

>Create: New File…

>File: 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

Table . Creating New Projects
MPLAB X IDEMPLAB Tools for VS Code

To create a new project in MPLAB X, use either:

  • The File menu, or

  • The New Project… icon on the toolbar

A pop-up window will prompt users to enter the new project details.

Figure . New Project in MPLAB X IDE

To create or add a new project in the VS Code workspace, use either:

  • The command palette and type >MPLAB: Create New Project, or

  • Open MPLAB Tools from the activity bar and hover over the New Project icon in the Projects window

The command palette will then prompt users to enter the new project details.

Figure . New Project in MPLAB Tools for VS Code

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 browser
    In 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>.

Table . Adding New Files or Folder
MPLAB X IDE MPLAB Tools for VS Code
Figure . Add New Files in MPLAB X IDE
Figure . Add New Files in 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.

Table . Undo/Redo Actions
MPLAB X IDE MPLAB Tools for VS Code

MPLAB X has Undo and Redo icons on the toolbar.

Figure . Undo and Redo in MPLAB X IDE
Figure . Undo and Redo in VS Code

1.3.2 Project Properties and Configurations

Table 1-2. Managing Project Properties and Configurations
MPLAB X IDE MPLAB Tools for VS Code

To configure project properties, use:

  • The File menu,

  • The Project Properties icon on the Dashboard, or

  • Right-click the project and select Project Properties

Figure 1-5. Project Properties in MPLAB X IDE

To configure project properties, use:

  • The command palette and type >MPLAB: Edit project properties, or

  • Open MPLAB Tools from the activity bar and click the Configure Projects icon in the Projects window

Figure 1-6. Project Properties in MPLAB Tools for VS Code

Users have the option to add multiple configurations and switch between them using the same steps as above.

1.3.3 Build/Compile Project

Table 1-3. Building and Compiling Projects
MPLAB X IDE MPLAB Tools for VS Code

To build or compile, use one of the following methods:

  • The Production menu,

  • The Build… icons from the toolbar, or

  • Right-click a project and select an option with Build

Figure 1-7. Build/Compile in MPLAB X IDE

To build or compile, use one of the following methods:

  • The command palette and type >MPLAB Build or >MPLAB Clean

  • Open MPLAB Tools from the activity bar and hover over the Build icon for the specific project or configuration, or

  • Click the drop-down arrow beside the Debug icon in the editor window and select Full Build

Figure 1-8. Build/Compile in MPLAB Tools for VS Code
Figure 1-9. Build/Compile from VS Code Editor

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

Table 1-4. Running and Debugging Projects
MPLAB X IDE MPLAB Tools for VS Code

To debug a project, use one of the following methods:

  • The Debug menu, or

  • The Debug icon on the toolbar

Afterwards, the debug functions (e.g., Continue, Step Over/Into/Out, Restart, and Stop) will be added to the toolbar.

Figure 1-10. Debugging in MPLAB X IDE

Users can add breakpoints by clicking on a line of code and access other debug functions by right-clicking in the Editor window.

Figure 1-11. Adding Breakpoints in MPLAB X

To start a debug session:

  • Press F5, or

  • Click the Run and Debug icon on the VS Code activity bar

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.

Figure 1-12. Debugging in MPLAB Tools for VS Code

Users can also program and debug from the MPLAB Tools view and command palette. Program the target tool with:

  • The Program icon on the selected toolkit, or

  • Typing >MPLAB Program in the command palette

Initiate the debug session by:

  • Typing >Debug: Start Debugging, or

  • The Start debugging icon on project configuration

To run the program on a connected device, use either:

  • The Production menu,

  • The Run icon from the toolbar, or

  • Right-click a project and select the Run option

Figure 1-13. Program/Run in MPLAB X IDE
Figure 1-14. Program/Run in MPLAB Tools for VS Code

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.

Figure 1-15. Debug and Run From MPLAB Tools for VS Code Editor

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.

Table 1-5. Launching MPLAB Data Visualizer
MPLAB X IDE MPLAB Tools for VS Code

To launch the MPLAB Data Visualizer, click the MPLAB DV icon on the toolbar.

Figure 1-16. MPLAB Data Visualizer in MPLAB X IDE

To launch MPLAB Data Visualizer, use the command palette and type >MPLAB Data, then select MPLAB: Data Visualizer.

Figure 1-17. MPLAB Data Visualizer in MPLAB Tools for VS Code

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.

Table . Launching MCC Content Manager
MPLAB X IDEMPLAB Tools for VS Code

MPLAB X IDE users can open the Content Manager before launching MCC by using:

  • The Tools menu,

  • The Window menu, or

  • Clicking the CM icon on the IDE toolbar

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.

Figure . Content Manager in MPLAB X IDE

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.

Figure . Content Manager in MPLAB Tools for VS Code

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.

Figure . MPLAB Code Configurator Content Libraries
Table . Launching MCC
MPLAB X IDEMPLAB Tools for VS Code

Launch MCC by using:

  • The Window menu, or

  • The MCC icon on the IDE toolbar

Figure . Launching MCC in MPLAB X IDE
Figure . MCC Window in MPLAB X IDE

Launch MCC by typing >MPLAB MCC: Launch in the VS Code command palette.

Figure . Launching MCC in MPLAB Tools for VS Code

For VS Code, users can also name the MCC configuration. By default, MCC uses My_MCC_Config as the default name.

Figure . New MCC Configuration in MPLAB Tools for VS Code

Refer to these videos for tutorials on how to use MCC in VS Code:

Figure . MCC Window in MPLAB Tools for 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
Table . MCC File Structure
MPLAB X IDE MPLAB Tools for VS Code

MCC Melody source and header files are generated inside a folder named mcc_generated_files, within the project folder.

Figure . MCC Melody Files in MPLAB X IDE

Inside the project folder, MCC generates a folder named after the MCC configuration (e.g., My_MCC_Config) that contains another folder named mcc.

MCC Melody generates both the mcc_generated_files folder and the MCC configuration metadata inside the mcc folder.

Figure . MCC Melody Files in MPLAB Tools for VS Code
MPLAB Harmony
Table . MPLAB Harmony Structure
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.

Figure . MPLAB Harmony Files in MPLAB X IDE
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.
Figure . MPLAB Harmony Warning for an Existing src Folder

MPLAB Harmony generates the src folder inside the MCC configuration folder (e.g., My_MCC_Config), and the configuration metadata inside the mcc folder.

Figure . MPLAB Harmony Files in MPLAB Tools for VS Code

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.

Table 1-6. Connecting Evaluation Kits
MPLAB X IDEMPLAB 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.

Figure 1-18. Opening the Kit Window in MPLAB X IDE
Figure 1-19. Kit Window in MPLAB X IDE

The Kit Window is opened from:

  • The Tools information icon, or

  • By typing >MPLAB: Show kits view on the command palette.

Figure 1-20. Opening the Kit Window in MPLAB Tools for VS Code

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.

Table 1-7. Opening I/O View
MPLAB X IDE MPLAB Tools for VS Code

In MPLAB X, the IO view is opened from the Window Menu>Debug>IO View.

Figure 1-21. Opening the I/O View in MPLAB X IDE

In VS Code, the I/O view is an extension that can be accessed by typing MPLAB IO… in the command palette.

Figure 1-22. Opening the I/O View in MPLAB Tools for VS Code