How to build and use an SDK for QT

Stable: 17.03.2023 - 12:50 / Revision: 17.03.2023 - 12:48

I am here to prevent the first-page-empty bug!

The OpenSTLinux distribution enables the generation of example images based on the QT framework (st-example-image-qt and, for ecosystem release ≥ v2.1.0 , st-example-image-qtwayland) for demonstration purposes, not for developing products.

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

1 Prerequisites

Be able to rebuild an OpenSTLinux image

2 OpenSTLinux QT images and SDK

OpenSTLinux distribution provides two examples of images based on the 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, first install the OpenSTLinux distribution by following the procedure described in chapter Installing the OpenSTLinux distribution.

2.1 QT image and SDK with weston/wayland

The QT image and SDK use QTwayland back-end to run QT applications in independent windows managed by weston. This requires ecosystem release ≥ v2.1.0 .

Initialize the OpenEmbedded build environment for the openstlinux-weston distro:

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

Read and accept EULA. Refer to Initializing the OpenEmbedded build environment for further details.

Then build the image and the SDK:

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

Refer to Generating your own Starter and Developer Packages and How to create an SDK for OpenSTLinux distribution for further details.

Note: the legacy command bitbake meta-toolchain-qt5 is not recommended 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 available in the tmp-glibc/deploy/sdk/ folder. It can be installed as described in Run the SDK installation script, using the following command:

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

2.2 QT image and SDK with EGLFS

The QT image and SDK use QT back-end to run single QT applications in full-screen mode.

Initialize the OpenEmbedded build environment for the openstlinux-eglfs distro:

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

Read and accept EULA. Refer to Initializing the OpenEmbedded build environment for further details.

Then build the image and the SDK:

 bitbake st-example-image-qt
 bitbake st-example-image-qt -c populate_sdk

Refer to Generating your own Starter and Developer Packages and How to create an SDK for OpenSTLinux distribution for further details.

Note: the legacy command bitbake meta-toolchain-qt5 is not recommended 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 available in the tmp-glibc/deploy/sdk/ folder. It can be installed as described in Run the SDK installation script, using the following command:

 ./tmp-glibc/deploy/sdk/st-example-image-qt-openstlinux-eglfs-stm32mp1-x86_64-toolchain-unknown revision -snapshot.sh -y -d <working directory absolute path>/Developer-Package/SDK

2.2.1 Selecting the display resolution and size in EGLFS

When using a display that accepts multiple resolutions, the preferred resolution can be specified 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 expands the application to run it in full screen. This can produce blurred images on the display and can impact the system performance.

The QT framework can be configured 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 Configuring the QT framework

By default, QT internal data use 64 bits per pixel (16 bits for each R, G, B and A component). The performance can be slightly improved by forcing the QT framework to use 32 bits per pixel (8 bits 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 and replacing the line

QT_CONFIG_FLAGS += " -no-sse2 -no-opengles3"

with

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

Note: the above setup can produce visible artefacts and has to be evaluated on a case by case basis.

4 Building a QT application

Open 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


IMPORTANT NOTICE – READ CAREFULLY
STMicroelectronics NV and its subsidiaries ("ST") reserve the right to make changes, corrections, enhancements, modifications, and improvements to ST products and/or to this document at any time without notice. Purchasers should obtain the latest relevant information on ST products before placing orders. ST products are sold pursuant to ST’s terms and conditions of sale in place at the time of order acknowledgment.

Purchasers are solely responsible for the choice, selection, and use of ST products and ST assumes no liability for application assistance or the design of purchasers’ products.

No license, express or implied, to any intellectual property right is granted by ST herein.

Resale of ST products with provisions different from the information set forth herein shall void any warranty granted by ST for such product.

ST and the ST logo are trademarks of ST. For additional information about ST trademarks, refer to www.st.com/trademarks. All other product or service names are the property of their respective owners.

Information in this document supersedes and replaces information previously supplied in any prior versions of this document.