Last edited one week ago

How to build Qt applications using Qt Creator

Applicable for STM32MP13x lines, STM32MP15x lines, STM32MP21x lines, STM32MP23x lines, STM32MP25x lines

Information
This version of X-LINUX-QT expansion package is compatible with ecosystem release v7.0.0 .

This article explains how to use the X-LINUX-QT developer package to build Qt applications for the STM32 microprocessor series. It has been written for STM32MP2 series but it can be adapted easily to STM32MP1 series.

The validation and snapshots of this article have been made with previous X-LINUX-QT expansion package version, but can be easily translated to other releases.

1. Prerequisites[edit | edit source]

Check first, detailed prerequisites in X-LINUX-QT_expansion_package#Prerequisites and X-LINUX-QT Developer Package#Prerequisites.

The Qt™ Creator[1] tool is used to build, debug and run applications demos on target.

The X-LINUX-QT developer package is up and running on your board. For that, follow information provided in X-LINUX-QT Developer Package article.

2. Install the Qt Creator[edit | edit source]

  • The Qt™ Creator can be downloaded and installed following this link.
  • The Qt™ online installer can be downloaded following this link.

3. Create and configure a new STM32MPU Kit[edit | edit source]

This new STM32MPU Kit must be created and configured manually. Please refer to Qt documentation: https://doc.qt.io/qtcreator/creator-preferences-kits.html

4. Select the Qt project example[edit | edit source]

Information
Qt6 6.11.2 must be installed in order to have the list of examples for that Qt version.

Once the Qt™ Creator is launched and the Welcome to Qt™ Creator is displayed:

  • Go to the Examples from the list on the left,
  • Then select the new Qt6 6.11.2 from the dropdown list.

The supported examples are then displayed.

Qt™ Creator Welcome Screen - Qt6 Examples - Picture is not contractual (based on previous Qt6 6.5.3 version)
  • Search for a specific example in the Search bar in front of the selected kit.
  • Select the example you are looking for (just a simple click on it).
Qt™ Creator Welcome Screen - Select the example - Picture is not contractual (based on previous Qt6 6.5.3 version)
  • Close the "Help window" if not needed.
Qt™ Creator Welcome Screen - The example's Help window - Picture is not contractual (based on previous Qt6 6.5.3 and OpenSTLinux versions)

5. Configure the project example[edit | edit source]

  • Make sure that the new STM32MPU kit added is selected
  • Press the Configure Project button:
Qt™ Creator - Configure Project - Picture is not contractual (based on previous Qt6 6.5.3 and OpenSTLinux versions)
  • Make sure all configuration steps are successfully done (green bars):
Qt™ Creator - Project Configuration Status

6. Running configuration for the STM32MPU Kit[edit | edit source]

  • Select the Configure Project button from the vertical bar on the left.
  • Select the new Kit added.
  • Select Run Settings.
  • On the right panel, scroll down till the Environment section.
  • Press the Details button.
  • Add the below environment variables:
XDG_RUNTIME_DIR=/run/user/1000
QT_QPA_PLATFORM=wayland
QT_VULKAN_LIB=/usr/lib/libvulkan.so.1
Qt™ Creator - Configure Run Settings - Picture is not contractual (based on previous Qt6 6.5.3 and OpenSTLinux versions)

7. Build and run the project[edit | edit source]

  • Make sure that the board is connected to the host machine via the USB DRD TypeC connector. for that, follow the instructions from the X-LINUX-QT expansion package#Hardware prerequisites section and check how to get your board connected to the host machine.
  • Once in the Run Setting panel, the notice below should not appear at the bottom of the screen.
Qt™ Creator - Run Project - Picture is not contractual (based on previous Qt6 6.5.3 and OpenSTLinux versions)
  • Press the Run button from the vertical bar on the left to build, deploy and run the selected example on the connected board.
Qt™ Creator - Run Project - Picture is not contractual (based on previous Qt6 6.5.3 and OpenSTLinux versions
  • If everything went well, then the example will be running on the connected board.
The Quick Items example running on the target