2023-08-28 14:02:08 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								idf_build_get_property(target IDF_TARGET)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								if(${target} STREQUAL "linux")
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return() # This component is not supported by the POSIX/Linux simulator
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								endif()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2022-08-02 14:24:29 +05:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								idf_component_register(SRCS "esp_ota_ops.c" "esp_ota_app_desc.c"
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-28 15:38:23 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                    INCLUDE_DIRS "include"
							 | 
						
					
						
							
								
									
										
										
										
											2022-12-14 01:16:56 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                    REQUIRES partition_table bootloader_support esp_app_format esp_bootloader_format esp_partition
							 | 
						
					
						
							
								
									
										
										
										
											2022-10-14 14:15:32 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                    PRIV_REQUIRES esptool_py efuse spi_flash)
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-31 12:30:14 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-05-10 10:53:08 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								if(NOT BOOTLOADER_BUILD)
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-22 11:45:45 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    partition_table_get_partition_info(otadata_offset "--partition-type data --partition-subtype ota" "offset")
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    partition_table_get_partition_info(otadata_size "--partition-type data --partition-subtype ota" "size")
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-11 15:36:10 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-22 11:45:45 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    # Add custom target for generating empty otadata partition for flashing
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if(otadata_size AND otadata_offset)
							 | 
						
					
						
							
								
									
										
										
										
											2019-05-10 10:53:08 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        idf_build_get_property(build_dir BUILD_DIR)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        set(blank_otadata_file ${build_dir}/ota_data_initial.bin)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        idf_build_get_property(idf_path IDF_PATH)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        idf_build_get_property(python PYTHON)
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-03 19:41:50 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        idf_component_get_property(partition_table_dir partition_table COMPONENT_DIR)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-22 11:45:45 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        add_custom_command(OUTPUT ${blank_otadata_file}
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-03 19:41:50 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            COMMAND ${python} ${partition_table_dir}/gen_empty_partition.py
							 | 
						
					
						
							
								
									
										
										
										
											2019-05-27 11:08:28 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            ${otadata_size} ${blank_otadata_file})
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-22 11:45:45 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        add_custom_target(blank_ota_data ALL DEPENDS ${blank_otadata_file})
							 | 
						
					
						
							
								
									
										
										
										
											2019-05-10 13:09:30 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        add_dependencies(flash blank_ota_data)
							 | 
						
					
						
							
								
									
										
										
										
											2021-08-26 12:00:00 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        add_dependencies(encrypted-flash blank_ota_data)
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-16 05:01:15 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2022-05-20 14:03:49 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        set(otatool_py "${python}" "${COMPONENT_DIR}/otatool.py")
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        set(esptool_args --esptool-args before=${CONFIG_ESPTOOLPY_BEFORE} after=${CONFIG_ESPTOOLPY_AFTER})
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        set(otatool_args --partition-table-file ${PARTITION_CSV_PATH})
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        list(APPEND otatool_args --partition-table-offset ${PARTITION_TABLE_OFFSET})
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-16 05:01:15 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-10-12 22:12:49 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        idf_component_get_property(esptool_py_dir esptool_py COMPONENT_DIR)
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-28 14:08:32 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-08-11 15:24:17 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        add_custom_target(read-otadata DEPENDS "${PARTITION_CSV_PATH}"
							 | 
						
					
						
							
								
									
										
										
										
											2020-10-12 22:12:49 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            COMMAND ${CMAKE_COMMAND}
							 | 
						
					
						
							
								
									
										
										
										
											2022-05-20 14:03:49 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            -D "IDF_PATH=${idf_path}"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            -D "SERIAL_TOOL=${otatool_py}"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            -D "SERIAL_TOOL_ARGS=${esptool_args};${otatool_args};read_otadata"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            -D "WORKING_DIRECTORY=${build_dir}"
							 | 
						
					
						
							
								
									
										
										
										
											2020-10-12 22:12:49 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            -P ${esptool_py_dir}/run_serial_tool.cmake
							 | 
						
					
						
							
								
									
										
										
										
											2022-05-20 14:03:49 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            WORKING_DIRECTORY "${build_dir}"
							 | 
						
					
						
							
								
									
										
										
										
											2020-10-12 22:12:49 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            USES_TERMINAL
							 | 
						
					
						
							
								
									
										
										
										
											2022-05-20 14:03:49 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            VERBATIM
							 | 
						
					
						
							
								
									
										
										
										
											2020-10-12 22:12:49 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            )
							 | 
						
					
						
							
								
									
										
										
										
											2021-08-11 15:24:17 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        add_deprecated_target_alias(read_otadata read-otadata)
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-16 05:01:15 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-08-11 15:24:17 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        add_custom_target(erase-otadata DEPENDS "${PARTITION_CSV_PATH}"
							 | 
						
					
						
							
								
									
										
										
										
											2020-10-12 22:12:49 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            COMMAND ${CMAKE_COMMAND}
							 | 
						
					
						
							
								
									
										
										
										
											2022-05-20 14:03:49 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            -D "IDF_PATH=${idf_path}"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            -D "SERIAL_TOOL=${otatool_py}"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            -D "SERIAL_TOOL_ARGS=${esptool_args};${otatool_args};erase_otadata"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            -D "WORKING_DIRECTORY=${build_dir}"
							 | 
						
					
						
							
								
									
										
										
										
											2020-10-12 22:12:49 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            -P ${esptool_py_dir}/run_serial_tool.cmake
							 | 
						
					
						
							
								
									
										
										
										
											2022-05-20 14:03:49 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            WORKING_DIRECTORY "${build_dir}"
							 | 
						
					
						
							
								
									
										
										
										
											2020-10-12 22:12:49 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            USES_TERMINAL
							 | 
						
					
						
							
								
									
										
										
										
											2022-05-20 14:03:49 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            VERBATIM
							 | 
						
					
						
							
								
									
										
										
										
											2020-10-12 22:12:49 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            )
							 | 
						
					
						
							
								
									
										
										
										
											2021-08-11 15:24:17 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        add_deprecated_target_alias(erase_otadata erase-otadata)
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-22 11:45:45 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-20 09:55:02 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        idf_component_get_property(main_args esptool_py FLASH_ARGS)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        idf_component_get_property(sub_args esptool_py FLASH_SUB_ARGS)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        esptool_py_flash_target(otadata-flash "${main_args}" "${sub_args}")
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        esptool_py_flash_target_image(otadata-flash otadata "${otadata_offset}" "${blank_otadata_file}")
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        esptool_py_flash_target_image(flash otadata "${otadata_offset}" "${blank_otadata_file}")
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-22 11:45:45 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    endif()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								endif()
							 |