fix: enable auto-detection of ESP32-S2 in secure download mode

This commit is contained in:
Jaroslav Burian
2025-06-30 02:53:55 +02:00
parent 6fc3e44279
commit c2f5d2164d

View File

@@ -165,11 +165,16 @@ def detect_chip(
ESPLoader.CHIP_DETECT_MAGIC_REG_ADDR
)
except UnsupportedCommandError:
raise FatalError(
"Unsupported Command Error received. "
"Probably this means Secure Download Mode is enabled, "
"autodetection will not work. Need to manually specify the chip."
# Only ESP32-S2 does not support chip id detection
# and supports secure download mode
inst = CHIP_DEFS["esp32s2"](
detect_port._port, baud, trace_enabled=trace_enabled
)
si = inst.get_security_info()
inst.secure_download_mode = si["parsed_flags"]["SECURE_DOWNLOAD_ENABLE"]
inst = check_if_stub(inst)
inst._post_connect()
return inst
except FatalError:
log.print(" Autodetection failed, trying again...")
detect_port.connect(