- ...
- SDK
- Yocto
- ...
- ...
- your first application
- tools
- ...
- Qt: register
- Qt: create project
Using Qt Creator#
To develop Qt application Qt Creator is probably the way to go IDE. But in order to cross compile the application for the target you want, it has to be configured first. Indeed the first time you want to use the Yocto SDK you will have to add a new development kit for your device adding:
a device
a development kit using:
a Qt version
a compiler
a debugger
a CMake
Then each project must be configured to use that new kit, and to use SimpleSwitch™ commands to build, deploy and run the application.
These 2 configuration steps could be done thanks to 2 scripts:
- qtcreator-kit-configurator
- qtcreator-project-configurator
In order to use the scripts to configure Qt Creator please refer to Option 1: configure Qt Creator using scripts. Naturally it is possible to configure Qt Creator manually, in that case please refer to Option 2: configure Qt Creator manually.
Source Yocto SDK environment
The Yocto SDK environment must be sourced to call the configurator scripts and to start Qt Creator. So you can start Qt Creator thanks to a terminal doing:
. /opt/sc/0.1.0/sm2s-imx8plus/environment-setup-cortexa53-crypto-simplecoredistro-linux
qtcreator
Option 1: configure Qt Creator using scripts#
Adding a kit and a device using the script#
The script to add a new device and kit is qtcreator-kit-configurator
.
With that tools three arguments should be used:
-a
to choose the address IP of the device.-c
to select the path to the Qt Creator configuration directory.-n
to choose the name of the new kit.
So for example if:
you had installed Qt Creator from the Ubuntu deb package, the configuration path should be
~/.config/QtProject/qtcreator/
.the IP address of the target is
192.168.0.46
the SDK is made for an
sm2s-imx8plus
You could just do:
SIMPLESWITCH_TEMPLATE=qt6commercial qtcreator-kit-configurator -a 192.168.0.46 -c ~/.config/QtProject/qtcreator/ -n sm2s-imx8plus-kit
## On your computer run
qtcreator-kit-configurator -a 192.168.0.46 -c ~/.config/QtProject/qtcreator/ -n sm2s-imx8plus-kit
Configure a project using the script#
Note
Only projects using Qmake build system can be configured by the script for the moment.
The script to configure the project is qtcreator-project-configurator
.
With that script, 2 arguments are mandatory:
-n
to choose the kit name for which the script will configure the project.-p
to choose the path to the project configuration file (thepro.user
one). This file is created the first time Qt Creator open the project.
If you already have a project but you have no .pro.user
file, you could do:
Start Qt Creator.
Open the project created using the Qt Creator menu
File
, thenOpen File or Project...
and browsing to the.pro
file.Make sure the Yocto toolchain kit is activated in the
Build & Run
section.Close Qt Creator
If you have no project for the moment, you can create one thanks to Qt Creator:
Start Qt Creator.
Create the project using the Qt Creator menu
File
, thenNew File or Project...
and answering the questions. The 2 import options is to chooseqmake
asBuild System
and to select the wantedKits
you configured previously.Close Qt Creator
Now it is possible to call qtcreator-project-configurator
. For example if:
the Qt kit is called
sm2s-imx8plus-kit
the path to the project configuration file is
~/helloworld/helloworld/helloworld.pro.user
(file which should have been created the first time you open the project with Qt Creator).
You could do:
## On your computer run
SIMPLESWITCH_TEMPLATE=qt6commercial qtcreator-project-configurator -n sm2s-imx8plus-kit -p ~/helloworld/helloworld/helloworld.pro.user
## On your computer run
qtcreator-project-configurator -n sm2s-imx8plus-kit -p ~/helloworld/helloworld/helloworld.pro.user
Select the Kit and build mode#
The last step before compiling and deploying the SimpleSwitch™ package is to
select the Kit and the build mode. Thanks to the menu Build
then
Open Build and Run Kit Selector..
, you can then select them.

You CAN’T use the button Start debugging of startup project
. If you just
want to start the application select the Release build mode
and click on the Run
button. If you want to start a debugger select instead
the Debug build mode
and click on the Run button
. It starts a gdbserver
in the SimpleSwitch™ container.
In order to start the debugging session just go in the menu Debug
then
Start debugging
then Attach to Running Debug Server...
. Check that
kit you configure previously is used, select the port 2159
, select the path
of the local executable in the Debug
build directory. Verify that the
Use target extented-remote to connect
is unchecked. Finally press OK
.

Option 2: configure Qt Creator manually#
Adding a kit and a device manually#
Depending on your Qt Creator version, the tabs could not be organized exactly the same way as in the following documentation.
Add a device#
Click on the
Tools
menu thenOptions...
.Select
Devices
in the left panel.Click on
Add
, chooseGeneric Linux Device
, then click onStart Wizard
.Enter a name for your device, the IP address of the board, and use
root
asusername
.Continue and check that the
Device Test
is able to connect to your board.

Add a Qt version#
Click on the
Tools
menu thenOptions...
.Select
Kits
in the left panel.Click on
Qt Versions
tab.Click on
Add
and browse to find theqmake
executable found in the Yocto SDK. If you didn’t change the default installation path it should be:
/opt/sc/0.1.0/sm2s-imx8plus/sysroots/x86_64-simplecoredistrosdk-linux/usr/bin/qmake
Adapt the name of the version.

