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.

The following must be done in order to get flash targets generated:

  1. Create a new file called ExecutableHook.cmake under the platform\boards\<MANUFACTURER_NAME>\<YOUR_PLATFORM>\cmake directory.
  2. 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 minimal example, name would be minimal and the resulting flash target is flash_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>. If you've copied example-baremetal project, you can use the following command to test whether flashing runs your flasher correctly:

nmake flash_minimal

However, your platform is still quite barebones. If your build does not succeed, continue reading this guide and try again at a later time.

Available under certain Qt licenses.
Find out more.