When we develop a Qt application for an embedded system, we edit code in QtCreator running on a desktop computer, press the Run button, and have QtCreator run the application on the embedded device – many times per day. We also want to switch between desktop and embedded builds without restarting QtCreator. We perform the many tiny TDD steps on the desktop computer and inspect our work from time to time on the embedded device.
I have spent many hours on several occasions to “convince” QtCreator and CMake to work together seamlessly. QtCreator and CMake are pretty good at producing a never-ending stream of problems. Installing the executables and libraries on the device fails. The detection of the C and C++ compilers fails. QtCreator refuses to update its project configuration with modified CMake settings. The CMake toolchain file is buggy or missing. QtCreator forgets some but not all run and deployment settings.
With minimum user input, the installer of the commercial Boot2Qt SDK creates the CMake toolchain files and the configuration files for a QtCreator kit. QtCreator auto-detects the kit when restarted. Cross-compilation, deployment, and execution of Qt applications for an embedded device work out of the box. We want the same smooth setup experience with non-commercial Qt SDKs, too!
Non-commercial Qt SDKs lack the CMake toolchain file that does not depend on the environment variables of a Yocto SDK. This toolchain file is required for switching between desktop and embedded builds without restarting QtCreator. I’ll provide a script that generates the missing CMake toolchain file.
Non-commercial Qt SDKs also lack the QtCreator configuration files for the kit, Qt version, C/C++ compilers, CMake configuration, and device. Boot2Qt comes with a script that generates these configuration files using the undocumented QtCreator utility sdktool. As the script is distributed under GPLv3, we can modify and use it. I’ll extend the script to generate the correct configuration files.
I use the scripts to set up QtCreator for cross-compilation with CMake and for deploying and running a Qt application on a Toradex Verdin i.MX8M Mini board. When I press the Run button in QtCreator, some magic will happen!
About the speaker
Burkhard Stubert, Solo Consultant for Qt Embedded Systems
As a solo consultant, Burkhard helps companies succeed with Qt embedded systems. His major products include the infotainment system for a US car OEM, the driver terminal of the ROPA sugar beet harvesters and the driver terminal of the Krone forage harvesters.
Many customers ask Burkhard to support them with their first in-house development of a Qt embedded system. Based on 25 years of experience, he can select suitable hardware, build custom-Linux systems with Yocto and create long-lived system architectures. He improves the development processes of the teams he works with. Burkhard is an outspoken proponent of using Qt under LGPLv3 and knows how to ensure FOSS license compliance of Qt embedded systems.
Burkhard worked and lived in India, England and Norway and moved back to his native country, Germany, a couple of years ago. In his spare time, he is hiking, biking, and skiing through the Bavarian Alpes.
View the slides for this presentation here…