2019-04-28 03:38:23 -04:00
|
|
|
idf_component_register(REQUIRES bootloader)
|
2018-02-01 04:45:41 -05:00
|
|
|
|
2020-01-06 01:17:00 -05:00
|
|
|
if(NOT BOOTLOADER_BUILD)
|
2019-06-14 00:53:46 -04:00
|
|
|
idf_build_get_property(build_dir BUILD_DIR)
|
|
|
|
|
2020-01-06 01:17:00 -05:00
|
|
|
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")
|
2019-06-14 00:53:46 -04:00
|
|
|
|
2020-01-06 01:17:00 -05:00
|
|
|
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()
|
2019-06-14 00:53:46 -04:00
|
|
|
|
2019-05-10 06:01:58 -04:00
|
|
|
# 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()
|
2019-12-19 20:55:02 -05:00
|
|
|
|
|
|
|
# Generate flasher_args.json for tools that need it. The variables below are used
|
|
|
|
# in configuring the template flasher_args.json.in.
|
2020-01-22 11:40:10 -05:00
|
|
|
# Some of the variables (flash mode, size, frequency) are already set in project_include.cmake.
|
2019-12-19 20:55:02 -05:00
|
|
|
|
|
|
|
set(ESPTOOLPY_BEFORE "${CONFIG_ESPTOOLPY_BEFORE}")
|
|
|
|
set(ESPTOOLPY_AFTER "${CONFIG_ESPTOOLPY_AFTER}")
|
|
|
|
set(ESPTOOLPY_CHIP "${target}")
|
|
|
|
set(ESPTOOLPY_WITH_STUB TRUE)
|
|
|
|
|
2020-02-24 14:51:41 -05:00
|
|
|
if(CONFIG_SECURE_BOOT OR CONFIG_SECURE_FLASH_ENC_ENABLED)
|
2019-12-19 20:55:02 -05:00
|
|
|
# If security enabled then override post flash option
|
|
|
|
set(ESPTOOLPY_AFTER "no_reset")
|
|
|
|
endif()
|
|
|
|
|
2020-05-04 13:11:00 -04:00
|
|
|
if(CONFIG_APP_BUILD_GENERATE_BINARIES)
|
|
|
|
file(READ "flasher_args.json.in" flasher_args_content)
|
|
|
|
string(CONFIGURE "${flasher_args_content}" flasher_args_content)
|
2019-12-19 20:55:02 -05:00
|
|
|
|
2020-05-04 13:11:00 -04:00
|
|
|
file_generate("${CMAKE_CURRENT_BINARY_DIR}/flasher_args.json.in"
|
|
|
|
CONTENT "${flasher_args_content}")
|
|
|
|
file_generate("${CMAKE_BINARY_DIR}/flasher_args.json"
|
|
|
|
INPUT "${CMAKE_CURRENT_BINARY_DIR}/flasher_args.json.in")
|
|
|
|
endif()
|
2019-05-10 06:01:58 -04:00
|
|
|
endif()
|
2019-06-14 00:53:46 -04:00
|
|
|
|