2019-06-21 14:29:32 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								idf_component_register(SRCS "esp_ota_ops.c" 
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                            "esp_app_desc.c"
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-28 15:38:23 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                    INCLUDE_DIRS "include"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                    REQUIRES spi_flash partition_table bootloader_support)
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-31 12:30:14 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-22 11:45:45 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								# esp_app_desc structure is added as an undefined symbol because otherwise the
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-05 14:07:41 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								# linker will ignore this structure as it has no other files depending on it.
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-04 19:05:33 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								target_link_libraries(${COMPONENT_LIB} INTERFACE "-u esp_app_desc")
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-05 14:07:41 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-08 00:23:44 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								# cut PROJECT_VER and PROJECT_NAME to required 32 characters.
							 | 
						
					
						
							
								
									
										
										
										
											2019-05-10 10:53:08 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								idf_build_get_property(project_ver PROJECT_VER)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								idf_build_get_property(project_name PROJECT_NAME)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								string(SUBSTRING "${project_ver}" 0 31 PROJECT_VER_CUT)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								string(SUBSTRING "${project_name}" 0 31 PROJECT_NAME_CUT)
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-08 00:23:44 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-05 20:29:07 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								set_source_files_properties(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    SOURCE "esp_app_desc.c"
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-22 11:45:45 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    PROPERTIES COMPILE_DEFINITIONS
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-08 00:23:44 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    "PROJECT_VER=\"${PROJECT_VER_CUT}\"; PROJECT_NAME=\"${PROJECT_NAME_CUT}\"")
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-05 20:29:07 +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-01-22 11:45:45 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        add_custom_command(OUTPUT ${blank_otadata_file}
							 | 
						
					
						
							
								
									
										
										
										
											2019-05-27 11:08:28 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            COMMAND ${python} ${idf_path}/components/partition_table/gen_empty_partition.py
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            ${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)
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-16 05:01:15 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-05-10 10:53:08 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        set(otatool_py ${python} ${COMPONENT_DIR}/otatool.py)
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-16 05:01:15 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-28 14:08:32 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        set(esptool_args --esptool-args before=${CONFIG_ESPTOOLPY_BEFORE} after=${CONFIG_ESPTOOLPY_AFTER})
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-22 11:45:45 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        add_custom_target(read_otadata DEPENDS "${PARTITION_CSV_PATH}"
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-28 14:08:32 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                        COMMAND ${otatool_py} ${esptool_args}
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-04 15:49:55 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                        --partition-table-file ${PARTITION_CSV_PATH} 
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                        --partition-table-offset ${PARTITION_TABLE_OFFSET}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                        read_otadata)
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-16 05:01:15 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-22 11:45:45 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        add_custom_target(erase_otadata DEPENDS "${PARTITION_CSV_PATH}"
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-28 14:08:32 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                        COMMAND ${otatool_py} ${esptool_args}
							 | 
						
					
						
							
								
									
										
										
										
											2019-06-04 15:49:55 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                        --partition-table-file ${PARTITION_CSV_PATH}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                        --partition-table-offset ${PARTITION_TABLE_OFFSET}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                        erase_otadata)
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-22 11:45:45 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        esptool_py_flash_project_args(otadata ${otadata_offset} "${blank_otadata_file}" FLASH_IN_PROJECT)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    endif()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								endif()
							 |