mirror of
https://github.com/espressif/esptool.git
synced 2025-10-17 16:01:18 +08:00
fix(esp32-c2): Enable flashing in secure download mode
Closes https://github.com/espressif/esptool/issues/895
This commit is contained in:

committed by
Radim Karniš

parent
9b95de8901
commit
e862e10e63
@@ -466,7 +466,7 @@ def write_flash(esp, args):
|
|||||||
flash_end = flash_size_bytes(
|
flash_end = flash_size_bytes(
|
||||||
detect_flash_size(esp) if args.flash_size == "keep" else args.flash_size
|
detect_flash_size(esp) if args.flash_size == "keep" else args.flash_size
|
||||||
)
|
)
|
||||||
if flash_end is not None: # Secure download mode
|
if flash_end is not None: # Not in secure download mode
|
||||||
for address, argfile in args.addr_filename:
|
for address, argfile in args.addr_filename:
|
||||||
argfile.seek(0, os.SEEK_END)
|
argfile.seek(0, os.SEEK_END)
|
||||||
if address + argfile.tell() > flash_end:
|
if address + argfile.tell() > flash_end:
|
||||||
|
@@ -110,7 +110,7 @@ class ESP32C2ROM(ESP32C3ROM):
|
|||||||
|
|
||||||
def _post_connect(self):
|
def _post_connect(self):
|
||||||
# ESP32C2 ECO0 is no longer supported by the flasher stub
|
# ESP32C2 ECO0 is no longer supported by the flasher stub
|
||||||
if self.get_chip_revision() == 0:
|
if not self.secure_download_mode and self.get_chip_revision() == 0:
|
||||||
self.stub_is_disabled = True
|
self.stub_is_disabled = True
|
||||||
self.IS_STUB = False
|
self.IS_STUB = False
|
||||||
|
|
||||||
|
@@ -34,6 +34,8 @@ def flash_size_bytes(size):
|
|||||||
"""Given a flash size of the type passed in args.flash_size
|
"""Given a flash size of the type passed in args.flash_size
|
||||||
(ie 512KB or 1MB) then return the size in bytes.
|
(ie 512KB or 1MB) then return the size in bytes.
|
||||||
"""
|
"""
|
||||||
|
if size is None:
|
||||||
|
return None
|
||||||
if "MB" in size:
|
if "MB" in size:
|
||||||
return int(size[: size.index("MB")]) * 1024 * 1024
|
return int(size[: size.index("MB")]) * 1024 * 1024
|
||||||
elif "KB" in size:
|
elif "KB" in size:
|
||||||
|
Reference in New Issue
Block a user