feat(partition_table): Compiling script gets partition information from partition binary

This commit is contained in:
dongheng
2019-02-22 18:11:49 +08:00
parent 3c65557cd0
commit 3e7e30c889
10 changed files with 287 additions and 213 deletions

View File

@ -35,8 +35,8 @@ PHY_INIT_DATA_OBJ = $(BUILD_DIR_BASE)/phy_init_data.o
PHY_INIT_DATA_BIN = $(BUILD_DIR_BASE)/phy_init_data.bin
# Command to flash PHY init data partition
PHY_INIT_DATA_FLASH_CMD = $(ESPTOOLPY_SERIAL) write_flash $(CONFIG_PHY_DATA_OFFSET) $(PHY_INIT_DATA_BIN)
ESPTOOL_ALL_FLASH_ARGS += $(CONFIG_PHY_DATA_OFFSET) $(PHY_INIT_DATA_BIN)
PHY_INIT_DATA_FLASH_CMD = $(ESPTOOLPY_SERIAL) write_flash $(PHY_DATA_OFFSET) $(PHY_INIT_DATA_BIN)
ESPTOOL_ALL_FLASH_ARGS += $(PHY_DATA_OFFSET) $(PHY_INIT_DATA_BIN)
ESP8266_COMPONENT_PATH := $(COMPONENT_PATH)
@ -91,51 +91,35 @@ OTA2_BIN := ./build/$(PROJECT_NAME).app2.bin
OTA_V2_TO_V3_BIN := ./build/$(PROJECT_NAME).v2_to_v3.ota.bin
ifndef CONFIG_APP2_OFFSET
CONFIG_APP2_OFFSET := $(CONFIG_APP1_OFFSET)
ifndef CONFIG_ESP8266_BOOT_COPY_APP
ifdef CONFIG_ESPTOOLPY_FLASHSIZE_1MB
__COMBILE_OTA_BIN := 1
endif
endif
ifndef CONFIG_APP2_SIZE
CONFIG_APP2_SIZE := $(CONFIG_APP1_SIZE)
endif
$(OTA1_BIN): all_binaries
@cp $(RAW_BIN) $(OTA1_BIN)
@echo [GEN] $(OTA1_BIN)
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
ifneq ($(OTA1_OFFSET), $(OTA2_LINK_OFFSET))
$(OTA2_BIN): $(OTA1_BIN)
ifdef __COMBILE_OTA_BIN
@rm -f ./build/esp8266/esp8266_out.ld
@make APP_OFFSET=$(OTA2_LINK_OFFSET) APP_SIZE=$(CONFIG_APP2_SIZE) CFLAGS= CXXFLAGS=
@export CFLAGS= && export CXXFLAGS= && make APP_OFFSET=$(APP2_OFFSET) APP_SIZE=$(APP2_SIZE)
endif
@cp $(RAW_BIN) $(OTA2_BIN)
@echo [GEN] $(OTA2_BIN)
$(OTA1_BIN): all_binaries
ifneq ($(OTA1_OFFSET), $(OTA2_LINK_OFFSET))
@rm -f ./build/esp8266/esp8266_out.ld
endif
@make APP_OFFSET=$(OTA1_OFFSET) APP_SIZE=$(CONFIG_APP1_SIZE) CFLAGS= CXXFLAGS=
@cp $(RAW_BIN) $(OTA1_BIN)
@echo [GEN] $(OTA1_BIN)
$(OTA_BIN): $(OTA1_BIN) $(OTA2_BIN)
$(OTA_BIN): $(OTA2_BIN)
@cp $(OTA1_BIN) $(OTA_BIN)
ifneq ($(OTA1_OFFSET), $(OTA2_LINK_OFFSET))
ifdef __COMBILE_OTA_BIN
@cat $(OTA2_BIN) >> $(OTA_BIN)
endif
@cp $(OTA1_BIN) $(RAW_BIN)
endif
@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)
$(OTA_V2_TO_V3_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

View File

@ -41,10 +41,8 @@ COMPONENT_ADD_LINKER_DEPS := $(ALL_LIB_FILES) $(addprefix ld/,$(LINKER_SCRIPTS))
# saves us from having to add the target to a Makefile.projbuild
$(COMPONENT_LIBRARY): esp8266_out.ld esp8266_common_out.ld
OUTLD_CFLAGS := -DAPP_OFFSET=$(APP_OFFSET) -DAPP_SIZE=$(APP_SIZE)
esp8266_out.ld: $(COMPONENT_PATH)/ld/esp8266.ld ../include/sdkconfig.h
$(CC) $(OUTLD_CFLAGS) -I ../include -C -P -x c -E $< -o $@
$(CC) $(CFLAGS) -I ../include -C -P -x c -E $< -o $@
esp8266_common_out.ld: $(COMPONENT_PATH)/ld/esp8266.common.ld ../include/sdkconfig.h
$(CC) -I ../include -C -P -x c -E $< -o $@