feat(bootloader): Support v2 firmware updates to v3 by OTA

This commit is contained in:
Dong Heng
2018-11-09 19:54:17 +08:00
parent ef79175caf
commit 11db1b0daf
18 changed files with 752 additions and 15 deletions

View File

@ -89,10 +89,22 @@ OTA_BIN := ./build/$(PROJECT_NAME).ota.bin
OTA1_BIN := ./build/$(PROJECT_NAME).app1.bin
OTA2_BIN := ./build/$(PROJECT_NAME).app2.bin
OTA_V2_TO_V3_BIN := ./build/$(PROJECT_NAME).v2_to_v3.ota.bin
CONFIG_APP2_OFFSET ?= $(CONFIG_APP1_OFFSET)
CONFIG_APP2_SIZE ?= $(CONFIG_APP1_SIZE)
OTA1_OFFSET := CONFIG_APP1_OFFSET
ifdef CONFIG_ESP8266_BOOT_COPY_APP
OTA2_LINK_OFFSET := $(CONFIG_APP1_OFFSET)
else
OTA2_LINK_OFFSET := $(CONFIG_APP2_OFFSET)
endif
$(OTA2_BIN): all_binaries
ifeq ($(CONFIG_ESPTOOLPY_FLASHSIZE), "1MB")
@rm -f ./build/esp8266/esp8266_out.ld
@make APP_OFFSET=$(CONFIG_APP2_OFFSET) APP_SIZE=$(CONFIG_APP2_SIZE) CFLAGS= CXXFLAGS=
@make APP_OFFSET=$(OTA2_LINK_OFFSET) APP_SIZE=$(CONFIG_APP2_SIZE) CFLAGS= CXXFLAGS=
endif
@cp $(RAW_BIN) $(OTA2_BIN)
@echo [GEN] $(OTA2_BIN)
@ -113,9 +125,22 @@ endif
@cp $(OTA1_BIN) $(RAW_BIN)
@echo [GEN] $(OTA_BIN)
ifdef CONFIG_ESP8266_OTA_FROM_OLD
$(OTA_V2_TO_V3_BIN): $(OTA_BIN)
@cp $(RAW_BIN) $(RAW_BIN).tmp.bak
@cp $(OTA1_BIN) $(RAW_BIN)
@python $(IDF_PATH)/tools/pack_fw.py --output $(OTA_V2_TO_V3_BIN) pack3 $(ESPTOOL_ALL_FLASH_ARGS)
@cp $(RAW_BIN).tmp.bak $(RAW_BIN)
@echo [GEN] $(OTA_V2_TO_V3_BIN)
endif
ifdef CONFIG_ESP8266_OTA_FROM_OLD
ota: $(OTA_V2_TO_V3_BIN)
else
ota: $(OTA_BIN)
endif
ota-clean:
@rm -f $(OTA_BIN) $(OTA1_BIN) $(OTA2_BIN)
@rm -f $(OTA_BIN) $(OTA1_BIN) $(OTA2_BIN) $(OTA_V2_TO_V3_BIN)
clean: ota-clean