C

Installation

This topic explains how to install the new platform port and use it in Qt Creator.

There are two main approaches to build applications against a platform port of Qt Quick Ultralite:

  • Build the application against a developer build of the platform port.
  • Install the platform port to a self-contained location.

The first one is practical if the port is still being developed, as it helps you test changes quickly against an application.

Note: This page uses QUL_ROOT and QUL_TOOLS in command line examples as if they were set as environment variables. They could be set for example:

export QUL_ROOT=$HOME/Qt/QtMCUs/2.0.0
export QUL_TOOLS=$HOME/Qt/Tools/QtMCUs
set QUL_ROOT=C:\Qt\QtMCUs\2.0.0
set QUL_TOOLS=C:\Qt\Tools\QtMCUs

Depending on the used toolchain you have to set QUL_TOOLCHAIN_FILE to

export QUL_TOOLCHAIN_FILE=$QUL_ROOT/lib/cmake/Qul/toolchain/armgcc.cmake

or

export QUL_TOOLCHAIN_FILE=$QUL_ROOT/lib/cmake/Qul/toolchain/iar.cmake
set QUL_TOOLCHAIN_FILE=%QUL_ROOT%\lib\cmake\Qul\toolchain\armgcc.cmake

or

set QUL_TOOLCHAIN_FILE=%QUL_ROOT%\lib\cmake\Qul\toolchain\iar.cmake

QUL_TARGET_TOOLCHAIN_DIR cmake cache entry needs to be used to provide the location of the used toolchain.

To use nmake, run the "vcvarsx86_amd64.bat" Windows batch file, which is found in the "VC\Auxiliary\Build" Visual Studio directory. Alternatively, you can run "x86_x64 Cross Tools Command Prompt for VS 2017" or the equivalent for your version of Visual Studio.

Developer build

To build the plaform as a developer build, run these commands:

cmake $QUL_ROOT -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$QUL_TOOLCHAIN_FILE -DQUL_TARGET_TOOLCHAIN_DIR=/path/to/the/toolchain -DQUL_GENERATORS=$QUL_ROOT/lib/cmake/Qul/QulGenerators.cmake -DQUL_PLATFORM=example-baremetal
nmake
cmake %QUL_ROOT% -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=%QUL_TOOLCHAIN_FILE% -DQUL_TARGET_TOOLCHAIN_DIR=C:\path\to\the\toolchain -DQUL_GENERATORS=%QUL_ROOT%\lib\cmake\Qul\QulGenerators.cmake -DQUL_PLATFORM=example-baremetal
nmake

Installed build

To install a platform build, use the CMAKE_INSTALL_PREFIX option, in addition to the CMake options for the developer build. In the following CMake command, set the CMAKE_INSTALL_PREFIX to the path where you want to install the port:

cmake $QUL_ROOT -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$QUL_TOOLCHAIN_FILE -DQUL_TARGET_TOOLCHAIN_DIR=/path/to/the/toolchain -DQUL_GENERATORS=$QUL_ROOT/lib/cmake/Qul/QulGenerators.cmake -DQUL_PLATFORM=example-baremetal -DCMAKE_INSTALL_PREFIX=~/dev/qul-example-platform
nmake
nmake install
cmake %QUL_ROOT% -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=%QUL_TOOLCHAIN_FILE% -DQUL_TARGET_TOOLCHAIN_DIR=c:\path\to\the\toolchain -DQUL_GENERATORS=%QUL_ROOT%\lib\cmake\Qul\QulGenerators.cmake -DQUL_PLATFORM=example-baremetal -DCMAKE_INSTALL_PREFIX=C:\dev\qul-example-platform
nmake
nmake install

Qt Creator integration

Set up your Qt Creator development environment with the MCU plugin as described in the Qt Creator Manual > Connecting MCUs topic.

Note: Qt Creator does not support custom toolchains yet, so for Qt Creator support one of the toolchains shipped with Qt Quick Ultralite in lib\cmake\Qul\toolchain must be used.

To build the platform port for Qt Creator integration, set these two environment variables:

  • CMAKE_INSTALL_PREFIX to Qt for MCUs install directory. It should match the Qt for MCUs version set in the Tools > Options > Devices > MCU option in Qt Creator.
  • QUL_VERSION to the corresponding version number. For example, if Qt Creator is configured to use C:\Qt\QtMCUs\<VERSION>, where <VERSION> is the directory containing the Qt Quick Ultralite version you are using (for example dev).

After setting these variables, use the following commands to configure and install the platform port:

export QUL_VERSION=<VERSION>
cmake $QUL_ROOT -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$QUL_TOOLCHAIN_FILE -DQUL_TARGET_TOOLCHAIN_DIR=c:\path\to\the\toolchain -DQUL_GENERATORS=$QUL_ROOT/lib/cmake/Qul/QulGenerators.cmake -DQUL_PLATFORM=example-baremetal -DCMAKE_INSTALL_PREFIX=$QUL_ROOT -DQUL_VERSION=$QUL_VERSION -DQUL_BUILD_DEMOS=off -DQUL_BUILD_EXAMPLES=off
nmake
nmake install
set QUL_VERSION=<VERSION>
cmake %QUL_ROOT% -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=%QUL_TOOLCHAIN_FILE% -DQUL_TARGET_TOOLCHAIN_DIR=c:\path\to\the\toolchain -DQUL_GENERATORS=%QUL_ROOT%\lib\cmake\Qul\QulGenerators.cmake -DQUL_PLATFORM=example-baremetal -DCMAKE_INSTALL_PREFIX=%QUL_ROOT% -DQUL_VERSION=%QUL_VERSION% -DQUL_BUILD_DEMOS=off -DQUL_BUILD_EXAMPLES=off
nmake
nmake install

You can disable building of demos and examples, as they are not needed for the Qt Creator integration.

Once the installation is complete, create a kit for your platform port using the Tools > Options > Devices > MCU option in Qt Creator. If a kit is already configured for the target, remove it before creating the new one.

Finally, the kit for your platform is ready for use in Qt Creator. If you created an Mcu Support Application project, use the new kit to build and link the Qt Quick Ultralite application against your platform library.

Assuming that you have set up the flash targets as described in Getting started, run the application on the target hardware by pressing the Run button in Qt Creator.

Available under certain Qt licenses.
Find out more.