mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
esptool: Add new options to reset before/after, detect flash size
This commit is contained in:
parent
8bcd341fca
commit
d245f016ea
@ -50,11 +50,14 @@ else ifdef CONFIG_SECURE_BOOTLOADER_ONE_TIME_FLASH
|
|||||||
|
|
||||||
# One time flashing requires user to run esptool.py command themselves,
|
# One time flashing requires user to run esptool.py command themselves,
|
||||||
# and warning is printed about inability to reflash.
|
# and warning is printed about inability to reflash.
|
||||||
|
#
|
||||||
|
# The flashing command is deliberately printed without an auto-reset
|
||||||
|
# step, so the device doesn't immediately reset to flash itself.
|
||||||
|
|
||||||
bootloader: $(BOOTLOADER_BIN)
|
bootloader: $(BOOTLOADER_BIN)
|
||||||
@echo $(SEPARATOR)
|
@echo $(SEPARATOR)
|
||||||
@echo "Bootloader built. One-time flash command is:"
|
@echo "Bootloader built. One-time flash command is:"
|
||||||
@echo "$(ESPTOOLPY_WRITE_FLASH) $(BOOTLOADER_OFFSET) $(BOOTLOADER_BIN)"
|
@echo "$(subst hard_reset,no_reset,$(ESPTOOLPY_WRITE_FLASH)) $(BOOTLOADER_OFFSET) $(BOOTLOADER_BIN)"
|
||||||
@echo $(SEPARATOR)
|
@echo $(SEPARATOR)
|
||||||
@echo "* IMPORTANT: After first boot, BOOTLOADER CANNOT BE RE-FLASHED on same device"
|
@echo "* IMPORTANT: After first boot, BOOTLOADER CANNOT BE RE-FLASHED on same device"
|
||||||
|
|
||||||
|
@ -121,4 +121,61 @@ config ESPTOOLPY_FLASHSIZE
|
|||||||
default "8MB" if ESPTOOLPY_FLASHSIZE_8MB
|
default "8MB" if ESPTOOLPY_FLASHSIZE_8MB
|
||||||
default "16MB" if ESPTOOLPY_FLASHSIZE_16MB
|
default "16MB" if ESPTOOLPY_FLASHSIZE_16MB
|
||||||
|
|
||||||
|
config ESPTOOLPY_FLASHSIZE_DETECT
|
||||||
|
bool "Detect flash size when flashing bootloader"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
If this option is set, 'make flash' targets will automatically detect
|
||||||
|
the flash size and update the bootloader image when flashing.
|
||||||
|
|
||||||
|
choice ESPTOOLPY_BEFORE
|
||||||
|
prompt "Before flashing"
|
||||||
|
default ESPTOOLPY_BEFORE_RESET
|
||||||
|
help
|
||||||
|
Configure whether esptool.py should reset the ESP32 before flashing.
|
||||||
|
|
||||||
|
Automatic resetting depends on the RTS & DTR signals being
|
||||||
|
wired from the serial port to the ESP32. Most USB development
|
||||||
|
boards do this internally.
|
||||||
|
|
||||||
|
The "Reset with ESP32R0 Windows workaround" option works
|
||||||
|
around an automatic reset bug in hardware, when using Windows
|
||||||
|
with some development boards. This fix only works if you're
|
||||||
|
using a silicon revision 0 ESP32.
|
||||||
|
|
||||||
|
config ESPTOOLPY_BEFORE_RESET
|
||||||
|
bool "Reset to bootloader"
|
||||||
|
config ESPTOOLPY_BEFORE_NORESET
|
||||||
|
bool "No reset"
|
||||||
|
config ESPTOOLPY_BEFORE_ESP32R0
|
||||||
|
bool "Reset with ESP32R0 Windows workaround"
|
||||||
|
endchoice
|
||||||
|
|
||||||
|
config ESPTOOLPY_BEFORE
|
||||||
|
string
|
||||||
|
default "default_reset" if ESPTOOLPY_BEFORE_RESET
|
||||||
|
default "no_reset" if ESPTOOLPY_BEFORE_NORESET
|
||||||
|
default "esp32r0" if ESPTOOLPY_BEFORE_ESP32R0
|
||||||
|
|
||||||
|
choice ESPTOOLPY_AFTER
|
||||||
|
prompt "After flashing"
|
||||||
|
default ESPTOOLPY_AFTER_RESET
|
||||||
|
help
|
||||||
|
Configure whether esptool.py should reset the ESP32 after flashing.
|
||||||
|
|
||||||
|
Automatic resetting depends on the RTS & DTR signals being
|
||||||
|
wired from the serial port to the ESP32. Most USB development
|
||||||
|
boards do this internally.
|
||||||
|
|
||||||
|
config ESPTOOLPY_AFTER_RESET
|
||||||
|
bool "Reset after flashing"
|
||||||
|
config ESPTOOLPY_AFTER_NORESET
|
||||||
|
bool "Stay in bootloader"
|
||||||
|
endchoice
|
||||||
|
|
||||||
|
config ESPTOOLPY_AFTER
|
||||||
|
string
|
||||||
|
default "hard_reset" if ESPTOOLPY_AFTER_RESET
|
||||||
|
default "no_reset" if ESPTOOLPY_AFTER_NORESET
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
@ -13,7 +13,7 @@ PYTHON ?= $(call dequote,$(CONFIG_PYTHON))
|
|||||||
#
|
#
|
||||||
ESPTOOLPY_SRC := $(COMPONENT_PATH)/esptool/esptool.py
|
ESPTOOLPY_SRC := $(COMPONENT_PATH)/esptool/esptool.py
|
||||||
ESPTOOLPY := $(PYTHON) $(ESPTOOLPY_SRC) --chip esp32
|
ESPTOOLPY := $(PYTHON) $(ESPTOOLPY_SRC) --chip esp32
|
||||||
ESPTOOLPY_SERIAL := $(ESPTOOLPY) --port $(ESPPORT) --baud $(ESPBAUD)
|
ESPTOOLPY_SERIAL := $(ESPTOOLPY) --port $(ESPPORT) --baud $(ESPBAUD) --before $(CONFIG_ESPTOOLPY_BEFORE) --after $(CONFIG_ESPTOOLPY_AFTER)
|
||||||
|
|
||||||
# Supporting esptool command line tools
|
# Supporting esptool command line tools
|
||||||
ESPEFUSEPY := $(PYTHON) $(COMPONENT_PATH)/esptool/espefuse.py
|
ESPEFUSEPY := $(PYTHON) $(COMPONENT_PATH)/esptool/espefuse.py
|
||||||
@ -21,10 +21,15 @@ ESPSECUREPY := $(PYTHON) $(COMPONENT_PATH)/esptool/espsecure.py
|
|||||||
export ESPSECUREPY # is used in bootloader_support component
|
export ESPSECUREPY # is used in bootloader_support component
|
||||||
|
|
||||||
ESPTOOL_FLASH_OPTIONS := --flash_mode $(ESPFLASHMODE) --flash_freq $(ESPFLASHFREQ) --flash_size $(ESPFLASHSIZE)
|
ESPTOOL_FLASH_OPTIONS := --flash_mode $(ESPFLASHMODE) --flash_freq $(ESPFLASHFREQ) --flash_size $(ESPFLASHSIZE)
|
||||||
|
ifdef CONFIG_ESPTOOLPY_FLASHSIZE_DETECT
|
||||||
|
ESPTOOL_WRITE_FLASH_OPTIONS := --flash_mode $(ESPFLASHMODE) --flash_freq $(ESPFLASHFREQ) --flash_size detect
|
||||||
|
else
|
||||||
|
ESPTOOL_WRITE_FLASH_OPTIONS := $(ESPTOOL_FLASH_OPTIONS)
|
||||||
|
endif
|
||||||
|
|
||||||
ESPTOOL_ELF2IMAGE_OPTIONS :=
|
ESPTOOL_ELF2IMAGE_OPTIONS :=
|
||||||
|
|
||||||
ESPTOOLPY_WRITE_FLASH=$(ESPTOOLPY_SERIAL) write_flash $(if $(CONFIG_ESPTOOLPY_COMPRESSED),-z) $(ESPTOOL_FLASH_OPTIONS)
|
ESPTOOLPY_WRITE_FLASH=$(ESPTOOLPY_SERIAL) write_flash $(if $(CONFIG_ESPTOOLPY_COMPRESSED),-z) $(ESPTOOL_WRITE_FLASH_OPTIONS)
|
||||||
|
|
||||||
ESPTOOL_ALL_FLASH_ARGS += $(CONFIG_APP_OFFSET) $(APP_BIN)
|
ESPTOOL_ALL_FLASH_ARGS += $(CONFIG_APP_OFFSET) $(APP_BIN)
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit adc914b91ac6d2cfd1ace56307b4374eb9439e14
|
Subproject commit fe69994270e2a450aad3e94a409b58460b1a214f
|
Loading…
x
Reference in New Issue
Block a user