diff --git a/components/esptool_py/CMakeLists.txt b/components/esptool_py/CMakeLists.txt index 92704e0b3..bf779ce24 100644 --- a/components/esptool_py/CMakeLists.txt +++ b/components/esptool_py/CMakeLists.txt @@ -1,13 +1,15 @@ idf_component_register(REQUIRES bootloader) -if(NOT BOOTLOADER_BUILD AND CONFIG_APP_BUILD_GENERATE_BINARIES) +if(NOT BOOTLOADER_BUILD) idf_build_get_property(build_dir BUILD_DIR) - partition_table_get_partition_info(app_partition_offset "--partition-boot-default" "offset") - esptool_py_custom_target(app-flash app "app") + if(CONFIG_APP_BUILD_GENERATE_BINARIES) + partition_table_get_partition_info(app_partition_offset "--partition-boot-default" "offset") + esptool_py_custom_target(app-flash app "app") - esptool_py_flash_target_image(app-flash app "${app_partition_offset}" "${build_dir}/${PROJECT_BIN}") - esptool_py_flash_target_image(flash app "${app_partition_offset}" "${build_dir}/${PROJECT_BIN}") + esptool_py_flash_target_image(app-flash app "${app_partition_offset}" "${build_dir}/${PROJECT_BIN}") + esptool_py_flash_target_image(flash app "${app_partition_offset}" "${build_dir}/${PROJECT_BIN}") + endif() # If anti-rollback option is set then factory partition should not be in Partition Table. # In this case, should be used the partition table with two ota app without the factory. diff --git a/components/esptool_py/project_include.cmake b/components/esptool_py/project_include.cmake index fda3c0c82..4d0626994 100644 --- a/components/esptool_py/project_include.cmake +++ b/components/esptool_py/project_include.cmake @@ -231,6 +231,16 @@ function(esptool_py_custom_target target_name flasher_filename dependencies) endif() endfunction() -if(NOT BOOTLOADER_BUILD AND CONFIG_APP_BUILD_GENERATE_BINARIES) - esptool_py_custom_target(flash project "app;bootloader;partition_table") +if(NOT BOOTLOADER_BUILD) + set(flash_deps "partition_table") + + if(CONFIG_APP_BUILD_GENERATE_BINARIES) + list(APPEND flash_deps "app") + endif() + + if(CONFIG_APP_BUILD_BOOTLOADER) + list(APPEND flash_deps "bootloader") + endif() + + esptool_py_custom_target(flash project "${flash_deps}") endif() \ No newline at end of file