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