Using the Microchip Graphics Suite (MGS) Simulator for VS Code®

Last modified by Microchip on 2026/03/26 11:40

Introduction

The Microchip Graphics Suite (MGS) Simulator is a specialized tool designed to assist developers in creating, testing, and refining embedded graphical user interfaces (GUIs) for Microchip-based systems. By integrating the MGS Simulator with VS Code®, developers can efficiently design and validate GUI applications within a unified development environment.

Through this guide, you will learn how to install the required extensions, configure your project, run GUI simulations, and analyze results—all from within the VS Code platform.

Prerequisites

Before you begin, you must be able to open and build an MGS project, like MGS Quickstart, in VS Code. If you are using a Microchip development kit, refer to the "Microchip Graphics Suite (MGS) Development Kits" guide for instructions on how to download and open an MGS Quickstart example for your kit.

You must also know how to use MGS Composer to view the GUI design and how to configure and generate the project with the Microchip Code Configurator. For more information, refer to the "Using MGS With MPLAB® Extensions for Microsoft® VS Code®" guide.

MGS Simulator Extension for VS Code

First, download the VS Code extension file (.VSIX)  from GitHub®.

Install the VS Code extension by selecting Install from VSIX in the VS Code Extensions tab.

VS Code Extensions Tab

Once the extension is installed, you will see the MGS MGS icon icon on the VS Code toolbar on the left.

MGS Simulator Extension

Converting the MGS Project to Simulator Mode

An MGS Simulator project can be generated from an MGS application using MPLAB Extensions for VS Code.

Start by opening the MGS application and launching MCC to view the Project Graph like the one shown in the accompanying image.

MCC Project Graph

Configuring the MGS Simulator

Add the MGS Simulator component to the Project Graph by opening the Device Resource tab and clicking the Libraries > Harmony > Graphics Simulator > MGS Simulator component.

MGS Simulator component

Once added, the following configuration options are available. You can move your mouse on top of each option to show more information.

MGS Simulator Configuration options

CategoryOptionsDescription
Graphics Display SubsystemDisplay TypeDrop-down list of preset display options
Circular DisplaySelect if the display is round (not square)
Graphics Controller SubsystemColor ModeColor mode should match the color mode of the MGS Composer project
Layer CountNumber of layers in the MGS Composer project
Canvas SupportEnabled if Canvas is used in the MCC project
Timer SubsystemTick ModeSimulator timer tick mode
Tick ResolutionSimulator timer tick resolution
Web Page OptionsTitleTitle for HTML simulator file
BezelCreates a frame around the display
Responsive

Scales the size of the display based on the browser window size

ConsoleEnables STDIO console
Build OptionsInitial MemoryInitial memory to allocate in MB
Stack SizeFixed total stack in kB
OptimizationOptimization level
Native Mode OptionsWindows Always on TopEnables always on top window

Tip: Selecting the Responsive feature is especially useful to show the HTML output on mobile devices or displays with varying sizes.

If you plan to embed the HTML output in an iframe, we recommend deselecting the Bezel and Responsive options to reduce the HTML size.

Configure the MGS Simulator component to match the MGS project settings. Make sure that the Display Type, Resolution, Layer Count, and Color Mode are properly set. For example, here are the MGS Simulator settings of an MGS application for a WVGA (800x480) screen with RGB565 color mode and using a single layer in MGS Composer.

MGS Simulator setting for MGS Quickstart WVGA RGB565

Generating an MGS Simulator Project

To generate the MGS Simulator project, the MGS application must be configured to run on the MGS Simulator instead of the embedded hardware. To do this, follow the following steps in MPLAB Code Configurator (MCC). 

  • Disconnect the LE GPU Driver and LE Display Driver nodes of the Legato Graphics Library.
  • Disconnect the TMR node of the Time System Service.

Disconnect Legato and TMR components

  • Connect the LE Display Driver nodes for the Legato Graphics Library and the MGS Simulator.
  • Connect the TMR nodes for the TIME System Service and the MGS Simulator.

Connect the MGS Simulator to TMR and Legato Graphics Library

  • Re-generate in MCC to generate the simulator project.

Generate Simulator Project

This will generate the <config>.mgsws MGS Simulator project file in the  <MPLAB project>/<MCC Config>/src/config/<config>/ directory.

The MGS Simulator Extension for VS Code will automatically detect this project file and show the project details. 

MGS Simulator Project Settings

Note: If the new project details don't update automatically, you can click the Refresh Project button Refresh button to refresh the project details.

Application Files

User application source files that contain GUI application logic, screen, and button callback functions will need to be included in the build. Application files in the src/ directory are listed in the FILE SELECTION tab and can be selected to be included in the MGS Simulator builds. For example, the screen and widget callback functions in MGS Quickstart are defined in the app_screen_*.c files. These files are checked in the FILE SELECTION tab, so they are included in the build.

Application source files

Back to Top

Running the MGS Simulation

The MGS Simulator supports two modes, Web Mode and Native Mode.

Web Mode

In Web Mode, the GUI application is built as an HTML file. This mode enables remote access, visualization, and control of the simulation environment using a web browser.

Web Mode is particularly useful for collaborative work, demonstrations, or when users need to access the simulator from different devices without installing software locally.

Refer to the "Using the Microchip Graphics Suite (MGS) Simulator in Web Mode" page.

Native Mode

In Native Mode, the GUI application is converted into a cmake project in VS Code that can be built and run on a PC.

Since the application is a VS Code project, the Native Mode simulation can be used for source-level debugging and development.

Refer to the "Using the MGS Simulator in Native Mode" guide.

Back to Top

Converting the MGS Project to Embedded Mode

The project will need to be converted back to an embedded project so that it can be regenerated and programmed to actual hardware. To convert the project from MGS Simulator mode, follow these steps:

  • Disconnect the LE GPU Driver and LE Display Driver nodes of the Legato Graphics Library.
  • Disconnect the TMR node of the Time System Service.

Disconnect Legato and TMR components

  • For the TIME System service, connect the TMR node to the correct timer peripheral library component.
  • For the Legato Graphics Library component:
    • Connect the LE Display Driver node to the appropriate display driver component.
    • If the device has a GPU, connect the LE GPU node to the GPU driver component.
Embedded Project

SAM9x75 MGS Project in Embedded Mode

  • Regenerate the project in MCC.

Generate Simulator Project

Back to Top