Update bootloader image headers before debugging or uploading via debug tools

This approach is less intrusive than merging the entire application into one binary
implemented in #006d64e8b268e479703a0aac7eed8bef1ebea587

In this implementation we safely copy the required bootloader binary to the
build directory, adjust the headers via esptoolpy and the "merge_bin" command
according to --flash-size and --flash-mode arguments.

Resolves #872
This commit is contained in:
Valerii Koval
2022-08-15 17:59:36 +03:00
parent bb2d073bf3
commit cdd0867de6
2 changed files with 49 additions and 61 deletions
+7 -14
View File
@@ -261,23 +261,16 @@ class Espressif32Platform(PlatformBase):
if any(ignore_conds):
return
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 = [
'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]
+ ("_merged" if merged_firmware else "")
),
to_unix_path(debug_config.build_data["prog_path"][:-4]),
build_extra_data.get("application_offset", "0x10000"),
)
)