How to build and use an SDK for QT

Revision as of 16:47, 28 October 2020 by Registered User
Under construction.png For internal use only. Not to be published as is.

The OpenSTLinux distribution offers the possibility to generate examples of images based on the QT framework ((st-example-image-qt and, for ecosystem release ≥ v2.1.0 , st-example-image-qtwayland) as demonstrators, not for developing products.

This article provides information on how to create the SDK for building QT applications based on the example images above.

1. Prerequisites[edit source]

Being able to rebuild an OpenSTLinux image

2. OpenSTLinux QT images and SDK[edit source]

OpenSTLinux distribution provides two examples of images based on QT framework:

  • st-example-image-qtwayland (requires 'openstlinux-weston' distro and ecosystem release ≥ v2.1.0 ); thanks to weston window management, QT applications are displayed in independent windows and can coexist on the same screen with other non-QT applications;

To build the images and the associated SDK, the first step requires installing the OpenSTLinux distribution through the steps listed in chapter Installing the OpenSTLinux distribution.

2.1. QT image and SDK with weston/wayland[edit source]

Under construction.png patches not merged yet in openSTlinux

This image and SDK will use QTwayland backend to run QT applications in independent windows managed by weston.

Initialize the OpenEmbedded build environment for the openstlinux-weston distro

 DISTRO=openstlinux-weston MACHINE=stm32mp1 source layers/meta-st/scripts/envsetup.sh

and read and accept EULA. Further details are available in Initializing the OpenEmbedded build environment.

Then build the image and the SDK

 bitbake st-example-image-qtwayland
 bitbake st-example-image-qtwayland -c populate_sdk

Further details are available in Generating your own Starter and Developer Packages and How to create an SDK for OpenSTLinux distribution.

Note: the legacy command bitbake meta-toolchain-qt5 is not suggested because the resulting SDK would miss some target packages.

The image can be flashed on the target board as in Flashing the built image.

The generated SDK is in folder tmp-glibc/deploy/sdk/. It can be installed as described in Run the SDK installation script, with the command

 ./tmp-glibc/deploy/sdk/st-example-image-qtwayland-openstlinux-weston-stm32mp1-x86_64-toolchain-3.1-snapshot.sh -y -d <working directory absolute path>/Developer-Package/SDK


2.2. QT image and SDK with EGLFS[edit source]

after (refrase this or link to another page)

 repo init ...
 repo sync

select the proper machine and distribution

 DISTRO=openstlinux-eglfs MACHINE=stm32mp1 source layers/meta-st/scripts/envsetup.sh

and read and accept EULA.

Then build the QT image and the QT SDK

 bitbake st-example-image-qt
 bitbake meta-toolchain-qt5

The image can be flashed as usual (add link). Install the SDK in a folder (check if we suggest a folder):

 ./tmp-glibc/deploy/sdk/meta-toolchain-qt5-openstlinux-eglfs-stm32mp1-x86_64-toolchain-3.1-snapshot.sh -y -d <install_path_sdk>

2.2.1. Select display resolution and size in EGLFS[edit source]

When using a display that accepts multiple resolutions, it is possible to specify the preferred resolution by editing the board file /usr/share/qt5/cursor.json. For example, for an HDMI display, change the line

{ "name": "HDMI1", "mode": "1280x720" },

and enter one of the valid resolutions reported by the command

 modetest

If the current display resolution is higher than the resolution requested by the QT application, QT will expand the application to run it in full screen. This can produce blurred images on the display and can impact the system performance.

It is possible to configure QT to use only one part of the overall display. For example, to use only an area of 400x300 pixels, add:

{ "name": "HDMI1", "mode": "1280x720", "size": "400x300" },


3. QT configuration[edit source]

By default, QT internal data use 64 bit per pixel (16 bit for each R, G, B, A components). It is possible to slightly improve the performance by forcing QT to use 32 bit per pixel (8 bit for each component). This can be achieved by editing the file layers/meta-st/meta-st-openstlinux/recipes-qt/qt5/qtbase_git.bbappend before the build

-QT_CONFIG_FLAGS += " -no-sse2 -no-opengles3"
+QT_CONFIG_FLAGS += " -no-sse2 -no-opengles3 -no-feature-raster-64bit"

The above setup can produce visible artefacts, so has to be evaluated case by case.

4. Build a QT application[edit source]

Enter in the folder that contains the application, enable the QT SDK and compile the application

 cd <path_of_app>
 . <install_path_sdk>/environment-setup-cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi
 qmake && make


5. Text taken from QT framework[edit source]

Qt[1][2][3] is a cross-platform application framework that is used to develop graphical user interfaces (GUIs) and multiplatform applications.

meta-qt5[4] is a Yocto compatible meta layer that provides recipes for Qt modules.

The OpenSTLinux distribution is ready to link with this meta layer.

The OpenSTLinux distribution offers the possibility to use an example of an image based on the QT framework (st-example-image-qt) as a demonstrator, not for developing products. For Qt-based products, the list of STMicroelectronics partners can be found on STMicroelectronics web site.

6. Reference list[edit source]

  1. https://www.qt.io/ Qt home page
  2. https://www.qt.io/qt-for-device-creation/ Qt for Embedded Devices
  3. https://www.qt.io/qt-for-application-development/ Qt for Application Development
  4. https://github.com/meta-qt5/meta-qt5/ Qt5 OpenEmbedded/Yocto Project layer