CMakeLists.txt 1.1 KB

1234567891011121314151617181920212223242526
  1. idf_component_register(PRIV_REQUIRES partition_table esptool_py)
  2. # Do not generate flash file when building bootloader or is in early expansion of the build
  3. if(BOOTLOADER_BUILD OR NOT CONFIG_APP_BUILD_BOOTLOADER)
  4. return()
  5. endif()
  6. add_dependencies(bootloader partition_table_bin)
  7. # When secure boot is enabled and CONFIG_SECURE_BOOT_FLASH_BOOTLOADER_DEFAULT is not enabled
  8. # do not flash the bootloader along with the other artifacts using the command `idf.py flash`
  9. if(NOT CONFIG_SECURE_BOOT OR CONFIG_SECURE_BOOT_FLASH_BOOTLOADER_DEFAULT)
  10. set(flash_bootloader FLASH_IN_PROJECT)
  11. endif()
  12. esptool_py_custom_target(bootloader-flash bootloader "bootloader")
  13. esptool_py_flash_target_image(bootloader-flash bootloader
  14. ${CONFIG_BOOTLOADER_OFFSET_IN_FLASH}
  15. "${BOOTLOADER_BUILD_DIR}/bootloader.bin")
  16. # Also attach an image to the project flash target
  17. if(NOT CONFIG_SECURE_BOOT OR CONFIG_SECURE_BOOT_FLASH_BOOTLOADER_DEFAULT)
  18. esptool_py_flash_target_image(flash bootloader
  19. ${CONFIG_BOOTLOADER_OFFSET_IN_FLASH}
  20. "${BOOTLOADER_BUILD_DIR}/bootloader.bin")
  21. endif()