mirror of
https://github.com/espressif/esptool.git
synced 2025-10-19 20:13:00 +08:00
fix(write_flash): Fix --erase-all
option
Closes https://github.com/espressif/esptool/issues/805
This commit is contained in:

committed by
Radim Karniš

parent
4d501009c9
commit
d0af65f1cb
@@ -334,6 +334,8 @@ def write_flash(esp, args):
|
||||
image = LoadFirmwareImage(esp.CHIP_NAME, argfile)
|
||||
except (FatalError, struct.error, RuntimeError):
|
||||
continue
|
||||
finally:
|
||||
argfile.seek(0) # LoadFirmwareImage changes the file handle position
|
||||
if image.chip_id != esp.IMAGE_CHIP_ID:
|
||||
raise FatalError(
|
||||
f"{argfile.name} is not an {esp.CHIP_NAME} image. "
|
||||
|
@@ -513,6 +513,11 @@ class TestFlashing(EsptoolTestCase):
|
||||
assert "or higher (this chip is revision" in output
|
||||
assert "Use --force to flash anyway." in output
|
||||
|
||||
def test_erase_before_write(self):
|
||||
output = self.run_esptool("write_flash --erase-all 0x0 images/one_kb.bin")
|
||||
assert "Chip erase completed successfully" in output
|
||||
assert "Hash of data verified" in output
|
||||
|
||||
|
||||
class TestFlashSizes(EsptoolTestCase):
|
||||
def test_high_offset(self):
|
||||
|
Reference in New Issue
Block a user