Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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.

...

Info

Windows users can simply use WSL (Windows Subsystem for Linux)

e.g. Ubuntu 22.04.3 LTS (GNU/Linux 5.15.167.4-microsoft-standard-WSL2 x86_64)

The SDK file is named like seconorth-wayland-glibc-x86_64-seconorth-image-cortexa9t2hf-neon-seco-mx6-toolchain-kirkstone-27.0.sh.

...

The installer will ask you if you want to install the SDK into a subfolder in /opt. Just press enter to allow the default location or create your own folder.

...

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;
}

Compile a command-line Application

Edit the contents of the Makefile as follows:

Code Block
myapp: main.cpp
  $(CXX) $(CXXFLAGS) -o $@ $<
  $(STRIP) $@
clean:
  rm -f myapp *.o *~ *.bak

...

After a successful build, the 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.

...

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.