2018-10-05 08:29:07 -04:00
|
|
|
set(COMPONENT_SRCS "esp_ota_ops.c"
|
|
|
|
"esp_app_desc.c")
|
2018-01-19 00:22:08 -05:00
|
|
|
set(COMPONENT_ADD_INCLUDEDIRS "include")
|
|
|
|
|
2018-10-05 08:29:07 -04:00
|
|
|
set(COMPONENT_REQUIRES spi_flash partition_table bootloader_support)
|
2018-03-22 02:27:10 -04:00
|
|
|
|
2018-01-11 21:49:13 -05:00
|
|
|
register_component()
|
2018-08-31 00:30:14 -04:00
|
|
|
|
2018-12-05 01:07:41 -05:00
|
|
|
# esp_app_desc structure is added as an undefined symbol because otherwise the
|
|
|
|
# linker will ignore this structure as it has no other files depending on it.
|
|
|
|
target_link_libraries(${COMPONENT_TARGET} "-u esp_app_desc")
|
|
|
|
|
2018-12-07 11:23:44 -05:00
|
|
|
# cut PROJECT_VER and PROJECT_NAME to required 32 characters.
|
|
|
|
string(SUBSTRING "${PROJECT_VER}" 0 31 PROJECT_VER_CUT)
|
|
|
|
string(SUBSTRING "${PROJECT_NAME}" 0 31 PROJECT_NAME_CUT)
|
|
|
|
|
2018-10-05 08:29:07 -04:00
|
|
|
set_source_files_properties(
|
|
|
|
SOURCE "esp_app_desc.c"
|
|
|
|
PROPERTIES COMPILE_DEFINITIONS
|
2018-12-07 11:23:44 -05:00
|
|
|
"PROJECT_VER=\"${PROJECT_VER_CUT}\"; PROJECT_NAME=\"${PROJECT_NAME_CUT}\"")
|
2018-10-05 08:29:07 -04:00
|
|
|
|
2018-08-31 00:30:14 -04:00
|
|
|
# Add custom target for generating empty otadata partition for flashing
|
2018-11-15 16:01:15 -05:00
|
|
|
if(OTADATA_PARTITION_OFFSET AND OTADATA_PARTITION_SIZE)
|
2018-11-11 02:36:10 -05:00
|
|
|
add_custom_command(OUTPUT "${IDF_BUILD_ARTIFACTS_DIR}/${BLANK_OTADATA_FILE}"
|
2018-11-15 16:01:15 -05:00
|
|
|
COMMAND ${PYTHON} ${IDF_PATH}/components/partition_table/parttool.py
|
|
|
|
--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}")
|
2018-11-11 02:36:10 -05:00
|
|
|
|
|
|
|
add_custom_target(blank_ota_data ALL DEPENDS "${IDF_BUILD_ARTIFACTS_DIR}/${BLANK_OTADATA_FILE}")
|
2018-08-31 00:30:14 -04:00
|
|
|
add_dependencies(flash blank_ota_data)
|
|
|
|
endif()
|
2018-11-15 16:01:15 -05:00
|
|
|
|
|
|
|
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)
|