From f332e0c1d6df63f9926870a325708b6ef8103019 Mon Sep 17 00:00:00 2001 From: Renz Christian Bagaporo Date: Fri, 14 Jun 2019 12:53:46 +0800 Subject: [PATCH] partition_table: move establishing dependencies to respective components partition_table: move establishing dependencies to respective components --- components/bootloader/CMakeLists.txt | 5 ++++- components/esptool_py/CMakeLists.txt | 25 +++++++++++++++++++++ components/esptool_py/project_include.cmake | 8 +------ components/partition_table/CMakeLists.txt | 23 ------------------- 4 files changed, 30 insertions(+), 31 deletions(-) diff --git a/components/bootloader/CMakeLists.txt b/components/bootloader/CMakeLists.txt index 6d50ca58f..5fddb9c89 100644 --- a/components/bootloader/CMakeLists.txt +++ b/components/bootloader/CMakeLists.txt @@ -10,4 +10,7 @@ endif() esptool_py_flash_project_args(bootloader 0x1000 ${BOOTLOADER_BUILD_DIR}/bootloader.bin FLASH_IN_PROJECT - FLASH_FILE_TEMPLATE flash_bootloader_args.in) \ No newline at end of file + FLASH_FILE_TEMPLATE flash_bootloader_args.in) + +esptool_py_custom_target(bootloader-flash bootloader "bootloader") +add_dependencies(bootloader partition_table) diff --git a/components/esptool_py/CMakeLists.txt b/components/esptool_py/CMakeLists.txt index f306c2a1f..e93d9496f 100644 --- a/components/esptool_py/CMakeLists.txt +++ b/components/esptool_py/CMakeLists.txt @@ -48,3 +48,28 @@ set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/flasher_args.json.in" "${CMAKE_CURRENT_BINARY_DIR}/flasher_args.json.in2" "${CMAKE_BINARY_DIR}/flasher_args.json") + + +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_flash_project_args(app ${app_partition_offset} ${build_dir}/${PROJECT_BIN} FLASH_IN_PROJECT) + + if(CONFIG_SECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/flash_encrypted_app_args.in "--encrypt ${app_partition_offset} ${PROJECT_BIN}") + esptool_py_flash_project_args(encrypted_app ${app_partition_offset} ${build_dir}/${PROJECT_BIN} + FLASH_FILE_TEMPLATE ${CMAKE_CURRENT_BINARY_DIR}/flash_encrypted_app_args.in) + endif() + + add_dependencies(flash partition_table) +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. +partition_table_get_partition_info(factory_offset "--partition-type app --partition-subtype factory" "offset") +if(CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK AND factory_offset) + fail_at_build_time(check_table_contents + "ERROR: Anti-rollback option is enabled. Partition table should consist of two ota app without factory partition.") + add_dependencies(app check_table_contents) +endif() \ No newline at end of file diff --git a/components/esptool_py/project_include.cmake b/components/esptool_py/project_include.cmake index 1d5a64cfc..ce4eac842 100644 --- a/components/esptool_py/project_include.cmake +++ b/components/esptool_py/project_include.cmake @@ -114,12 +114,7 @@ if(NOT BOOTLOADER_BUILD AND ) endif() -if(NOT BOOTLOADER_BUILD) - add_custom_target(app ALL DEPENDS gen_project_binary) -else() - add_custom_target(bootloader ALL DEPENDS gen_project_binary) -endif() - +add_custom_target(app ALL DEPENDS gen_project_binary) if(NOT BOOTLOADER_BUILD AND CONFIG_SECURE_BOOT_ENABLED AND @@ -151,7 +146,6 @@ endfunction() esptool_py_custom_target(flash project "app;partition_table;bootloader") esptool_py_custom_target(app-flash app "app") -esptool_py_custom_target(bootloader-flash bootloader "bootloader") if(CONFIG_SECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT) esptool_py_custom_target(encrypted-flash encrypted_project "app;partition_table;bootloader") diff --git a/components/partition_table/CMakeLists.txt b/components/partition_table/CMakeLists.txt index c64b2500d..34c60c8e5 100644 --- a/components/partition_table/CMakeLists.txt +++ b/components/partition_table/CMakeLists.txt @@ -74,19 +74,6 @@ if(CONFIG_SECURE_BOOT_ENABLED AND VERBATIM) 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. -partition_table_get_partition_info(factory_offset "--partition-type app --partition-subtype factory" "offset") -if(CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK AND factory_offset) - fail_at_build_time(check_table_contents - "ERROR: Anti-rollback option is enabled. Partition table should consist of two ota app without factory partition.") -add_dependencies(bootloader check_table_contents) -add_dependencies(app check_table_contents) -endif() - -add_dependencies(bootloader partition_table) -add_dependencies(app partition_table) - # Use global properties ESPTOOL_WRITE_FLASH_ARGS to pass this info to build # the list of esptool write arguments for flashing set_property(GLOBAL APPEND_STRING PROPERTY @@ -95,13 +82,3 @@ set_property(GLOBAL APPEND_STRING PROPERTY esptool_py_flash_project_args(partition_table ${PARTITION_TABLE_OFFSET} ${build_dir}/partition_table/partition-table.bin FLASH_IN_PROJECT) - -partition_table_get_partition_info(app_partition_offset "--partition-boot-default" "offset") -esptool_py_flash_project_args(app ${app_partition_offset} ${build_dir}/${PROJECT_BIN} FLASH_IN_PROJECT) - -if(CONFIG_SECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT) - file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/flash_encrypted_app_args.in "--encrypt ${app_partition_offset} ${PROJECT_BIN}") - esptool_py_flash_project_args(encrypted_app ${app_partition_offset} ${build_dir}/${PROJECT_BIN} - FLASH_FILE_TEMPLATE ${CMAKE_CURRENT_BINARY_DIR}/flash_encrypted_app_args.in) -endif() -