Add a Compiler#
Click on the
Tools
menu thenOptions...
.Select
Kits
in the left panel.Click on
Compilers
tab.Click on
Add
, then chooseGCC
and finally chooseC
.Adapt the name of the compiler.
Browse to find the gcc executable found in the Yocto SDK. If you didn’t change the default installation path it should be:
/opt/sc/0.1.0/sm2s-imx8plus/sysroots/x86_64-simplecoredistrosdk-linux/usr/bin/aarch64-simplecoredistro-linux/aarch64-simplecoredistro-linux-gcc
Repeat the process adding a
GCC
compiler for theC++
choosing:
/opt/sc/0.1.0/sm2s-imx8plus/sysroots/x86_64-simplecoredistrosdk-linux/usr/bin/aarch64-simplecoredistro-linux/aarch64-simplecoredistro-linux-g++

Add a Debugger#
Click on the
Tools
menu thenOptions...
.Select
Kits
in the left panel.Click on
Debuggers
tab.Click on
Add
.Adapt the name of the debugger.
Browse to find the
gdb
executable found in the Yocto SDK. If you didn’t change the default installation path it should be:
/opt/sc/0.1.0/sm2s-imx8plus/sysroots/x86_64-simplecoredistrosdk-linux/usr/bin/aarch64-simplecoredistro-linux/aarch64-simplecoredistro-linux-gdb

Add CMake#
Click on the
Tools
menu thenOptions...
.Select
Kits
in the left panel.Click on
CMake
tab.Click on
Add
.Adapt the name of the CMake.
Browse to find the
cmake
executable found in the Yocto SDK. If you didn’t change the default installation path it should be:
/opt/sc/0.1.0/sm2s-imx8plus/sysroots/x86_64-simplecoredistrosdk-linux/usr/bin/cmake

Add a Kit#
Click on the
Tools
menu thenOptions...
.Select
Kits
in the left panel.Click on
Kits
tab.Click on
Add
.Adapt the name of the Kit.
As
Device type
chooseGeneric Linux Device
As
Device
,Compiler
,Debugger
,Qt version
andCMake Tool
choose the ones you created previously.As
Sysroot
browse to find the sysroot of the target in the Yocto SDK. If you didn’t change the default installation path it should be:
/opt/sc/0.1.0/sm2s-imx8plus/sysroots/cortexa53-crypto-simplecoredistro-linux/
As
Qt mkspec
add the mkspec of the target in the Yocto SDK. If you didn’t change the default installation path it should be:
/opt/sc/0.1.0/sm2s-imx8plus/sysroots/cortexa53-crypto-simplecoredistro-linux/usr/lib/mkspecs/linux-oe-g++

Configure a project manually#
If you already have a project open it using the menu File
, then
Open File or Project...
and browsing to the .pro
file of the project.
Else create a project using the menu File
, then New File or Project...
and answering the questions. The 2 import options is to choose qmake
as
Build System
and to select the wanted Kits
you configured previously.
Then:
Select the
Projects
configuration tab (on the left of the screen).Make sure the Yocto toolchain kit is activated in the
Build & Run
section and is configured to run on the device you added (Run
/Run
section)In the
Build
section we will modify the configuration for both theDebug
build configuration and theRelease
build configuration. It is possible to select which build configuration we are modifying thanks to the menu on the top of the page.For the
Release
build configuration mode, modify theBuild Steps
section, disablingMake
step (DON’T remove it).In this same section, add a new
Custom Process Steps
to create the SimpleSwitch™ package:
Command:
simpleswitch-generate-package
Arguments:
--name %{ActiveProject:Name} --makefile-dir %{buildDir} --template qt6commercial --allow-update --startup-command /opt/%{ActiveProject:Name}/bin/%{ActiveProject:Name}
Working directory:
%{buildDir}/..
Command:
simpleswitch-generate-package
Arguments:
--name %{ActiveProject:Name} --makefile-dir %{buildDir} --template qt6 --allow-update --startup-command /opt/%{ActiveProject:Name}/bin/%{ActiveProject:Name}
Working directory:
%{buildDir}/..

Then edit the
Build Steps
for theDebug
configuration mode. Again disable theMake
step (DON’T remove it).In this same section, add a new
Custom Process Steps
to create the SimpleSwitch™ package:
Command:
simpleswitch-generate-package
Arguments:
--name %{ActiveProject:Name} --makefile-dir %{buildDir} --template qt6commercial --allow-update --startup-command "gdbserver :2159 /opt/%{ActiveProject:Name}/bin/%{ActiveProject:Name}"
Working directory:
%{buildDir}/..
Command:
simpleswitch-generate-package
Arguments:
--name %{ActiveProject:Name} --makefile-dir %{buildDir} --template qt6 --allow-update --startup-command "gdbserver :2159 /opt/%{ActiveProject:Name}/bin/%{ActiveProject:Name}"
Working directory:
%{buildDir}/..

In the
Run
/Deployment
section, disable or remove theKill current application instance
and theDeploy files via rsync
steps.In this same section, add a new
Custom Process Steps
to deploy the SimpleSwitch™ package:Command:
simpleswitch-deploy-package
Arguments:
%{ActiveProject:Name} %{Device:HostAddress} --allow-update
Working directory:
%{buildDir}/..

In the
Run
/Run
section, you will need to modify the configuration to start the SimpleSwitch™ correctly using systemd. Set the configuration to:Alternate exectuable on device
tosystemctl
withUse this command instead
selected.Command line arguments
tostart simpleswitch-app@%{ActiveProject:Name}
.

The project has been configured manually as would have been done by the script. Now you can refer to the section Select the Kit and build mode to then be able to compile and deploy the SimpleSwitch™ package.