forked from espressif/esp-idf
cmake: use otatool and parttool for build
This commit is contained in:
@@ -7,12 +7,21 @@ set(COMPONENT_PRIV_REQUIRES bootloader_support)
|
|||||||
register_component()
|
register_component()
|
||||||
|
|
||||||
# Add custom target for generating empty otadata partition for flashing
|
# Add custom target for generating empty otadata partition for flashing
|
||||||
if(OTADATA_PARTITION_OFFSET AND IDF_BUILD_ARTIFACTS)
|
if(OTADATA_PARTITION_OFFSET AND OTADATA_PARTITION_SIZE)
|
||||||
add_custom_command(OUTPUT "${IDF_BUILD_ARTIFACTS_DIR}/${BLANK_OTADATA_FILE}"
|
add_custom_command(OUTPUT "${IDF_BUILD_ARTIFACTS_DIR}/${BLANK_OTADATA_FILE}"
|
||||||
COMMAND ${PYTHON} ${CMAKE_CURRENT_SOURCE_DIR}/gen_empty_partition.py
|
COMMAND ${PYTHON} ${IDF_PATH}/components/partition_table/parttool.py
|
||||||
--size ${OTADATA_PARTITION_SIZE} "${IDF_BUILD_ARTIFACTS_DIR}/${BLANK_OTADATA_FILE}")
|
--partition-type data --partition-subtype ota -q
|
||||||
|
--partition-table-file ${PARTITION_CSV_PATH} generate_blank_partition_file
|
||||||
|
--output "${IDF_BUILD_ARTIFACTS_DIR}/${BLANK_OTADATA_FILE}")
|
||||||
|
|
||||||
add_custom_target(blank_ota_data ALL DEPENDS "${IDF_BUILD_ARTIFACTS_DIR}/${BLANK_OTADATA_FILE}")
|
add_custom_target(blank_ota_data ALL DEPENDS "${IDF_BUILD_ARTIFACTS_DIR}/${BLANK_OTADATA_FILE}")
|
||||||
|
|
||||||
add_dependencies(flash blank_ota_data)
|
add_dependencies(flash blank_ota_data)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set(otatool_py ${PYTHON} ${COMPONENT_PATH}/otatool.py)
|
||||||
|
|
||||||
|
add_custom_target(read_otadata DEPENDS "${PARTITION_CSV_PATH}"
|
||||||
|
COMMAND ${otatool_py} --partition-table-file ${PARTITION_CSV_PATH} read_otadata)
|
||||||
|
|
||||||
|
add_custom_target(erase_otadata DEPENDS "${PARTITION_CSV_PATH}"
|
||||||
|
COMMAND ${otatool_py} --partition-table-file ${PARTITION_CSV_PATH} erase_otadata)
|
||||||
|
@@ -3,6 +3,7 @@
|
|||||||
# partition table
|
# partition table
|
||||||
# (NB: because of component dependency, we know partition_table
|
# (NB: because of component dependency, we know partition_table
|
||||||
# project_include.cmake has already been included.)
|
# project_include.cmake has already been included.)
|
||||||
if(OTADATA_PARTITION_OFFSET AND IDF_BUILD_ARTIFACTS)
|
|
||||||
|
if(OTADATA_PARTITION_OFFSET AND OTADATA_PARTITION_SIZE AND IDF_BUILD_ARTIFACTS)
|
||||||
set(BLANK_OTADATA_FILE "ota_data_initial.bin")
|
set(BLANK_OTADATA_FILE "ota_data_initial.bin")
|
||||||
endif()
|
endif()
|
||||||
|
@@ -407,6 +407,8 @@ ACTIONS = {
|
|||||||
"flash": ( flash, [ "all" ], [ "erase_flash" ] ),
|
"flash": ( flash, [ "all" ], [ "erase_flash" ] ),
|
||||||
"erase_flash": ( erase_flash, [], []),
|
"erase_flash": ( erase_flash, [], []),
|
||||||
"monitor": ( monitor, [], [ "flash", "partition_table-flash", "bootloader-flash", "app-flash" ]),
|
"monitor": ( monitor, [], [ "flash", "partition_table-flash", "bootloader-flash", "app-flash" ]),
|
||||||
|
"erase_otadata": ( build_target, [], []),
|
||||||
|
"read_otadata": ( build_target, [], []),
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_commandline_options():
|
def get_commandline_options():
|
||||||
|
Reference in New Issue
Block a user