Last edited one month ago

X-LINUX-QT How To build Qt applications using STM32CubeIDE



This article aims to give the following information:

  • How to use the X-LINUX-QT Developer Package to build Qt applications for the STM32 microprocessor series.
1. Prerequisites[edit | edit source]

Check detailed prerequisites here.


2. Update the SDK environment for CMake[edit | edit source]

Please follow the steps below if it is necessary to add the missing OE_CMAKE_TOOLCHAIN_FILE variable to the SDK configuration.

  • Open the terminal and load the environment setup:
 source /opt/st/stm32mp2/5.0.3-openstlinux-6.6-yocto-scarthgap-mpu-v24.11.06/environment-setup-cortexa35-ostl-linux
  • Add the missing OE_CMAKE_TOOLCHAIN_FILE variable to the qt6 environment file:
 echo "export OE_CMAKE_TOOLCHAIN_FILE=\"\$OECORE_NATIVE_SYSROOT/usr/lib/cmake/Qt6/qt.toolchain.cmake\"" >> $OECORE_NATIVE_SYSROOT/environment-setup.d/qt6.sh
3. Install the STM32CubeIDE[edit | edit source]
  • Follow the instructions from here to know how to install and use the STM32CubeIDE.
4. Select the updated OpenSTLinux SDK by the X-LINUX-QT Developer Package.[edit | edit source]
  • Follow the instructions from here to know how to install the STM32MPU OpenSTLinux Developper Package for the STM32CubeIDE.
  • Select the updated STM32MPU OpenSTLinux Developper Package by the X-LINUX-QT Developer Package.
5. Download the demo example source code[edit | edit source]
 mkdir -p /opt/st/demos/Qt
 cd /opt/st/demos/Qt
 git clone https://github.com/KDABLabs/KDBoatDemo.git -b qt6
6. Build the demo example[edit | edit source]
  • Import the Project from STM32CubeIDE.
  • Start a new STM32 CMake Project:
STM32CubeIDE New CMake Project 01.png


  • Select Project with existing CMake sources:
STM32CubeIDE New CMake Project 02.png


  • Fill the Project name and source directory.
  • Project name = KDBoatDemo
  • Source directory = /opt/st/demos/Qt/KDBoatDemo
STM32CubeIDE New CMake Project 03.png


  • Configure the default toolchain.
  • Select OpenSTLinux SDK for the Toolchain field.
  • Select the installed OpenSTLinux SDK (openstlinux-6.1-yocto-mickledore-mpu-v24.06.26) for the Version field.
STM32CubeIDE New CMake Project 04.png


  • Build the Project.
  • Select the project from the list and press the Build button:
STM32CubeIDE Build CMake Project 01.png
  • Wait until the build is finished and make sure it is done successfully:
STM32CubeIDE Build CMake Project 02.png
7. Deploy the demo example to your running board[edit | edit source]
  • Copy the example's binary into your connected board:
 cd /opt/st/demos/Qt
 scp config_default/KDABBoatDemo root@192.168.7.1:/home/root/.
8. Run the demo example on the board[edit | edit source]
  • Connect to the running board:
 ssh root@192.168.7.1
  • Run the demo's example (windowed mode):
 ./KDABBoatDemo
  • Check the running demo example on the board's display:
Running KDAB Boat demo on target (Windowed Mode)
  • Run the demo's example (Full screen mode):
 ./KDABBoatDemo --fullscreen
  • Check the running demo example on the board's display:
Running KDAB Boat demo on target (Full screen Mode)