mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-07 22:54:33 +02:00
idf_monitor: support to re-flash with the using port
This commit make idf_monitor overwrite the ESPPORT environment variable with the port it's using, and re-run make with the modified environment variable. In this way, the make invoked will inherit the idf_monitor's port. Closes https://github.com/espressif/esp-idf/issues/4591
This commit is contained in:
@@ -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)
|
||||||
|
Reference in New Issue
Block a user