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 v6.0.0 or newer
  • CMake 3.15 or newer
  • Ninja 1.10.0 or newer

    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:

  • 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.

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/dev
export QUL_TOOLS=$HOME/Qt/Tools/QtMCUs
set QUL_ROOT=C:\Qt\QtMCUs\dev
set QUL_TOOLS=C:\Qt\Tools\QtMCUs

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_ROOT
mkdir build
cd build
cmake .. -G "Ninja" -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=../lib/cmake/Qul/toolchain/armgcc.cmake -DQUL_TARGET_TOOLCHAIN_DIR=$QUL_TOOLS/arm_gcc_10 -DQUL_BOARD_SDK_DIR=$QUL_TOOLS/NXP/SDK_2.12.0_EVKB-IMXRT1050 -DQUL_GENERATORS=../lib/cmake/Qul/QulGenerators.cmake -DQUL_PLATFORM=MIMXRT1050-EVK-baremetal
cmake --build .
cd %QUL_ROOT%
mkdir build
cd build
cmake .. -G "Ninja" -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=..\lib\cmake\Qul\toolchain\armgcc.cmake -DQUL_TARGET_TOOLCHAIN_DIR=%QUL_TOOLS%\arm_gcc_10 -DQUL_BOARD_SDK_DIR=%QUL_TOOLS%\NXP\SDK_2.12.0_EVKB-IMXRT1050 -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:

  • TVIIC2D6M-baremetal
  • EK-RA6M3G-baremetal
  • MIMXRT1050-EVK-baremetal
  • MIMXRT1050-EVK-freertos
  • MIMXRT1060-EVK-baremetal
  • MIMXRT1064-EVK-baremetal
  • MIMXRT1064-EVK-freertos
  • MIMXRT1170-EVK-freertos
  • RH850-D1M1A-baremetal
  • STM32F769I-DISCOVERY-baremetal
  • STM32F769I-DISCOVERY-freertos
  • STM32H750B-DISCOVERY-baremetal
  • STM32F469I-DISCOVERY-baremetal

Note: The value for CMAKE_TOOLCHAIN_FILE can be for GreenHills, IAR, or Arm GCC 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.

Note: in a Qt Quick Ultralite project the CMAKE_BUILD_TYPE CMake argument is by default set to MinSizeRel. MinSizeRel is the build type used for the pre-built platform libraries shipped with Qt Quick Ultralite. If you want to change the build type (e.g. to Release) you can do so by invoking cmake with -DCMAKE_BUILD_TYPE=Release. Please refer to this page for more information.

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 configuration.

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_ROOT
mkdir build
cd build
cmake .. -G "Ninja" -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=../lib/cmake/Qul/toolchain/armgcc.cmake -DQUL_TARGET_TOOLCHAIN_DIR=$QUL_TOOLS/arm_gcc_10 -DQUL_BOARD_SDK_DIR=$QUL_TOOLS/NXP/SDK_2.12.0_EVKB-IMXRT1050 -DQUL_PLATFORM=MIMXRT1050-EVK-baremetal -DQUL_BUILD_DEMOS=off -DQUL_BUILD_EXAMPLES=off -DQUL_BUILD_FRAMEWORK=off
cmake --build .
cd %QUL_ROOT%
mkdir build
cd build
cmake .. -G "Ninja" -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=..\lib\cmake\Qul\toolchain\armgcc.cmake -DQUL_TARGET_TOOLCHAIN_DIR=%QUL_TOOLS%\arm_gcc_10 -DQUL_BOARD_SDK_DIR=%QUL_TOOLS%\NXP\SDK_2.12.0_EVKB-IMXRT1050 -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 dev).

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

