Porting a Microchip Graphics Suite (MGS) Harmony Application

Last modified by Microchip on 2025/07/14 11:55

Introduction

A Microchip Graphics Suite (MGS) Harmony application refers to a software application developed using the MPLAB® Harmony framework, a flexible and fully integrated embedded software development platform for Microchip’s 32-bit microcontrollers (MCUs) and microprocessors (MPUs). The application may be running on bare metal or an RTOS.

This user guide provides information on how to port an existing MGS Harmony application to build and run for Linux®.

MGS Application Overview

The diagram below shows the major blocks of an MGS Harmony application. MPLAB Code Configurator (MCC) Harmony provides the hardware abstraction layer and drivers for the MGS library and application code to run on the underlying hardware.

MGS Harmony Application

The application code includes the MGS Composer-generated screen design code and the user-developed code like event and screen callback functions. In most cases, the application code can be ported to run on top of the MGS Cross-Platform library and middleware on Linux.

For the display interface, the MGS Cross Platform library and middleware uses SDL for desktop Linux and Direct Rendering Manager (DRM)/Kernel Mode Setting (KMS) for embedded Linux. For touch, the library uses SDL for desktop Linux and LibInput for embedded Linux. The MGS library will use the graphics processor if it's available on the embedded Linux device.

MGS Application on Linux

Porting an MGS Harmony Application

To port an MGS Harmony application to Linux, first create a new application using MGS Quickstart or from scratch.

Then, copy the MGS Composer design project (ZIP) to the application folder. Launch MGS Composer and open the MGS Composer project ZIP file.

In MGS Composer, go to Project > Project Settings.


Click Code Generator.


Un-check Generate Harmony Interface. This will disable all Harmony-specific generated code.


Set Generate Path to the absolute path of the gfx folder in the new application directory, <mgs_xp>/apps/mynewapp/gfx.


Set Generate Name to legato.

MGS Composer Project Settings

Back to Top

Generating the Design

To generate the code for the screen design, click on the Generate Code button on the upper right section of MGS Composer.

Generate Code button

This will generate the screen and asset code for the MGS Composer project using the specified generate path and folder name.

Back to Top

Application Callback Code

In most cases, the source files for the user-developed application callback can be copied to the <application>/apps folder to be included in the build process.

However, Harmony or RTOS-specific code must either be removed or replaced with equivalent code for the embedded Linux platform.

For example, to include MGS library headers in the application source files, use the following include statement.

#include "gfx/legato/generated/le_gen_init.h"

Back to Top