C
Creating flash targets
Qt Quick Ultralite CMake scripts offer support to generate targets for flashing binaries to the device. This is useful in the application development phase, where you might have to build and flash the binaries often. It offers a single command to build and flash the binary.
This step is optional if you prefer other means of flashing the binaries to the target, other than using CMake and make.
The following is required to generate flash targets:
- Create a new file called
ExecutableHook.cmake
under theplatform\boards\<MANUFACTURER_NAME>\<YOUR_PLATFORM>\cmake
directory. - Add the following function to
ExecutableHook.cmake
:function(add_executable_hook name) add_custom_target("flash_${name}" COMMAND <COMMAND_FOR_YOUR_FLASHER>) message(STATUS "Added flash target flash_${name}") endfunction()
The name argument is the target application's name. For a
minimal
example, name would beminimal
and the resulting flash target isflash_minimal
. <COMMAND_FOR_YOUR_FLASHER> is the command you use to flash built binaries to the target device. Your binary can be found using$<TARGET_FILE_DIR:${name}>/${name}.elf
. Depending on the compiler and the flashing tool, the generated binary might be in a format that is not ELF.
Running CMake for your platform should now output Added flash target flash_<EXAMPLE/DEMO>
. Later on in this guide, you can use the following command to flash and run your application:
cmake --build . --target flash_<APPLICATION>
Available under certain Qt licenses.
Find out more.