diff --git a/components/esptool_py/Makefile.projbuild b/components/esptool_py/Makefile.projbuild index dce6b0af..1d8b170b 100644 --- a/components/esptool_py/Makefile.projbuild +++ b/components/esptool_py/Makefile.projbuild @@ -14,7 +14,7 @@ PYTHON ?= $(call dequote,$(CONFIG_PYTHON)) # to invoke esptool.py (with or without serial port args) # ESPTOOLPY_SRC := $(COMPONENT_PATH)/esptool/esptool.py -ESPTOOLPY := $(PYTHON) $(ESPTOOLPY_SRC) --chip esp32 +ESPTOOLPY := $(PYTHON) $(ESPTOOLPY_SRC) --chip esp8266 ESPTOOLPY_SERIAL := $(ESPTOOLPY) --port $(ESPPORT) --baud $(ESPBAUD) --before $(CONFIG_ESPTOOLPY_BEFORE) --after $(CONFIG_ESPTOOLPY_AFTER) # Supporting esptool command line tools @@ -29,7 +29,11 @@ else ESPTOOL_WRITE_FLASH_OPTIONS := $(ESPTOOL_FLASH_OPTIONS) endif +ifndef IS_BOOTLOADER_BUILD +ESPTOOL_ELF2IMAGE_OPTIONS := --version=2 +else ESPTOOL_ELF2IMAGE_OPTIONS := +endif ESPTOOLPY_WRITE_FLASH=$(ESPTOOLPY_SERIAL) write_flash $(if $(CONFIG_ESPTOOLPY_COMPRESSED),-z,-u) $(ESPTOOL_WRITE_FLASH_OPTIONS) @@ -49,6 +53,9 @@ APP_BIN_UNSIGNED ?= $(APP_BIN) $(APP_BIN_UNSIGNED): $(APP_ELF) $(ESPTOOLPY_SRC) $(ESPTOOLPY) elf2image $(ESPTOOL_FLASH_OPTIONS) $(ESPTOOL_ELF2IMAGE_OPTIONS) -o $@ $< +ifdef IS_BOOTLOADER_BUILD + @mv $@0x00000.bin $@ +endif flash: all_binaries $(ESPTOOLPY_SRC) $(call prereq_if_explicit,erase_flash) @echo "Flashing binaries to serial port $(ESPPORT) (app at offset $(CONFIG_APP_OFFSET))..."