...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
minLevel | 1 |
---|---|
maxLevel | 7 |
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. For a single application, using the BSP in its original state as provided by SECO Northern Europe, the SDK is recommended to be used. The following sections describe how to build a simple Hello World! application using the SDK.
Table of Contents | ||||
---|---|---|---|---|
|
How to install our SDK
...
With each releasesrelease, we also provide a compatible SDK. The SDK contains the cross-toolchain and several files like headers and libraries necessary to build software for SECO Northern Europe devices. It is available as download from the SECO Northern Europe support website.
...
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 keyPress Y for yes.
For more in-depth information, refer to the official Yocto documentation here.
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:
Code Block |
---|
$ cd ~ $ mkdir myapp $ cd myapp |
Create the empty files main.cpp and Makefile in this directory:
Code Block |
---|
$ touch main.cpp Makefile |
Edit the contents of the main.cpp file as follows:
Code Block |
---|
#include <iostream> using namespace std; int main(int argc, char *argv[]) { cout << "Hello World!" << endl; return 0; } |
Edit the contents of the Makefile as follows:
Code Block |
---|
myapp: main.cpp $(CXX) $(CXXFLAGS) -o $@ $< $(STRIP) $@ clean: rm -f myapp *.o *~ *.bak |
It is necessary to setup your build environment so that the compliercompiler, headers and libraries can be found. This is done by "sourcing" a build environment configuration file. If the toolchain is installed in the default directory, this example compiles for the target system by typing
Code Block |
---|
$ source /opt/guf/GUF-Yocto-rocko-12.5-0-IMX6GUF-sdk/environment-setup-imx6guf-guf-linux-gnueabi $ make |
in the myapp directory. The first line configures the current shell and sets the necessary environment variables. This needs to be done once as long as the shell stays openwhen shell is opened. In a new shell/terminal window or after a reboot you need to execute it again.
After a successful build, the maypp myapp executable is created in the myapp directory. You can transfer this application to the target system’s /usr/bin directory using one of the ways described in chapter [Accessing the target system] and execute it from the device shell. It might be necessary to change the access rights of the executable first, so that all users are able to execute it.
You can find further information about how to build applications for Yocto-based platforms here.
Qt-based GUI user application
...
Create a new directory in your home directory on the host system and change to it:
Code Block |
---|
$ cd ~ $ mkdir myqtapp $ cd myqtapp |
Create the empty files main.cpp and myqtapp.pro.
Code Block |
---|
$ touch main.cpp myqtapp.pro |
Edit the contents of the file main.cpp as follows:
Code Block |
---|
#include <QApplication> #include <QPushButton> int main(int argc, char *argv[]) { QApplication app(argc, argv); app.setOverrideCursor(Qt::BlankCursor); QPushButton hello("Hello World!"); hello.setWindowFlags(Qt::FramelessWindowHint); hello.resize(800, 480); hello.show(); return app.exec(); } |
Edit the contents of the file myqtapp.pro as follows:
Code Block |
---|
TEMPLATE = app TARGET = myqtapp QT = core gui widgets SOURCES += \ main.cpp |
After setting up the build environment, execute the following command to create a Makefile and build the binary in the myqtapp directory:
Code Block |
---|
$ qmake myqtapp.pro $ make |
Now, there is the myqtapp executable in the myqtapp directory. You can transfer this application to the target system’s /usr/bin directory and run it from the device shell.