C

Building Qt Quick Ultralite from sources

This topic provides instructions to build the full Qt Quick Ultralite from sources, or only the platform library against the Qt Quick Ultralite evaluation packages.

Prerequisites

  • Qt for MCUs SDK
  • Qt Creator v4.12.4 or newer
  • CMake 3.15 or newer
  • Ninja 1.10.0 or newer

    Note: Ninja is an optional build tool and can be replaced with others like JOM or NMake. It is not needed when using Qt Creator.

    Note: Ensure that you have also installed all the prerequisites listed in the getting started section for your specific board.

Command line setup

To get started from the command line, ensure that the following environment variables are set:

  • Qul_DIR to the Qt for MCUs SDK install path.
    <QT_INSTALL_PATH>\QtMCUs\<VERSION>

    where,

    • <QT_INSTALL_PATH> is the Qt install directory,
    • and <VERSION> is the directory containing the Qt Quick Ultralite version you are using, for example 1.1.0.
  • ARMGCC_DIR to the ARM Toolchain install path.
  • Add the CMake and Ninja tools to your system PATH. If you installed these tools using the Qt online installer, they are installed under <QT_INSTALL_PATH>\Tools.

Building Qt Quick Ultralite from sources

If your license provides access to the Qt Quick Ultralite sources, use these commands to build it. For example, the following builds Qt Quick Ultralite for NXP i.MX RT1050 on bare metal:

cd %Qul_DIR%
mkdir build
cd build
cmake .. -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=..\lib\cmake\Qul\toolchain\armgcc.cmake -DQUL_GENERATORS=..\lib\cmake\Qul\QulGenerators.cmake -DQUL_PLATFORM=MIMXRT1050-EVK-baremetal
cmake --build .

To build for a different hardware platform, update the CMAKE_TOOLCHAIN_FILE and QUL_PLATFORM CMake variables accordingly. The value for the QUL_PLATFORM variable must be a combination of <BOARD-NAME> and <OS>. The following is a list of all the possible values that you can use:

  • MIMXRT1050-EVKB-baremetal
  • MIMXRT1050-EVKB-freertos
  • MIMXRT1060-EVK-baremetal
  • MIMXRT1064-EVK-baremetal
  • MIMXRT1064-EVK-freertos
  • MIMXRT1170-EVK-freertos
  • RH850-D1M1A-baremetal
  • STM32F769I-DISCOVERY-baremetal
  • STM32F769I-DISCOVERY-freertos
  • STM32F7508-DISCOVERY-baremetal
  • STM32F7508-DISCOVERY-freertos
  • STM32F750B-DISCOVERY-baremetal
  • STM32L4R9I-DISCOVERY-baremetal
  • STM32L4R9I-EVAL-baremetal
  • STM32F469I-DISCOVERY-baremetal

Note: The value for CMAKE_TOOLCHAIN_FILE can be either ghs.cmake or armgcc.cmake as shown in the earlier example.

Once Qt Quick Ultralite is built successfully, build one of the supported demos/examples using it and flash the resulting binary to the target hardware.

cmake --build . --target flash_<DEMO_OR_EXAMPLE_NAME>

Where, DEMO_OR_EXAMPLE_NAME is the name of a supported demo or an example.

Note: You can also use the flash_<DEMO_OR_EXAMPLE_NAME>_and_bootloader target to flash the bootloader with the demo/example.

Building Qt Quick Ultralite platform library against the evaluation packages

With the evaluation version of Qt Quick Ultralite you can modify and rebuild the platforms that are already shipped together with Qt Quick Ultralite. For example, port to a slightly different board configuation.

For instructions on how to create your own platform library for a custom hardware platform, refer to the Qt Quick Ultralite Platform Porting Guide.

Note: We recommend you to take backup of your existing Qt for MCUs version that is being used, before modifying the sources or installing a custom built platform library. This approach enables you to restore the original version in case there are issues with the custom-built version.

The following commands build the Qt Quick Ultralite platform library for NXP i.MX RT1050 on bare metal:

cd %Qul_DIR%
mkdir build
cd build
cmake .. -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=..\lib\cmake\Qul\toolchain\armgcc.cmake -DQUL_PLATFORM=MIMXRT1050-EVK-baremetal -DQUL_BUILD_DEMOS=off -DQUL_BUILD_EXAMPLES=off -DQUL_BUILD_FRAMEWORK=off
cmake --build .

To update the Qt Creator integration to use the custom built platform library, 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 1.5).

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

set QUL_VERSION=<VERSION>
set QUL_SDK_PATH=C:\Qt\QtMCUs\%QUL_VERSION%
cd %Qul_DIR%
mkdir build
cd build
cmake .. -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=..\lib\cmake\Qul\toolchain\armgcc.cmake -DQUL_PLATFORM=MIMXRT1050-EVK-baremetal -DQUL_BUILD_DEMOS=off -DQUL_BUILD_EXAMPLES=off -DQUL_BUILD_FRAMEWORK=off -DCMAKE_INSTALL_PREFIX=%QUL_SDK_PATH% -DQUL_VERSION=%QUL_VERSION%
cmake --build .
cmake --install .

Building applications out-of-source using a custom built Qt Quick Ultralite

This section describes how to build an application out-of-source, using a custom-built Qt Quick Ultralite.

The following step-by-step instructions help you build and install Qt Quick Ultralite, and use it to build an application:

  1. Set up your development environment for the choosen target as per the instructions in the relevant Getting Started topic.
  2. Build Qt Quick Ultralite from the modified sources and install it to a custom location. If you built and installed the platform library as described in the previous section, you can skip this part.
    mkdir some\path\custom_builds\qul
    cd some\path\custom_builds\qul
    
    mkdir qul-build
    cd qul-build
    
    set QUL_SDK_PATH=<PATH_TO_INSTALLED_QT_SDK>\QtMCUs\<VERSION>
    
    cmake %QUL_SDK_PATH% -G "Ninja" -DCMAKE_INSTALL_PREFIX=some\path\custom_builds\qul -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=%QUL_SDK_PATH%\lib\cmake\Qul\toolchain\armgcc.cmake -DQUL_PLATFORM=<PLATFORM_NAME> -DQUL_BUILD_TESTS=OFF -DQUL_BUILD_DEMOS=OFF -DQUL_BUILD_EXAMPLES=OFF -DQUL_GENERATORS=%QUL_SDK_PATH%\lib\cmake\Qul\QulGenerators.cmake
    
    ninja install
  3. Use the custom-built Qt Quick Ultralite to build your application, which is not part of the Qt Quick Ultralite source tree:
    cd some\path\custom_builds
    mkdir app # Put your application here. You can use the redbutton example from the SDK.
    cd app
    mkdir build
    cd build
    
    set QUL_SDK_PATH=<PATH_TO_INSTALLED_QT_SDK>\QtMCUs\<VERSION>
    set QUL_DIR=some\path\custom_builds\qul # if using the evaluation version with a custom library build, this should be the same as QUL_SDK_PATH
    
    cmake .. -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=%QUL_SDK_PATH%\lib\cmake\Qul\toolchain\armgcc.cmake -DQUL_GENERATORS=%QUL_SDK_PATH%\lib\cmake\Qul\QulGenerators.cmake -DQUL_PLATFORM=<PLATFORM_NAME>
    
    ninja
    ninja flash_<YOUR_APP_NAME>

Available under certain Qt licenses.
Find out more.