Get Started for MPLAB® X IDE Users New to Visual Studio Code (VS Code®)
The comparison table below is meant to assist MPLAB® X Integrated Development Environment (IDE) users new to using Microsoft® Visual Studio Code (VS Code®) and thus the new MPLAB Extensions for VS Code. Each line describes either a development action or term for MPLAB X IDE and then for MPLAB Extensions.
For more about VS Code, see the "Get Started with Visual Studio Code" page.
Some of the benefits of using VS Code are:
- speed,
- not language or vendor-specific,
- standardized IDE view for different projects, and
- standardized development flow as expected within VS Code.
Action or Term | MPLAB X IDE | MPLAB Extensions for VS Code | VS Code Notes |
---|---|---|---|
Installation | For most users:
See also: Readme for MPLAB X IDE. | From the Marketplace:
|
|
Tutorial | In MPLAB X IDE User's Guide. | A Walk-through is available on the Welcome tab in VS Code after MPLAB Extensions are installed. If it is not visible, use the Command Palette(1) and type "MPLAB: Welcome". | Note (1): The Command Palette (Ctrl + Shift + P) is where all Commands are found, including those added by MPLAB Extensions. When active, the Command Palette will use the Search bar. So if you are typing in a command you've used before but can't find it, ensure you are using the Command Palette and not Search. Tip: A quick way to access the Command Palette from the Search bar is to enter the the greater-than symbol (>). |
Create or Import a Project | To create a new project, click the New Project icon or select File > New Project. A wizard will open to guide you through the project setup. To import a project, select File > Import and choose from the available types of projects to import. A wizard will open to guide you through project setup. | On the Welcome tab under Get Started with MPLAB, click on Create or Import MPLAB Project. In the drop-down select either:
An example of the project content is shown on the right side of the Welcome tab. | Note (1): Your MPLAB X IDE project is left unchanged and no changes are moved back from the VS Code project to the MPLAB X IDE project. If you make changes to your MPLAB X IDE project that you want reflected in your imported project, delete the *.mplab.json file in your .vscode folder to effectively remove your VS Code project. This will trigger a new import the next time you open the folder. |
Workspace Definition | MPLAB X IDE is based on Apache Netbeans®, and a NetBeans workspace contains information about the configuration of the IDE. By default, there is only one workspace in Userdir/AppData/Roaming/mplab_ide/dev/vx.xx. However, you can set others: | A VS Code workspace is usually just your project root folder. Workspace settings as well as debugging and task configurations are stored at the root in a .vscode folder. You can also have more than one root folder in a VS Code workspace through a feature called Multi-root workspaces. | |
Project Structure and Location | The project logical structure will be visible on the Projects tab. The project file structure will be visible on the Files tab. MPLAB X IDE uses virtual (logical) folders for source code and files so the actual folders on the system do not match the folders in the project. | The project file structure will be visible on the Explorer tab. One or more projects may be visible if multi-root workspace has been used. In VS Code the project is a file system and folders in the project are physical folders on the drive. | |
Configure the Project | Use the Projects Properties dialog. Select a category on the left to set up available configurations on the right. | On the Welcome tab, click on Configure Project. In the drop-down select either:
An example of property options is listed in a table on the right side of the Welcome tab. The project Configuration (JSON) file (1) is located in the .vscode folder: ProjectName.mplab.json. | Note (1): JSON (JavaScript Object Notation) is an open standard file and data interchange format. To see a short definition of a project option in the file, hover over the option. |
Project Settings | In MPLAB X IDE, to cause a change to a tool or compiler settings, OK or Apply must be clicked in the Projects Properties dialog. If the dialog is closed without clicking these buttons, the change is cancelled. | In VS Code, changes to configuration file settings are saved as soon they are made. If you are uncertain about making a change, create a backup of the configuration file first - (Ctrl+Shift+P) and command File: Save As - before changing the settings. | |
Build the Project | Use the menu item Production > Build Project or context menu item Build from right-clicking on project. To view/change settings, open Project > Properties > Building category. | On the Welcome tab, click on Build Project. In the drop-down select Full Build or (Ctrl+Shift+P) and command MPLAB CMake: Full Build or click . To view/change build settings, select Open Settings (UI) or (Ctrl+Shift+P) and command Preferences: Open Settings (UI). These settings are different from those in MPLAB X IDE; that is, pre and post operations and HEX file options are not supported. | |
Build Issues | Visible in the Output window. | Visible in the Panel area or pop-up windows (1). | Note (1): If you have errors, please review the available features for the extensions. For example, only simple projects are currently supported. |
Create Debug Configuration File | Use the Projects Properties dialog. Select a debug tool category on the left to set up available configurations on the right. | On the Welcome tab, click on Create Debug Configuration File. Then select or Ctrl+Shift+D. Click on create launch.json to create the configuration file. An example of the file is shown on the right side of the Welcome tab. | |
Debug Project | Use the icon on the toolbar or menu item Debug > Debug Project. Debugging the project includes building the project code (with a debug exec if needed), programming the target device with the image, launching the debug tool and running debug code. | On the Welcome tab, click on Debug Project. In the drop-down select Start Debugging (1). To view/change build settings, select Open Settings (UI). An example of the settings is shown on the right side of the Welcome tab. Debugging the project does not include building the project by default. However, when the launch.json file is created, an option to build prelaunch can be set, e.g., | Note (1): You can also use or F5. There is generally more than one way to select an action, i.e., shortcut keys, Command Palette, buttons, menu items, etc. |
Debug Features: Basic Debug | On the toolbar: Finish Debugger Session, Pause, Reset, Continue. | At the top of the Debug sidebar: Continue/Pause, Step Functions (below), Reset, Stop (Finish Debugger Session). | |
Debug Features: Stepping | On the toolbar: Step Over, Step Into, Step Out. | Step Functions are: Step Over, Step Into, Step Out. | |
Debug Features: Breakpoints | To set or clear a breakpoint, click in the left margin. Also see MPLAB X IDE User's Guide, 5.17 Control Program Execution with Breakpoints. | To set or clear a breakpoint, click in the left margin. Also, on the Run menu, see breakpoint options. | |
Debug Features: Watch | To select a variable or symbol in the code, right-click to select New Watch, and the New Watch window will have the variable or symbol already selected; just hit return to add it to the Watches window. Select Window > Debugging > Watches to open the window and then create a watch. See MPLAB X IDE User's Guide, 5.18 Watch Symbol Values Change. | Select a variable or expression in code, right-click to select New Watch, and the variable or expression will appear in the WATCH section (1). Alternately, in the WATCH section (2), click + to add a variable or expression to watch. | Note (1): You can also hover over a variable on Pause to see its value. Note (2): If you do not see a WATCH section, go to the top of the Debug side bar and click on the ellipsis (...) to select the section. |
Launch Data Visualizer | Click on to launch the data visualizer or use the drop-down menu to choose DVRT for Main Project. For more information, see the "MPLAB Data Visualizer" page. | In the Command Palette, search for Start MPLAB Data Visualizer. Most features are supported. See MPLAB Data Visualizer extension text for details. |