mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-04 13:14:32 +02:00
tool: Fix 'idf.py bootloader' error if Secure Boot is enabled
If Secure Boot is enabled, there's no bootloader flasher arguments in the project (to encourage careful manual flashing), so this command would fail with a KeyError.
This commit is contained in:
committed by
Supreet Deshpande
parent
7d57165922
commit
83ec35f185
@@ -462,8 +462,6 @@ def init_cli(verbose_output=None):
|
|||||||
# Otherwise, if we built any binaries print a message about
|
# Otherwise, if we built any binaries print a message about
|
||||||
# how to flash them
|
# how to flash them
|
||||||
def print_flashing_message(title, key):
|
def print_flashing_message(title, key):
|
||||||
print("\n%s build complete. To flash, run this command:" % title)
|
|
||||||
|
|
||||||
with open(os.path.join(args.build_dir, "flasher_args.json")) as f:
|
with open(os.path.join(args.build_dir, "flasher_args.json")) as f:
|
||||||
flasher_args = json.load(f)
|
flasher_args = json.load(f)
|
||||||
|
|
||||||
@@ -471,6 +469,10 @@ def init_cli(verbose_output=None):
|
|||||||
return _safe_relpath(os.path.join(args.build_dir, f))
|
return _safe_relpath(os.path.join(args.build_dir, f))
|
||||||
|
|
||||||
if key != "project": # flashing a single item
|
if key != "project": # flashing a single item
|
||||||
|
if key not in flasher_args:
|
||||||
|
# This is the case for 'idf.py bootloader' if Secure Boot is on, need to follow manual flashing steps
|
||||||
|
print("\n%s build complete." % title)
|
||||||
|
return
|
||||||
cmd = ""
|
cmd = ""
|
||||||
if (key == "bootloader"): # bootloader needs --flash-mode, etc to be passed in
|
if (key == "bootloader"): # bootloader needs --flash-mode, etc to be passed in
|
||||||
cmd = " ".join(flasher_args["write_flash_args"]) + " "
|
cmd = " ".join(flasher_args["write_flash_args"]) + " "
|
||||||
@@ -486,6 +488,8 @@ def init_cli(verbose_output=None):
|
|||||||
for o, f in flash_items:
|
for o, f in flash_items:
|
||||||
cmd += o + " " + flasher_path(f) + " "
|
cmd += o + " " + flasher_path(f) + " "
|
||||||
|
|
||||||
|
print("\n%s build complete. To flash, run this command:" % title)
|
||||||
|
|
||||||
print(
|
print(
|
||||||
"%s %s -p %s -b %s --before %s --after %s --chip %s %s write_flash %s" % (
|
"%s %s -p %s -b %s --before %s --after %s --chip %s %s write_flash %s" % (
|
||||||
PYTHON,
|
PYTHON,
|
||||||
|
Reference in New Issue
Block a user