CMakeLists.txt 1.2 KB

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