fix(write_flash): Detect more cases of unresponsive flash, fix failing flash_size check

This commit is contained in:
Radim Karniš
2025-05-21 11:06:39 +02:00
parent 9201ccd8ae
commit f83d5982ee
2 changed files with 4 additions and 2 deletions

View File

@@ -980,7 +980,7 @@ def main(argv=None, esp=None):
if not esp.secure_download_mode:
try:
flash_id = esp.flash_id()
if flash_id in (0xFFFFFF, 0x000000):
if flash_id in (0xFFFFFF, 0x000000, 0xFFFF3F):
print(
"WARNING: Failed to communicate with the flash chip, "
"read/write operations will fail. "

View File

@@ -501,7 +501,9 @@ def write_flash(esp, args):
)
# Verify file sizes fit in the set --flash_size, or real flash size if smaller
flash_end = min(set_flash_size, flash_end) if set_flash_size else flash_end
flash_end = (
min(set_flash_size, flash_end) if set_flash_size and flash_end else flash_end
)
if flash_end is not None:
for address, argfile in args.addr_filename:
argfile.seek(0, os.SEEK_END)