Building Microchip Graphics Suite (MGS) for Embedded Linux®
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®.
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.
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>
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 ../..
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.
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/
Download and copy the <rootfs>/usr/lib/systemd/system/.
tosudo cp mgsdemo.service <rootfs>/usr/lib/systemd/system/
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