Ensemble Graphics Toolkit: Preparing the Host PC and Target
Introduction
Contents
In this training topic, you will prepare a Host PC (native Linux® PC) and target (SAM9X60-EK) to develop applications using the Ensemble Graphics Toolkit (EGT), a C++ based graphical Linux toolkit for Microchip microprocessors.
Prerequisites
Be familiar with the features of the SAM9X60-EK Evaluation Kit.
A working cross-toolchain for Arm®-based MPU target is required.
- You can create a cross-toolchain in the "Preparing Host PC" section below.
Preparing the Target
You will use the SAM9X60-EK evaluation kit and a High-Performance WVGA Display Module with maXTouch® Technology LCD display for this training. Features of the display include:
- 800 x 480 TFT display
- maXTouch MXT640
- QTouch® QT1070 (with four navigation keys)
- 4 K-bit 1-wire EEPROM
- Integrated Projective Capacitive Touch (PCAP) panel
You also need:
- USB-A to USB Micro-B cable (included with the SAM9X60-EK)
- Ethernet crossover cable or two regular Ethernet cables and a network hub/switch
- SD Memory Card (with at least 2 GB)
The first step is attaching the WVGA Display to the SAM9X60-EK. Follow the instructions in "SAM9X60-EK - Attaching the TM5000 WVGA Display".
Ensure the configuration jumpers are in their default positions:
Preparing the Host PC
We recommend using a native Linux PC to develop embedded Linux applications.
Installation of software packages are performed using the Linux distributions’ software manager. In the accompanying examples, we will use the Debian Project’s Advanced Package Tool (apt), to install software packages on Debian, Ubuntu, and related Linux distributions.
Install development software.
To develop with the Ensemble Graphics Toolkit, you will need the following software:
$ sudo apt-get install build-essential automake autoconf libtool pkg-config libdrm-dev libinput-dev libcairo-dev libjpeg-dev libmagic-dev gettext git
Install recommended additional software.
The following software is optional, but recommended:
$ sudo apt-get install librsvg2-dev liblua5.3-dev libcurl4-openssl-dev libxkbcommon-dev xkb-data libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
$ sudo apt install libplplot-dev plplot-driver-cairo libasound2-dev libsndfile1-dev
$ sudo apt-get install subversion bison flex gettext libncurses5-dev texinfo mercurial git-core gperf gawk expat curl cvs libexpat-dev bzr unzip bc python-dev
Download and built the Ensemble Graphics Toolkit.
Download the Ensemble Graphics Toolkit source code and build:
$ git clone --recursive https://github.com/linux4sam/egt.git
$ cd egt
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install
Install Doxygen and build the Ensemble Graphics Toolkit Documentation.
Documentation for the Ensemble Graphics Toolkit will be located in the egt/docs directory.
$ sudo apt-get install doxygen
$ cd egt
$ make docs
Install Buildroot.
Download Buildroot and the Microchip Buildroot External Tree.
$ git clone https://git.buildroot.net/buildroot
$ git clone https://github.com/linux4sam/buildroot-external-microchip
Build using the default configuration file sam9x60ek_graphics_defconfig.
The default configuration will configure the build to generate a SD Memory Card image with Ensemble Graphics Toolkit support and a cross toolchain including a C++ cross compiler that you can use to develop graphical applications.
$ cd buildroot
$ BR2_EXTERNAL=../buildroot-external-microchip/ make sam9x60ek_graphics_defconfig
$ make
After a successful build…
- The SD card image (sdcard.img) for the SAM9X60-EK is available in the ~/buildroot-at91/output/images directory.
- The cross toolchain (arm-buildroot-linux-gnueabi-XX) is installed in the ~/buildroot-at91/output/host/bin directory.
- The sysroot directory containing the target headers, libraries, binaries, etc. are installed in the ~/buildroot-at91/output/host/arm-buildroot-linux-gnueabi/sysroot directory.
Flash sdcard.img to SD Memory Card:
The easiest method to flash an image to a SD Memory Card is to use the utility program balenaEtcher. It is available for Windows®, macOS®, or Linux. Always make sure you have the latest version of balenaEtcher.
Browse and select the image file you downloaded from the previous step.
Insert SD Memory Card to your PC:
Insert SD Memory Card to the SD Memory Card slot on your PC, if one is available. If not, use an external USB SD Memory Card reader.
Locate and select the SD Memory Card:
Once the SD Memory Card is inserted to your PC, Etcher will automatically detect it.
Flash:
This will take a few minutes.
Host PC and Target Setup
Once you have Prepared your Host PC and flashed the SD Memory Card image, it is time to connect the host PC with the SAM9X60-EK with the WVGA Display (otherwise known as the Target).
On the Host PC, start a terminal emulation program.
How-to information is available at: SAM9X60-EK – Console Serial Communications
Insert SD Memory Card into J4.
Connect the USB cable between the Host PC and J22 on the target.
This will power the J-Link portion of the target, LED D9 will light steady green, and the USB port will enumerate.
Power the target by plugging in +5VDC power to J1 -or- connecting a micro USB cable to J7.
Press the Reset Button (SW3).
On the Host PC, observe the target booting on the console (terminal emulator).
On the target console, you can login as “root” (no password).
Observe the Ensemble Graphics demonstration on the WVGA Display:
Host PC and Target LAN Connection
In this section, you will connect the Host PC with the Target via an Ethernet connection. As you develop Ensemble Graphics Toolkit applications the LAN connection provides a quick method to deploy your application to the target. It also provides a connection for remote debugging using GNU Debugger: gdb.
There are two methods by which you can establish a LAN connection:
Method 1: Dynamic IP addressing
This method requires connecting the Host PC and Target to an Ethernet Router using regular patch cables. Both the Host PC and Target will be issued an IP address from the embedded DHCP server in the router.
You can create an isolated workbench LAN with only the Host PC, Target, and Ethernet Router. Take care if the router is connected to the Internet, as both are exposed if they are not behind a firewall.
Method 2: Static IP addressing
This method requires configuring the Host PC and Target for static IP addresses. The accompanying steps are similar for both.
Connect the Ethernet cross-over cable between the Host PC and J5 on the target.
On the target console, configure a static IP address:
Open the text file /etc/network/interfaces with the text editor vi:
Edit the interfaces file below the auto eth0 as shown. Set the target’s static IP address as shown in the accompanying example:
.
.
auto eth0
iface eth0 inet static
address 10.0.0.20
netmask 255.255.255.0
.
.
Execute the following commands to configure the Ethernet interface eth0:
# ifdown eth0
# ifup eth0
# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.0.20 netmask 255.255.255.0 broadcast 10.0.0.255
inet6 fe80::5610:ecff:febe:a785 prefixlen 64 scopeid 0x20<link>
ether 54:10:ec:be:a7:85 txqueuelen 1000 (Ethernet)
RX packets 578 bytes 79907 (78.0 KiB)
RX errors 0 dropped 2 overruns 0 frame 0
TX packets 7 bytes 826 (826.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 30 base 0xc000
On the Host PC console, configure a static IP address:
Open the text file /etc/network/interfaces with the text editor vi (or your favorite text editor):
# vi /etc/network/interfaces
Edit the interfaces file below the auto eth0 as shown. Set the target’s static IP address as shown in the accompanying example:
.
.
auto eth0
iface eth0 inet static
address 10.0.0.10
netmask 255.255.255.0
.
.
Execute the following commands to configure the Ethernet interface eth0:
# ifdown eth0
# ifup eth0
# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet addr:10.0.0.10 netmask 255.255.255.0 broadcast 10.0.0.255
inet6 fe80::68a4:7c4e:cce0:a6ad prefixlen 64 scopeid 0x20<link>
ether f8:16:54:51:36:3c txqueuelen 1000 (Ethernet)
RX packets 423889 bytes 582081068 (582.0 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 61446 bytes 9709881 (9.7 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Test the Ethernet connection:
Ping the Host PC from the target console. Exit the ping command by typing CTRL-C:
# ping 10.0.0.10
PING 10.0.0.10 (10.0.0.10) 56(84) bytes of data.
64 bytes from 10.0.0.10: icmp_seq=1 ttl=128 time=1.48 ms
64 bytes from 10.0.0.10: icmp_seq=2 ttl=128 time=1.15 ms
--- 10.0.0.10 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1009ms
rtt min/avg/max/mdev = 1.156/1.318/1.480/0.162 ms
You may also ping the target from the Host PC:
$ sudo ping 10.0.0.20
Target Root Password Setup
In this section you will create a password for the target’s root account. This is necessary when developing over a remote connection. You will be using the secure SSH connection to deploy applications from the Host PC to the target.
On the target console, enter a password for the root account:
# passwd
Changing password for root
New password:
Retype password:
Password for root changed by root
Summary
At the end of this topic, you have created a development platform (preferably a native Linux computer) for the development of graphics applications on Microchip microprocessor devices.
The steps you followed were:
- Preparing the Target
- Preparing the Host PC
- Host PC and Target Setup
- Host PC and Target LAN Connection
- Target Root Password Setup