| 
									
										
										
										
											2021-03-08 19:46:37 +11:00
										 |  |  | idf_component_register(PRIV_REQUIRES partition_table esptool_py)
 | 
					
						
							| 
									
										
										
										
											2019-05-10 10:53:08 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-22 11:45:45 +08:00
										 |  |  | # Do not generate flash file when building bootloader or is in early expansion of the build
 | 
					
						
							| 
									
										
										
										
											2019-07-22 16:04:03 +02:00
										 |  |  | if(BOOTLOADER_BUILD OR NOT CONFIG_APP_BUILD_BOOTLOADER)
 | 
					
						
							| 
									
										
										
										
											2019-01-22 11:45:45 +08:00
										 |  |  |     return()
 | 
					
						
							|  |  |  | endif()
 | 
					
						
							| 
									
										
										
										
											2018-01-12 13:49:13 +11:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-08 11:37:02 +08:00
										 |  |  | add_dependencies(bootloader partition_table_bin)
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-19 13:04:47 +05:30
										 |  |  | # When secure boot is enabled and CONFIG_SECURE_BOOT_FLASH_BOOTLOADER_DEFAULT is not enabled
 | 
					
						
							|  |  |  | # do not flash the bootloader along with the other artifacts using the command `idf.py flash`
 | 
					
						
							|  |  |  | if(NOT CONFIG_SECURE_BOOT OR CONFIG_SECURE_BOOT_FLASH_BOOTLOADER_DEFAULT)
 | 
					
						
							| 
									
										
										
										
											2020-02-25 01:21:41 +05:30
										 |  |  |     set(flash_bootloader FLASH_IN_PROJECT)
 | 
					
						
							|  |  |  | endif()
 | 
					
						
							| 
									
										
										
										
											2019-06-14 12:53:46 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | esptool_py_custom_target(bootloader-flash bootloader "bootloader")
 | 
					
						
							| 
									
										
										
										
											2020-11-10 17:51:08 +11:00
										 |  |  | esptool_py_flash_target_image(bootloader-flash bootloader | 
					
						
							|  |  |  |     ${CONFIG_BOOTLOADER_OFFSET_IN_FLASH}
 | 
					
						
							|  |  |  |     "${BOOTLOADER_BUILD_DIR}/bootloader.bin")
 | 
					
						
							| 
									
										
										
										
											2019-12-20 09:55:02 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | # Also attach an image to the project flash target
 | 
					
						
							| 
									
										
										
										
											2023-05-19 13:04:47 +05:30
										 |  |  | if(NOT CONFIG_SECURE_BOOT OR CONFIG_SECURE_BOOT_FLASH_BOOTLOADER_DEFAULT)
 | 
					
						
							| 
									
										
										
										
											2020-11-10 17:51:08 +11:00
										 |  |  |     esptool_py_flash_target_image(flash bootloader | 
					
						
							|  |  |  |         ${CONFIG_BOOTLOADER_OFFSET_IN_FLASH}
 | 
					
						
							|  |  |  |         "${BOOTLOADER_BUILD_DIR}/bootloader.bin")
 | 
					
						
							|  |  |  | endif()
 |