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 name | Default value | Decription |
---|---|---|
QUL_PLATFORM_DEFAULT_SCREEN_WIDTH | 480 | The default screen width in pixels. Currently used only by the desktop backend. |
QUL_PLATFORM_DEFAULT_SCREEN_HEIGHT | 272 | The default screen height in pixels. Currently used only by the desktop backend. |
QUL_PLATFORM_DEFAULT_TEXT_CACHE_ENABLED | OFF | The default value for text caching on the target platform. See QUL_PLATFORM_DEFAULT_TEXT_CACHE_ENABLED for more information. |
QUL_PLATFORM_DEFAULT_TEXT_CACHE_SIZE | 24*1024 | The 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_ASSETS | 0 | The 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_ALIGNMENT | 1 | The minimum alignment required for image data on the target platform. See QUL_PLATFORM_REQUIRED_IMAGE_ALIGNMENT for more information. |
QUL_PLATFORM_REQUIRED_PIXEL_WIDTH_ALIGNMENT | 1 | The 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_EXAMPLES | List 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 set_target_properties(Platform PROPERTIES QUL_PLATFORM_EXCLUDED_EXAMPLES "multitask;image_cache" ) | |
QUL_PLATFORM_EXCLUDED_DEMOS | List 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 set_target_properties(Platform PROPERTIES QUL_PLATFORM_EXCLUDED_DEMOS "automotive;motor_cluster" ) | |
QUL_PLATFORM_EXCLUDED_TESTS | List 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 set_target_properties(Platform PROPERTIES QUL_PLATFORM_EXCLUDED_TESTS "controls;flickable" ) |
Infineon platform-specific properties:
Property name | Decription | |
---|---|---|
QUL_PRIVATE_INFINEON_RESOURCE_GENERATOR | Path to ResourceGenerator.exe binary file, which is found in Infineon SDK directory. Set this property to compile the resources. |
NXP platform-specific properties:
Property name | Decription |
---|---|
NXP_CHIP_NAME | Name of NXP chip family name, such as MIMXRT1052xxxxB . Set this variable to be able to flash targets. |
NXP_CONNECT_SCRIPT | Name 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_SCRIPT | Name 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_DIR | Path 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 name | Decription |
---|---|
STM32_EXTERNAL_LOADER | Path 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;imagedecoder;layers;multiscreen" QUL_PLATFORM_EXCLUDED_TESTS "layers;layers_with_shapes;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" )
Specifying compile and link options for the platform
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.