mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'feat/monitor_remake_with_serial_arg' into 'master'
idf_monitor: support to re-flash with the using port Closes IDFGH-2479 and IDF-836 See merge request espressif/esp-idf!6373
This commit is contained in:
commit
2e14149bff
@ -15,7 +15,7 @@ PYTHON ?= $(call dequote,$(CONFIG_SDK_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) --before $(CONFIG_ESPTOOLPY_BEFORE) --after $(CONFIG_ESPTOOLPY_AFTER)
|
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
|
||||||
@ -89,7 +89,7 @@ endif
|
|||||||
ifdef CONFIG_SECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT
|
ifdef CONFIG_SECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT
|
||||||
encrypted-flash: all_binaries $(ESPTOOLPY_SRC) $(call prereq_if_explicit,erase_flash) partition_table_get_info | check_python_dependencies
|
encrypted-flash: all_binaries $(ESPTOOLPY_SRC) $(call prereq_if_explicit,erase_flash) partition_table_get_info | check_python_dependencies
|
||||||
$(eval MONITOR_OPTS += --encrypted)
|
$(eval MONITOR_OPTS += --encrypted)
|
||||||
@echo "Flashing binaries to serial port $(ESPPORT) (app at offset $(APP_OFFSET))..."
|
@echo "Flashing binaries to serial port '$(ESPPORT)' (app at offset $(APP_OFFSET))..."
|
||||||
ifdef CONFIG_SECURE_BOOT
|
ifdef CONFIG_SECURE_BOOT
|
||||||
@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
|
||||||
@ -101,20 +101,20 @@ encrypted-flash:
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
flash: all_binaries $(ESPTOOLPY_SRC) $(call prereq_if_explicit,erase_flash) partition_table_get_info | check_python_dependencies
|
flash: all_binaries $(ESPTOOLPY_SRC) $(call prereq_if_explicit,erase_flash) partition_table_get_info | check_python_dependencies
|
||||||
@echo "Flashing binaries to serial port $(ESPPORT) (app at offset $(APP_OFFSET))..."
|
@echo "Flashing binaries to serial port '$(ESPPORT)' (app at offset $(APP_OFFSET))..."
|
||||||
ifdef CONFIG_SECURE_BOOT
|
ifdef CONFIG_SECURE_BOOT
|
||||||
@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) $(call prereq_if_explicit,erase_flash) partition_table_get_info | check_python_dependencies
|
app-flash: $(APP_BIN) $(ESPTOOLPY_SRC) $(call prereq_if_explicit,erase_flash) partition_table_get_info | check_python_dependencies
|
||||||
@echo "Flashing app to serial port $(ESPPORT), offset $(APP_OFFSET)..."
|
@echo "Flashing app to serial port '$(ESPPORT)', offset $(APP_OFFSET)..."
|
||||||
$(ESPTOOLPY_WRITE_FLASH) $(APP_OFFSET) $(APP_BIN)
|
$(ESPTOOLPY_WRITE_FLASH) $(APP_OFFSET) $(APP_BIN)
|
||||||
|
|
||||||
ifdef CONFIG_SECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT
|
ifdef CONFIG_SECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT
|
||||||
encrypted-app-flash: $(APP_BIN) $(ESPTOOLPY_SRC) $(call prereq_if_explicit,erase_flash) partition_table_get_info | check_python_dependencies
|
encrypted-app-flash: $(APP_BIN) $(ESPTOOLPY_SRC) $(call prereq_if_explicit,erase_flash) partition_table_get_info | check_python_dependencies
|
||||||
$(eval MONITOR_OPTS += --encrypted)
|
$(eval MONITOR_OPTS += --encrypted)
|
||||||
@echo "Flashing encrypted app binary to serial port $(ESPPORT) (app at offset $(APP_OFFSET))..."
|
@echo "Flashing encrypted app binary to serial port '$(ESPPORT)' (app at offset $(APP_OFFSET))..."
|
||||||
$(ESPTOOLPY_WRITE_FLASH_ENCRYPT) $(APP_OFFSET) $(APP_BIN)
|
$(ESPTOOLPY_WRITE_FLASH_ENCRYPT) $(APP_OFFSET) $(APP_BIN)
|
||||||
else
|
else
|
||||||
encrypted-app-flash:
|
encrypted-app-flash:
|
||||||
@ -144,7 +144,7 @@ endif
|
|||||||
# miniterm.py on the console. The '$(PYTHON) -m serial.tools.miniterm'
|
# miniterm.py on the console. The '$(PYTHON) -m serial.tools.miniterm'
|
||||||
# is to allow for the $(PYTHON) variable overriding the python path.
|
# is to allow for the $(PYTHON) variable overriding the python path.
|
||||||
simple_monitor: $(call prereq_if_explicit,%flash) | check_python_dependencies
|
simple_monitor: $(call prereq_if_explicit,%flash) | check_python_dependencies
|
||||||
$(MONITOR_PYTHON) -m serial.tools.miniterm --rts 0 --dtr 0 --raw $(ESPPORT) $(MONITORBAUD)
|
$(MONITOR_PYTHON) -m serial.tools.miniterm --rts 0 --dtr 0 --raw '$(ESPPORT)' $(MONITORBAUD)
|
||||||
|
|
||||||
PRINT_FILTER ?=
|
PRINT_FILTER ?=
|
||||||
|
|
||||||
@ -154,7 +154,7 @@ ifneq ("$(MONITOR_CORE_DUMP_DECODE)","")
|
|||||||
MONITOR_CORE_DUMP_DECODE_ARG = --decode-coredumps $(MONITOR_CORE_DUMP_DECODE)
|
MONITOR_CORE_DUMP_DECODE_ARG = --decode-coredumps $(MONITOR_CORE_DUMP_DECODE)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
MONITOR_OPTS := --baud $(MONITORBAUD) --port $(ESPPORT) --toolchain-prefix $(CONFIG_SDK_TOOLPREFIX) --make "$(MAKE)" --print_filter "$(PRINT_FILTER)" $(MONITOR_CORE_DUMP_DECODE_ARG)
|
MONITOR_OPTS := --baud $(MONITORBAUD) --port '$(ESPPORT)' --toolchain-prefix $(CONFIG_SDK_TOOLPREFIX) --make "$(MAKE)" --print_filter "$(PRINT_FILTER)" $(MONITOR_CORE_DUMP_DECODE_ARG)
|
||||||
|
|
||||||
monitor: $(call prereq_if_explicit,%flash) | check_python_dependencies
|
monitor: $(call prereq_if_explicit,%flash) | check_python_dependencies
|
||||||
$(summary) MONITOR
|
$(summary) MONITOR
|
||||||
|
@ -649,7 +649,7 @@ class Monitor(object):
|
|||||||
else:
|
else:
|
||||||
popen_args = [self.make, target]
|
popen_args = [self.make, target]
|
||||||
yellow_print("Running %s..." % " ".join(popen_args))
|
yellow_print("Running %s..." % " ".join(popen_args))
|
||||||
p = subprocess.Popen(popen_args)
|
p = subprocess.Popen(popen_args, env=os.environ)
|
||||||
try:
|
try:
|
||||||
p.wait()
|
p.wait()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
@ -967,6 +967,13 @@ def main():
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
pass # not running a make jobserver
|
pass # not running a make jobserver
|
||||||
|
|
||||||
|
# Pass the actual used port to callee of idf_monitor (e.g. make) through `ESPPORT` environment
|
||||||
|
# variable
|
||||||
|
# To make sure the key as well as the value are str type, by the requirements of subprocess
|
||||||
|
espport_key = str("ESPPORT")
|
||||||
|
espport_val = str(args.port)
|
||||||
|
os.environ.update({espport_key: espport_val})
|
||||||
|
|
||||||
monitor = Monitor(serial_instance, args.elf_file.name, args.print_filter, args.make, args.encrypted,
|
monitor = Monitor(serial_instance, args.elf_file.name, args.print_filter, args.make, args.encrypted,
|
||||||
args.toolchain_prefix, args.eol,
|
args.toolchain_prefix, args.eol,
|
||||||
args.decode_coredumps)
|
args.decode_coredumps)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user