Ensemble Graphics Toolkit -- Preparing the Host PC and Target

Introduction

In this training, 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.

Steps:


Prerequisites

Be familiar with the features of the SAM9X60-EK Evaluation Kit.

A working cross-toolchain for ARM-based MPU target is required.


Preparing the Target

You will use the SAM9X60-EK evaluation kit and a High-Performance WVGA Display Module with Max-Touch® 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)
sam9x60-ek-and-wvga.png

The first step is attaching the WVGA Display to the SAM9X60-EK. Follow the instructions in "SAM9X60-EK -- Attaching the TM5000 WVGA Display".

sam9x60-ek-wvga-assembled.png

Ensure the configuration jumpers are in their default positions:

SAM9X60_EK_jumpers.png
SAM9X60_EK_jumper_defaults.png

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 examples below, we will use the Debian Project’s Advanced Package Tool (apt), to install software packages on Debian, Ubuntu, and related Linux distributions.

1

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

2

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

3

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

4

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

To see a list of the available classes, open /egt/docs/html/annotated.html and click on egt::v1. To learn more information about a particular class, click on the class name.

5

Install Buildroot.

Download Buildroot and the Microchip Buildroot External Tree.

Ensure that you download the latest version of buildroot and buildroot-external-microchip. For more information see Clone with Git.

6

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

If building Buildroot for a different evaluation kit, you may use the following defconfigs:

  • sama5d27_som1_ek_graphics_defconfig
  • sama5d27_wlsom1_ek_graphics_defconfig

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.

The cross toolchain that is built using the default configuration file sam9x60ek_graphics_defconfig will include a C++ cross-compiler. The screen capture below shows the cross toolchain settings that were enabled:

cross-toolchain-settings.png

Buildroot can export the cross toolchain and the development files of selected packages, as a Software Development Kit (SDK), by running the command: make sdk

$ cd buildroot
$ make sdk

This generates a tarball of the content of the host directory ~/buildroot-at91/output/host/, named <TARGET-TUPLE>_sdk-buildroot.tar.gz. This tarball can then be distributed to application developers to develop applications that are not packaged as a Buildroot package.

$ tar -xvf <TARGET-TUPLE>_sdk-buildroot.tar.gz .

Upon extracting the SDK tarball, the application developer must run the script relocate-sdk.sh (located at the top directory of the SDK), to make sure all paths are updated with the new location.

$ cd <TARGET-TUPLE>_sdk-buildroot/
$./relocate.sh

7

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.

a

Locate and select the image:

Browse and select the image file you downloaded from the previous step.

Etcher_Select_Image.png

b

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.

c

Locate and select the SD Memory Card:

Once the SD Memory Card is inserted to your PC, Etcher will automatically detect it.

Etcher_Select_Drive.png

d

Flash:

This will take a few minutes.

Etcher_Flash.png

That’s it. You’ve made all the preparations for your host PC to develop Ensemble Graphics Toolkit applications.


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).

1

On the Host PC, start a terminal emulation program.

How-to information is available at: SAM9X60-EK – Console Serial Communications

sam9x60-ek-connections.png

2

Insert SD Memory Card into J4.

3

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.

4

Power the target by plugging in +5VDC power to J1 -or- connecting a micro USB cable to J7

J1 – External Power jack is a 2.1 mm coaxial connector, center positive.

5

Press the Reset Button (SW3).

6

On the Host PC, observe the target booting on the console (terminal emulator).

7

On the target console, you can login as “root” (no password).

Observe the Ensemble Graphics demonstration on the WVGA Display:

egt_splash_screen.png

You have completed booting the image on the SD Memory Card.

Before you can run another graphics application, you must stop the Ensemble Graphics demonstration program.

To stop the Ensemble Graphics demonstration program, you must stop the init script that runs the egt-launcher. On the Target Console, type the following command:

# /etc/init.d/S99demo stop


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 in 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 steps below are similar for both.

1

Connect the Ethernet cross-over cable between the Host PC and J5 on the target.

2

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 below. Set the target’s static IP address as shown in the example below:

When you start the vi editor you will be in command mode. Use the arrow keys to place the cursor next to the text you wish to edit.

To start editing, type the letter “i” (insert mode). You can delete text while in insert mode using the delete or back-space keys. To exit insert mode, type ESC.

To exit without saving changes, insure you are in command mode and type :q!

To save and quit, insure you are in command mode and type :wq or ZZ

.
.
auto eth0
iface eth0 inet static
  address 10.0.0.20
  netmask 255.255.255.0
.
.

3

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

4

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 below. Set the target’s static IP address as shown in the example below:

.
.
auto eth0
iface eth0 inet static
  address 10.0.0.10
  netmask 255.255.255.0
.
.

Ensure that the Host PC and Target do not have the same IP address. All IP addresses on the LAN must be unique.

5

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

6

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

You have completed creating an Ethernet connection between the Host PC and the target.


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.

The SSH server will not allow a secure connection with an account that does not have a password.

1

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

You may get a warning message if the password is too weak or too short.

You have completed creating a password for the target’s root account.


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

What’s Next?

Next: Ensemble Graphics Toolkit – First Application using the Eclipse IDE

© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.