Last edited 4 months 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

Check detailed prerequisites here.

2. Update the SDK environment for CMake

Please follow below steps if you need to add the missing OE_CMAKE_TOOLCHAIN_FILE variable to your SDK configuration

  • Open terminal and load the environment setup
 source /opt/st/stm32mp2/4.2.4-openstlinux-6.1-yocto-mickledore-mpu-v24.06.26/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
  • Please follow 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
  • Please follow instructions from here to know how to install the STM32MPU OpenSTLinux Developper Package for the STM32CubeIDE.
  • Please select the updated STM32MPU OpenSTLinux Developper Package by the X-LINUX-QT Developer Package.
5. Download the Demo example source code
 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
  • 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 default toolchain
  • Select OpenSTLinux SDK for the Toolchain field
  • Select your 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
  • 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 your board
  • Connect to your running board
 ssh root@192.168.7.1
  • Run the Demo's example (windowed mode)
 ./KDABBoatDemo
  • Check the running Demo example on your 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 your board's display
Running KDAB Boat Demo on target (Full screen Mode)