mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'feature/esptool_py_use_component_properties' into 'master'
esptool_py: use component property to simplify arg file generation See merge request espressif/esp-idf!5312
This commit is contained in:
commit
bd0a5d4c8b
@ -10,6 +10,15 @@ if(NOT BOOTLOADER_BUILD)
|
||||
set(ESPTOOLPY_FLASH_PROJECT_OPTIONS "")
|
||||
endif()
|
||||
|
||||
# FLASH_PROJECT_ARGS, FLASH_PROJECT_ARGS_JSON, FLASH_PROJECT_ARGS_ENTRY_JSON
|
||||
# are used in the flasher args input files (flash_project_args.in, flasher_args.json.in)
|
||||
idf_component_get_property(FLASH_PROJECT_ARGS ${COMPONENT_NAME}
|
||||
FLASH_PROJECT_ARGS GENERATOR_EXPRESSION)
|
||||
idf_component_get_property(FLASH_PROJECT_ARGS_JSON ${COMPONENT_NAME}
|
||||
FLASH_PROJECT_ARGS_JSON GENERATOR_EXPRESSION)
|
||||
idf_component_get_property(FLASH_PROJECT_ARGS_ENTRY_JSON ${COMPONENT_NAME}
|
||||
FLASH_PROJECT_ARGS_ENTRY_JSON GENERATOR_EXPRESSION)
|
||||
|
||||
# Generate the flash project args and the flasher args json file using the accumulated values
|
||||
# from esptool_py_flash_project_args calls. The file is first configured using configure_file() for all variable values,
|
||||
# and then generated using file(GENERATE... for generator expressions.
|
||||
|
@ -1,3 +1,3 @@
|
||||
${ESPTOOLPY_FLASH_PROJECT_OPTIONS}
|
||||
$<JOIN:$<TARGET_PROPERTY:flash_project_args_target,FLASH_PROJECT_ARGS>,
|
||||
$<JOIN:${FLASH_PROJECT_ARGS},
|
||||
>
|
@ -8,10 +8,10 @@
|
||||
"flash_freq": "${ESPFLASHFREQ}"
|
||||
},
|
||||
"flash_files" : {
|
||||
$<JOIN:$<TARGET_PROPERTY:flash_project_args_target,FLASH_PROJECT_ARGS_JSON>,,
|
||||
$<JOIN:${FLASH_PROJECT_ARGS_JSON},,
|
||||
>
|
||||
},
|
||||
$<JOIN:$<TARGET_PROPERTY:flash_project_args_target,FLASH_PROJECT_ARGS_ENTRY_JSON>,,
|
||||
$<JOIN:${FLASH_PROJECT_ARGS_ENTRY_JSON},,
|
||||
>,
|
||||
"extra_esptool_args" : {
|
||||
"after" : "${ESPTOOLPY_AFTER}",
|
||||
|
@ -149,9 +149,6 @@ if(CONFIG_SECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT)
|
||||
esptool_py_custom_target(encrypted-app-flash encrypted_app "app")
|
||||
endif()
|
||||
|
||||
|
||||
add_custom_target(flash_project_args_target)
|
||||
|
||||
# esptool_py_flash_project_args
|
||||
#
|
||||
# Add file to the flasher args list, to be flashed at a particular offset.
|
||||
@ -164,17 +161,14 @@ function(esptool_py_flash_project_args entry offset image)
|
||||
# flash the image individually using esptool
|
||||
cmake_parse_arguments(_ "${options}" "${single_value}" "" "${ARGN}")
|
||||
|
||||
idf_build_get_property(build_dir BUILD_DIR)
|
||||
get_property(flash_project_entries TARGET flash_project_args_target PROPERTY FLASH_PROJECT_ENTRIES)
|
||||
|
||||
if(${entry} IN_LIST flash_project_entries)
|
||||
message(FATAL_ERROR "entry '${entry}' has already been added to flash project entries")
|
||||
endif()
|
||||
|
||||
list(APPEND flash_project_entries "${entry}")
|
||||
set_property(TARGET flash_project_args_target PROPERTY FLASH_PROJECT_ENTRIES "${flash_project_entries}")
|
||||
idf_component_set_property(esptool_py FLASH_PROJECT_ENTRIES "${entry}" APPEND)
|
||||
|
||||
file(RELATIVE_PATH image ${CMAKE_BINARY_DIR} ${image})
|
||||
idf_build_get_property(build_dir BUILD_DIR)
|
||||
file(RELATIVE_PATH image ${build_dir} ${image})
|
||||
|
||||
# Generate the standalone flash file to flash the image individually using esptool
|
||||
set(entry_flash_args ${build_dir}/flash_${entry}_args)
|
||||
@ -201,21 +195,15 @@ function(esptool_py_flash_project_args entry offset image)
|
||||
APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${entry_flash_args})
|
||||
|
||||
# Generate standalone entries in the flasher args json file
|
||||
get_property(flash_project_args_entry_json TARGET
|
||||
flash_project_args_target PROPERTY FLASH_PROJECT_ARGS_ENTRY_JSON)
|
||||
list(APPEND flash_project_args_entry_json
|
||||
"\"${entry}\" : { \"offset\" : \"${offset}\", \"file\" : \"${image}\" }")
|
||||
set_property(TARGET flash_project_args_target
|
||||
PROPERTY FLASH_PROJECT_ARGS_ENTRY_JSON "${flash_project_args_entry_json}")
|
||||
idf_component_set_property(esptool_py FLASH_PROJECT_ARGS_ENTRY_JSON
|
||||
"\"${entry}\" : { \"offset\" : \"${offset}\", \"file\" : \"${image}\" }" APPEND)
|
||||
|
||||
# Generate entries in the flasher args json file
|
||||
if(__FLASH_IN_PROJECT)
|
||||
get_property(flash_project_args TARGET flash_project_args_target PROPERTY FLASH_PROJECT_ARGS)
|
||||
list(APPEND flash_project_args "${offset} ${image}")
|
||||
set_property(TARGET flash_project_args_target PROPERTY FLASH_PROJECT_ARGS "${flash_project_args}")
|
||||
idf_component_set_property(esptool_py FLASH_PROJECT_ARGS
|
||||
"${offset} ${image}" APPEND)
|
||||
|
||||
get_property(flash_project_args_json TARGET flash_project_args_target PROPERTY FLASH_PROJECT_ARGS_JSON)
|
||||
list(APPEND flash_project_args_json "\"${offset}\" : \"${image}\"")
|
||||
set_property(TARGET flash_project_args_target PROPERTY FLASH_PROJECT_ARGS_JSON "${flash_project_args_json}")
|
||||
idf_component_set_property(esptool_py FLASH_PROJECT_ARGS_JSON
|
||||
"\"${offset}\" : \"${image}\"" APPEND)
|
||||
endif()
|
||||
endfunction()
|
||||
|
Loading…
x
Reference in New Issue
Block a user