C

Creating the platform configuration file

platform\<YOUR_PLATFORM>\CMakeLists.txt is your platform's primary configuration file. It specifies all sources, include directories, compile definitions, and other parameters your platform requires. For more information about the CMake syntax, see CMake Documentation. You can also use platform\boards\qt\example-baremetal\CMakeLists.txt as a basis for your platform's CMakeLists.txt.

Note: When you are defining sources, include directories or other attributes for your platform, you must specify Platform as the target for these definitions.

The following is the CMakeLists.txt for the example-baremetal platform:

target_sources(Platform PRIVATE
    examplelayerengine.cpp
    examplepath.cpp
    examplestroker.cpp
    examplequeue.cpp
    platform_context.cpp
    devicelink.cpp
    mem.cpp
    ${PLATFORM_COMMON_SRC_DIR}/singlepointtoucheventdispatcher.cpp
    ${PLATFORM_COMMON_SRC_DIR}/platform.cpp
    # Add platform source files here
)

target_include_directories(Platform PRIVATE
    # Add platform specific include directories here
)

target_compile_definitions(Platform PRIVATE
    # Insert platform specific compile flags here
    # e.g. APPLICATION_ADDRESS=0x90000000
)

The example CMakeLists.txt has two files defined in sources: platform_context.cpp and mem.cpp/mem-iar.cpp. These files contain sample code for basic functions and memory allocation API respectively. The contents of these files are documented in Implementing basic functions and Memory allocation in Qt Quick Ultralite platform abstraction chapters.

Setting platform properties

Platform related configurations are set in the target platform CMakeLists.txt file as the Platform target properties. List of the all properties with default values and descriptions are presented in following table:

Common properties:

Property nameDefault valueDecription
QUL_PLATFORM_DEFAULT_SCREEN_WIDTH480The default screen width in pixels. Currently used only by the desktop backend.
QUL_PLATFORM_DEFAULT_SCREEN_HEIGHT272The default screen height in pixels. Currently used only by the desktop backend.
QUL_PLATFORM_DEFAULT_TEXT_CACHE_ENABLEDOFFThe default value for text caching on the target platform. See QUL_PLATFORM_DEFAULT_TEXT_CACHE_ENABLED for more information.
QUL_PLATFORM_DEFAULT_TEXT_CACHE_SIZE24*1024The default size for text cache on the target platform. See QUL_PLATFORM_DEFAULT_TEXT_CACHE_SIZE for more information.
QUL_PLATFORM_DEFAULT_NUM_FRAMES_TO_PRESERVE_ASSETS0The default number of frames to preserve assets on the target platform. See QUL_PLATFORM_DEFAULT_NUM_FRAMES_TO_PRESERVE_ASSETS for more information.
QUL_PLATFORM_REQUIRED_IMAGE_ALIGNMENT1The minimum alignment required for image data on the target platform. See QUL_PLATFORM_REQUIRED_IMAGE_ALIGNMENT for more information.
QUL_PLATFORM_REQUIRED_PIXEL_WIDTH_ALIGNMENT1The image width will be a multiple of this value on the target platform. See QUL_PLATFORM_REQUIRED_PIXEL_WIDTH_ALIGNMENT for more information.
QUL_PLATFORM_EXCLUDED_EXAMPLESList of examples that should be excluded from the build. It is defined in the CMake list format, where each value is delimited or separated by a semicolon.

The following example disables the freertos_multitask and image_cache examples:

set_target_properties(Platform
    PROPERTIES
        QUL_PLATFORM_EXCLUDED_EXAMPLES "freertos_multitask;image_cache"
)
QUL_PLATFORM_EXCLUDED_DEMOSList of demos that should be excluded from the build. It is defined in the CMake list format, where each value is delimited or separated by a semicolon.

The following example disables the automotive and motor_cluster demos:

set_target_properties(Platform
    PROPERTIES
        QUL_PLATFORM_EXCLUDED_DEMOS "automotive;motor_cluster"
)
QUL_PLATFORM_EXCLUDED_TESTSList of tests that should be excluded from the build. It is defined in the CMake list format, where each value is delimited or separated by a semicolon.

The following example disables the controls and flickable tests:

set_target_properties(Platform
    PROPERTIES
        QUL_PLATFORM_EXCLUDED_TESTS "controls;flickable"
)

Cypress platform-specific properties:

Property nameDecription
QUL_PRIVATE_INFINEON_RESOURCE_GENERATORPath to ResourceGenerator.exe binary file, which is found in Cypress SDK directory. Set this property to compile the resources.

NXP platform-specific properties:

Property nameDecription
NXP_CHIP_NAMEName of NXP chip family name, such as MIMXRT1052xxxxB. Set this variable to be able to flash targets.
NXP_CONNECT_SCRIPTName of the connect script from MCUXpressoIDE, such as RT1050_connect.scp. Set this variable to be able to connect to the flash targets.
NXP_RESET_SCRIPTName of the reset script from MCUXpressoIDE, such as RT1170_reset.scp. Currently this variable is required only by NXP RT1170 to be able to properly restart board after flashing.
NXP_PARTFILES_DIRPath to directory containing NXP partfiles in XML format. Set this variable to be able to use it while flashing targets.

STM platform-specific properties:

Property nameDecription
STM32_EXTERNAL_LOADERPath to the STM32 external loader file, to be able to flash the external memory.

Example properties set in platform CMakeLists.txt:

set_target_properties(Platform
    PROPERTIES
        NXP_CHIP_NAME "MIMXRT1052xxxxB"
        NXP_CONNECT_SCRIPT "RT1050_connect.scp"
        # variables cannot be expanded that's why there is "\" before "$". It will be later evaluated at CMake runtime using
        # qul_private_evaluate_path_from_target_property() function
        NXP_PARTFILES_DIR "\${QUL_PLATFORM_TARGET_DIR}/../mimxrt1050-evk-common/cmake"
        QUL_PLATFORM_EXCLUDED_DEMOS "automotive;motor_cluster"
        QUL_PLATFORM_EXCLUDED_EXAMPLES "freertos_app_switch;layers;multiscreen"
        QUL_PLATFORM_EXCLUDED_TESTS "layers;layer_transparency;resource_storage_section"
        QUL_PRIVATE_USE_PLATFORM_CONFIGURATION_HEADER ON
    EXPORT_PROPERTIES "NXP_CHIP_NAME;NXP_CONNECT_SCRIPT;NXP_PARTFILES_DIR;QUL_PLATFORM_EXCLUDED_DEMOS;QUL_PLATFORM_EXCLUDED_EXAMPLES;QUL_PLATFORM_EXCLUDED_TESTS"
)

platform.cmake contains compile and link options specific to your platform. Architecture options can be found in the files for the specific architecture.

Specifying vendor SDK specific settings

BSPConfig.cmake contains all settings that are required for using functions from the vendor SDK, like GPIO or interrupt handlers.

See Platform SDK Config.

These usually are defines for a specific board and include paths.

target_compile_definitions(PlatformBSPConfig INTERFACE
    # Platform SDK specific compile definitions
    USE_HAL_DRIVER
)

target_include_directories(PlatformBSPConfig INTERFACE
    # Platform SDK specific include directories
    # eg. ${QUL_BOARD_SDK_DIR}/Drivers/BSP/STM32F769I-Discovery/
)

Available under certain Qt licenses.
Find out more.