export QUL_VERSION=<VERSION>
cd $QUL_ROOT
mkdir build
cd build
cmake .. -G "Ninja" -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=../lib/cmake/Qul/toolchain/armgcc.cmake -DQUL_PLATFORM=MIMXRT1050-EVK-baremetal -DQUL_TARGET_TOOLCHAIN_DIR=$QUL_TOOLS/arm_gcc_10 -DQUL_BOARD_SDK_DIR=$QUL_TOOLS/NXP/SDK_2.12.0_EVKB-IMXRT1050 -DQUL_BUILD_DEMOS=off -DQUL_BUILD_EXAMPLES=off -DQUL_BUILD_FRAMEWORK=off -DCMAKE_INSTALL_PREFIX=$QUL_ROOT -DQUL_VERSION=$QUL_VERSION
cmake --build .
cmake --install .
set QUL_VERSION=<VERSION>
cd %QUL_ROOT%
mkdir build
cd build
cmake .. -G "Ninja" -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=..\lib\cmake\Qul\toolchain\armgcc.cmake -DQUL_PLATFORM=MIMXRT1050-EVK-baremetal -DQUL_TARGET_TOOLCHAIN_DIR=%QUL_TOOLS%\arm_gcc_10 -DQUL_BOARD_SDK_DIR=%QUL_TOOLS%\NXP\SDK_2.12.0_EVKB-IMXRT1050 -DQUL_BUILD_DEMOS=off -DQUL_BUILD_EXAMPLES=off -DQUL_BUILD_FRAMEWORK=off -DCMAKE_INSTALL_PREFIX=%QUL_ROOT% -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 chosen target as per the instructions in the relevant Getting Started topic.
  2. Set environment variables according to chosen target and toolchain. The example commands below are for MIMXRT1170-EVK with the ARM GCC toolchain. To build for another platform or toolchain, modify the QUL_PLATFORM_NAME, QUL_BOARD_SDK_DIR, CMAKE_TOOLCHAIN_FILE, QUL_TARGET_TOOLCHAIN_DIR, and FREERTOS_DIR environment variables accordingly. The FREERTOS_DIR parameter can be dropped if you are not building for the FreeRTOS platform.
    export QUL_PLATFORM_NAME=mimxrt1170-evk-freertos
    export QUL_BOARD_SDK_DIR=$QUL_TOOLS/NXP/SDK_2.12.0_MIMXRT1170-EVK
    export CMAKE_TOOLCHAIN_FILE=$QUL_ROOT/lib/cmake/Qul/toolchain/armgcc.cmake
    export QUL_TARGET_TOOLCHAIN_DIR=$QUL_TOOLS/arm_gcc_10
    export FREERTOS_DIR=$QUL_TOOLS/NXP/SDK_2.12.0_MIMXRT1170-EVK/rtos/freertos/freertos_kernel
    set QUL_PLATFORM_NAME=mimxrt1170-evk-freertos
    set QUL_BOARD_SDK_DIR=%QUL_TOOLS%\NXP\SDK_2.12.0_MIMXRT1170-EVK
    set CMAKE_TOOLCHAIN_FILE=%QUL_ROOT%\lib\cmake\Qul\toolchain\armgcc.cmake
    set QUL_TARGET_TOOLCHAIN_DIR=%QUL_TOOLS%\arm_gcc_10
    set FREERTOS_DIR=%QUL_TOOLS%\NXP\SDK_2.12.0_MIMXRT1170-EVK\rtos\freertos\freertos_kernel
  3. If you built and installed the platform library as described in the previous section, you can skip straight to step 4 to build your application.

    Otherwise, the following instructions explain how to build Qt Quick Ultralite from the modified sources and install it to a custom location. It's necessary to first copy the Qt for MCUs version that's used as the base for building the customized version, in order to for the customized version to also contain the host tools (qmltocpp, qmlinterfacegenerator, and so on) and CMake build system. The example commands below show how to build and install a customized version to the path specified by QUL_INSTALL_DIR. The build itself is done in the directory specified by QUL_BUILD_DIR.

    export QUL_VERSION=dev
    export QUL_INSTALL_DIR=some/path/custom_qul
    export QUL_BUILD_DIR=some/path/custom_qul_build
    
    mkdir -p $QUL_INSTALL_DIR
    
    cp -r $QUL_ROOT/* $QUL_INSTALL_DIR
    
    mkdir -p $QUL_BUILD_DIR
    cd $QUL_BUILD_DIR
    
    cmake $QUL_ROOT -G "Ninja" -DCMAKE_INSTALL_PREFIX=$QUL_INSTALL_DIR -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=$CMAKE_TOOLCHAIN_FILE -DQUL_TARGET_TOOLCHAIN_DIR=$QUL_TARGET_TOOLCHAIN_DIR -DQUL_BOARD_SDK_DIR=$QUL_BOARD_SDK_DIR -DQUL_PLATFORM=$QUL_PLATFORM_NAME -DQUL_BUILD_DEMOS=OFF -DQUL_BUILD_EXAMPLES=OFF -DQUL_GENERATORS=$QUL_ROOT/lib/cmake/Qul/QulGenerators.cmake -DFREERTOS_DIR=$FREERTOS_DIR -DQUL_VERSION=$QUL_VERSION
    
    cmake --build .
    cmake --install .
    
    # Before the next step, update QUL_ROOT and CMAKE_TOOLCHAIN_FILE to point to your newly built version
    export QUL_ROOT=$QUL_INSTALL_DIR
    export CMAKE_TOOLCHAIN_FILE=$QUL_INSTALL_DIR/lib/cmake/Qul/toolchain/armgcc.cmake
    set QUL_VERSION=dev
    set QUL_INSTALL_DIR=some\path\custom_qul
    set QUL_BUILD_DIR=some\path\custom_qul_build
    
    mkdir %QUL_INSTALL_DIR%
    
    xcopy %QUL_ROOT% %QUL_INSTALL_DIR% /e /y /q
    
    mkdir %QUL_BUILD_DIR%
    cd %QUL_BUILD_DIR%
    
    cmake %QUL_ROOT% -G "Ninja" -DCMAKE_INSTALL_PREFIX=%QUL_INSTALL_DIR% -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=%CMAKE_TOOLCHAIN_FILE% -DQUL_TARGET_TOOLCHAIN_DIR=%QUL_TARGET_TOOLCHAIN_DIR% -DQUL_BOARD_SDK_DIR=%QUL_BOARD_SDK_DIR% -DQUL_PLATFORM=%QUL_PLATFORM_NAME% -DQUL_BUILD_DEMOS=OFF -DQUL_BUILD_EXAMPLES=OFF -DQUL_GENERATORS=%QUL_ROOT%/lib/cmake/Qul/QulGenerators.cmake -DFREERTOS_DIR=%FREERTOS_DIR% -DQUL_VERSION=%QUL_VERSION%
    
    cmake --build .
    cmake --install .
    
    rem Before the next step, update QUL_ROOT and CMAKE_TOOLCHAIN_FILE to point to your newly built version
    set QUL_ROOT=%QUL_INSTALL_DIR%
    set CMAKE_TOOLCHAIN_FILE=%QUL_INSTALL_DIR%/lib/cmake/Qul/toolchain/armgcc.cmake
  4. Use the custom-built Qt Quick Ultralite to build your application, which is not part of the Qt Quick Ultralite source tree:
    # Put your application here. You can use the minimal example from the SDK.
    export APP_DIR=some/path/custom_app
    mkdir $APP_DIR
    cd $APP_DIR
    mkdir build
    cd build
    
    cmake .. -G "Ninja" -DQul_ROOT=$QUL_ROOT -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=$CMAKE_TOOLCHAIN_FILE -DQUL_TARGET_TOOLCHAIN_DIR=$QUL_TARGET_TOOLCHAIN_DIR -DQUL_GENERATORS=$QUL_ROOT/lib/cmake/Qul/QulGenerators.cmake -DQUL_PLATFORM=$QUL_PLATFORM_NAME -DQUL_BOARD_SDK_DIR=$QUL_BOARD_SDK_DIR
    
    cmake --build .
    cmake --build . --target flash_<TARGET_NAME>
    rem Put your application here. You can use the minimal example from the SDK.
    set APP_DIR=some\path\custom_app
    mkdir %APP_DIR%
    cd %APP_DIR%
    mkdir build
    cd build
    
    cmake .. -G "Ninja" -DQul_ROOT=%QUL_ROOT% -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=%CMAKE_TOOLCHAIN_FILE% -DQUL_TARGET_TOOLCHAIN_DIR=%QUL_TARGET_TOOLCHAIN_DIR% -DQUL_GENERATORS=%QUL_ROOT%/lib/cmake/Qul/QulGenerators.cmake -DQUL_PLATFORM=%QUL_PLATFORM_NAME% -DQUL_BOARD_SDK_DIR=%QUL_BOARD_SDK_DIR%
    
    cmake --build .
    cmake --build . --target flash_<TARGET_NAME>

Note: in a Qt Quick Ultralite project the CMAKE_BUILD_TYPE CMake argument is by default set to MinSizeRel. MinSizeRel is the build type used for the pre-built platform libraries shipped with Qt Quick Ultralite. If you want to change the build type (e.g. to Release) you can do so by invoking cmake with -DCMAKE_BUILD_TYPE=Release. Please refer to this page for more information.

Available under certain Qt licenses.
Find out more.