mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/make_erase_flash' into 'master'
build system: Fix bug where erase_flash was always invoked for flash Order-only prerequisites do not work for phony targets! See merge request !337
This commit is contained in:
commit
05fcdcfedb
@ -43,7 +43,7 @@ bootloader: $(BOOTLOADER_BIN)
|
|||||||
|
|
||||||
ESPTOOL_ALL_FLASH_ARGS += $(BOOTLOADER_OFFSET) $(BOOTLOADER_BIN)
|
ESPTOOL_ALL_FLASH_ARGS += $(BOOTLOADER_OFFSET) $(BOOTLOADER_BIN)
|
||||||
|
|
||||||
bootloader-flash: $(BOOTLOADER_BIN) | erase_flash
|
bootloader-flash: $(BOOTLOADER_BIN) $(call prereq_if_explicit,erase_flash)
|
||||||
$(ESPTOOLPY_WRITE_FLASH) 0x1000 $^
|
$(ESPTOOLPY_WRITE_FLASH) 0x1000 $^
|
||||||
|
|
||||||
else ifdef CONFIG_SECURE_BOOTLOADER_ONE_TIME_FLASH
|
else ifdef CONFIG_SECURE_BOOTLOADER_ONE_TIME_FLASH
|
||||||
|
@ -43,14 +43,14 @@ APP_BIN_UNSIGNED ?= $(APP_BIN)
|
|||||||
$(APP_BIN_UNSIGNED): $(APP_ELF) $(ESPTOOLPY_SRC)
|
$(APP_BIN_UNSIGNED): $(APP_ELF) $(ESPTOOLPY_SRC)
|
||||||
$(ESPTOOLPY) elf2image $(ESPTOOL_FLASH_OPTIONS) $(ESPTOOL_ELF2IMAGE_OPTIONS) -o $@ $<
|
$(ESPTOOLPY) elf2image $(ESPTOOL_FLASH_OPTIONS) $(ESPTOOL_ELF2IMAGE_OPTIONS) -o $@ $<
|
||||||
|
|
||||||
flash: all_binaries $(ESPTOOLPY_SRC) | erase_flash
|
flash: all_binaries $(ESPTOOLPY_SRC) $(call prereq_if_explicit,erase_flash)
|
||||||
@echo "Flashing binaries to serial port $(ESPPORT) (app at offset $(CONFIG_APP_OFFSET))..."
|
@echo "Flashing binaries to serial port $(ESPPORT) (app at offset $(CONFIG_APP_OFFSET))..."
|
||||||
ifdef CONFIG_SECURE_BOOT_ENABLED
|
ifdef CONFIG_SECURE_BOOT_ENABLED
|
||||||
@echo "(Secure boot enabled, so bootloader not flashed automatically. See 'make bootloader' output)"
|
@echo "(Secure boot enabled, so bootloader not flashed automatically. See 'make bootloader' output)"
|
||||||
endif
|
endif
|
||||||
$(ESPTOOLPY_WRITE_FLASH) $(ESPTOOL_ALL_FLASH_ARGS)
|
$(ESPTOOLPY_WRITE_FLASH) $(ESPTOOL_ALL_FLASH_ARGS)
|
||||||
|
|
||||||
app-flash: $(APP_BIN) $(ESPTOOLPY_SRC) | erase_flash
|
app-flash: $(APP_BIN) $(ESPTOOLPY_SRC) $(call prereq_if_explicit,erase_flash)
|
||||||
@echo "Flashing app to serial port $(ESPPORT), offset $(CONFIG_APP_OFFSET)..."
|
@echo "Flashing app to serial port $(ESPPORT), offset $(CONFIG_APP_OFFSET)..."
|
||||||
$(ESPTOOLPY_WRITE_FLASH) $(CONFIG_APP_OFFSET) $(APP_BIN)
|
$(ESPTOOLPY_WRITE_FLASH) $(CONFIG_APP_OFFSET) $(APP_BIN)
|
||||||
|
|
||||||
@ -58,7 +58,8 @@ app-flash: $(APP_BIN) $(ESPTOOLPY_SRC) | erase_flash
|
|||||||
# at the project level as long as qualified path
|
# at the project level as long as qualified path
|
||||||
COMPONENT_SUBMODULES += $(COMPONENT_PATH)/esptool
|
COMPONENT_SUBMODULES += $(COMPONENT_PATH)/esptool
|
||||||
|
|
||||||
.PHONY: erase_flash
|
|
||||||
erase_flash:
|
erase_flash:
|
||||||
@echo "Erasing entire flash..."
|
@echo "Erasing entire flash..."
|
||||||
$(ESPTOOLPY_SERIAL) erase_flash
|
$(ESPTOOLPY_SERIAL) erase_flash
|
||||||
|
|
||||||
|
.PHONY: erase_flash
|
||||||
|
@ -54,3 +54,17 @@ endef
|
|||||||
define resolvepath
|
define resolvepath
|
||||||
$(foreach dir,$(1),$(if $(filter /%,$(dir)),$(dir),$(subst //,/,$(2)/$(dir))))
|
$(foreach dir,$(1),$(if $(filter /%,$(dir)),$(dir),$(subst //,/,$(2)/$(dir))))
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
|
||||||
|
# macro to include a target only if it's on the list of targets that make
|
||||||
|
# was invoked with
|
||||||
|
#
|
||||||
|
# This allows you to have something like an "order-only phony prerequisite",
|
||||||
|
# ie a prerequisite that determines an order phony targets have to run in.
|
||||||
|
#
|
||||||
|
# Because normal order-only prerequisites don't work with phony targets.
|
||||||
|
#
|
||||||
|
# example $(call prereq_if_explicit,erase_flash)
|
||||||
|
define prereq_if_explicit
|
||||||
|
$(filter $(1),$(MAKECMDGOALS))
|
||||||
|
endef
|
||||||
|
@ -26,7 +26,7 @@ menuconfig: $(KCONFIG_TOOL_DIR)/mconf $(IDF_PATH)/Kconfig
|
|||||||
$(KCONFIG_TOOL_ENV) $(KCONFIG_TOOL_DIR)/mconf $(IDF_PATH)/Kconfig
|
$(KCONFIG_TOOL_ENV) $(KCONFIG_TOOL_DIR)/mconf $(IDF_PATH)/Kconfig
|
||||||
|
|
||||||
ifeq ("$(wildcard $(SDKCONFIG))","")
|
ifeq ("$(wildcard $(SDKCONFIG))","")
|
||||||
ifeq ("$(filter defconfig,$(MAKECMDGOALS))","")
|
ifeq ("$(call prereq_if_explicit,defconfig)","")
|
||||||
# if not configuration is present and defconfig is not a target, run makeconfig
|
# if not configuration is present and defconfig is not a target, run makeconfig
|
||||||
$(SDKCONFIG): menuconfig
|
$(SDKCONFIG): menuconfig
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user