How to build and use an SDK for QT

Revision as of 14:55, 23 September 2020 by Registered User (→‎QT configuration)
Under construction.png Coming soon

For internal use only. Not to be published as is.

STMicroelectronics does not distribute an SDK for QT, but it can be built following the information in this article.

1. Prerequisites[edit source]

Being able to rebuild an OpenSTLinux image

2. Build image QT 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>

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. Select the display resolution[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

6. Hack QT EGLFS display size[edit source]

The 'FS' of EGLFS means 'Full Screen'. In full-screen conditions it's hard to replicate on standard ST boards the use cases of custom boards with small display. It is possible to modify the QT code to use a custom display size even with an EGLFS build.

Before building the image 'st-example-image-qt', modify the QT code with the following sequence:

 devtool modify qtbase my/qtbase
 cd my/qtbase

Edit the file src/platformsupport/kmsconvenience/qkmsdevice.cpp adding the lines below

  416          framebufferSize.setHeight(modes[selected_mode].vdisplay);
  417      }
     +     int w = qEnvironmentVariableIntValue("ST_W");
     +     int h = qEnvironmentVariableIntValue("ST_H");
     +     if (w && h) {
     +         framebufferSize.setWidth(w);
     +         framebufferSize.setHeight(h);
     +     }
  418
  419      qCDebug(qLcKmsDebug) << "Output" << connectorName << "framebuffer size is " << framebufferSize;

Then compile the image as above with

 bitbake st-example-image-qt

With this modified QT you can set the environment variables 'ST_W' and 'ST_H' to set the desired display size, e.g.:

 ST_W=320 ST_H=200 ./qt-app

Note: This hack will not work if either ST_W or ST_H contains a value that exceed the display size.

Note: The touchscreen is not impacted by this hack, so there would be a mismatch between the coordinates touched and the coordinates reported to the QT application.

7. 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.

8. 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