GUF-Yocto-jethro-9.0-r7707-0
i.MX6
User Manual
7
Building and running a user application
There are two general ways of building your own native application for the target: it can be built either manually,
using the cross toolchain of the SDK, or integrated into the BSP, using Yocto and bitbake as a build system.
Integrating the application into the BSP build process is the more complex way and useful only if you have
modified the BSP and want to deploy a complete root file system image to the target anyway (see
[
I
a Garz & Fricke Yocto Linux system from source]
). For a single application, using the BSP in its original state as
provided by Garz & Fricke, the SDK is recommended to be used. The following sections describe how to build a
simple
Hello Wold!
application using the SDK.
In addition to running native applications, the device can also be configured to display a website using Qt Webkit.
The Garz & Fricke Linux BSP comes with a configurable web demo application, which is covered in a separate
section of this chapter.
7.1
SDK installation
The SDK contains the cross-toolchain and several files like headers and libraries necessary to build software for
i.MX6. It is available as download from the Garz & Fricke support website. The sdk was tested with Ubuntu 14.04
Desktop (amd64), other destributions might work but 32bit systems will not. In that case you have to build the
sdk yourself using the bsp as described in
[
I
8.4 Building the BSP for the target platform]
http://support.garz-fricke.com/projects/Santaro/Linux-Yocto/Releases/Yocto-jethro-9.0-r7707-0/sdk
The SDK file is a self-extracting archive that is supposed to run on Linux based machines. It is named something
like
GUF-Yocto-jethro-9.0-r7707-0-sdk.sh
. Run this file on your development PC:
$sh <SDK location>/GUF-Yocto-jethro-9.0-r7707-0-sdk.sh
The installer will ask you if you want to install the SDK into a subfolder in
/opt
. Supposed this is what you want
press the
y
key.
Example output:
Enter target directory for SDK (default: /opt/guf/GUF-Yocto-jethro-9.0-r7707-0-sdk):
You are about to install the SDK to "/opt/guf/GUF-Yocto-jethro-9.0-r7707-0-sdk".
,!
Proceed[Y/n]?
Extracting SDK...done
Setting it up...done
SDK has been successfully set up and is ready to be used.
Now that the SDK is installed you may proceed and write your first application for the embedded device.
7.2
Simple command-line application
We will create a simple C++ "Hello World!" application that uses a Makefile and the supplied SDK. Create a
directory in your home directory on the host system and change to it:
$ cd ~
$ mkdir myapp
$ cd myapp
Create the empty files
main.cpp
and
Makefile
in this directory:
$ touch main.cpp Makefile
Edit the contents of the main.cpp file as follows:
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
48