Building Microchip Graphics Suite (MGS) for Embedded Linux®

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

Introduction

This section provides information on how to cross-compile and run the MGS cross-platform application for Microchip microprocessors (MPUs) that run embedded Linux®.

Before proceeding, ensure that you have downloaded the MGS cross-platform framework and installed all necessary dependencies to build and run the MGS Quickstart application example on a Linux desktop. Refer to the "Microchip Graphics Suite (MGS) Cross-Platform for Linux®" page for instructions.

Create the ROOTFS Image

First, Buildroot must be used to configure the cross-compiling toolchain and create a graphics SDTM card image for the target MPU board. Follow the steps in the Linux 4 SAM user guide for this process. Make sure that the config used is the graphics (not headless) config when building the rootfs.

For board-specific information, you can refer to the "Boards" list and the links on how to build the rootfs image for these boards.

Back to Top


If successful, you should have the CMake file for configuring the cross-compile toolchain.

buildroot-mchp/output/host/share/buildroot/toolchainfile.cmake

You should also have the SD card image that will be used to create an SD card for booting embedded Linux.

buildroot-mchp/output/images/sdcard.img

Test the ROOTFS Image

To test the rootfs image, flash the sdcard.img file to the SD card and power up the board with the display. 


Verify that you are able to boot the Ensemble Graphics Toolkit (EGT)-based demo on your hardware. You should see the default EGT Launcher demo on the display.

EGT is the default Microchip graphics development toolkit for embedded Linux.

So, Buildroot and Yocto Project® images, by default, will run the EGT-based application. To run MGS applications on these images, the MGS application must be copied to the rootfs and the systemd script needs to be added to automatically launch the MGS application.

Build the MGS Application

To cross-compile the MGS application for the target embedded Linux device, run the following commands, where <device> can be 9x60, 9x75, etc.

cd mgs_xp
mkdir -p build/<device>

Back to Top


Run CMake to generate the makefiles. This needs to be done every time a new file is added to the project. The path to the buildroot-mchp directory that you used to build the rootfs image is <buildroot-mchp path>.

cd build/<device>
cmake -DCMAKE_TOOLCHAIN_FILE=<buildroot-mchp path>/output/host/share/buildroot/toolchainfile.cmake ../..  

Back to Top


Build the application using the make command. This will build all the applications in the apps/ directory.

make all 

When the build completes, you will find the built executable binary in the build/<device>/apps/<application> directory.

Back to Top

Run the MGS Application

To automatically run the application at boot, the application binary and a systemd script must be copied to the rootfs.

Insert the SD card into the Linux PC and perform the following steps:

Copy the built binary to the rootfs SD card bin/ directory (e.g., quickstart demo). The directory where the rootfs partition is mounted is <rootfs>.

sudo cp build/<device>/apps/mgs_quickstart/mgs_quickstart  <rootfs>/bin/

Back to Top


Download and copy the systemd script to <rootfs>/usr/lib/systemd/system/.

sudo cp mgsdemo.service <rootfs>/usr/lib/systemd/system/

Back to Top


Create a symlink to the systemd script.

sudo ln -sf /usr/lib/systemd/system/mgsdemo.service <rootfs>/etc/systemd/system/multi-user.target.wants/mgsdemo.service

Note: The mgsdemo.service script will automatically launch the 'mgs_quickstart' binary in the /bin/ directory. If using a different binary, you can either copy the binary as mgs_quickstart in /bin/ or modify the mgsdemo.service script to call the new binary name. 

Back to Top