Merge firmware before flashing via OpenOCD

Arduino core v2.0.4 contains updated bootloader images that have innacurate default headers. This results in bootloops if firmware is flashed via OpenOCD (e.g. debugging or
uploading via debug tools). For this reason, before uploading or debugging we need to merge all binaries (firmware, bootloader, partitions, etc.) via esptoolpy so that
the image headers will be adjusted according to --flash-size and --flash-mode arguments.

Note that this behavior doesn't occur if uploading is done via esptoolpy, as esptoolpy  overrides the binary image headers before flashing.
This commit is contained in:
Valerii Koval
2022-07-30 21:09:01 +03:00
parent f2a5977c91
commit 006d64e8b2
2 changed files with 63 additions and 9 deletions
+14 -7
View File
@@ -261,16 +261,23 @@ class Espressif32Platform(PlatformBase):
if any(ignore_conds):
return
load_cmds = [
'monitor program_esp "{{{path}}}" {offset} verify'.format(
path=to_unix_path(item["path"]), offset=item["offset"]
)
for item in flash_images
]
merged_firmware = build_extra_data.get("merged_firmware", False)
load_cmds = []
if not merged_firmware:
load_cmds.extend([
'monitor program_esp "{{{path}}}" {offset} verify'.format(
path=to_unix_path(item["path"]), offset=item["offset"]
)
for item in flash_images
])
load_cmds.append(
'monitor program_esp "{%s.bin}" %s verify'
% (
to_unix_path(debug_config.build_data["prog_path"][:-4]),
to_unix_path(
debug_config.build_data["prog_path"][:-4]
+ ("_merged" if merged_firmware else "")
),
build_extra_data.get("application_offset", "0x10000"),
)
)