We have enabled Secure Download mode on our ESP32-S3. After, we tried to read our flash with the following parttool (esptool) command, but as you can see, this failed:
Code: Select all
$ parttool.py --port /dev/ttyACM0 --partition-table-offset 0x10000 --esptool-args="after=no_reset" --esptool-args="no-stub" read_partition --partition-name factory --output factory.bin
Running /home/elias/.espressif/python_env/idf5.0_py3.10_env/bin/python /home/elias/esp/esp-idf/components/esptool_py/esptool/esptool.py --no-stub --port /dev/ttyACM0 read_flash 65536 3072 /tmp/tmpb3i46_kk...
esptool.py v4.5.1
Serial port /dev/ttyACM0
Connecting...
Detecting chip type... ESP32-S3
Chip is ESP32-S3 in Secure Download Mode
Enabling default SPI flash mode...
Traceback (most recent call last):
File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/home/elias/.espressif/python_env/idf5.0_py3.10_env/lib/python3.10/site-packages/esptool/__main__.py", line 9, in <module>
esptool._main()
File "/home/elias/.espressif/python_env/idf5.0_py3.10_env/lib/python3.10/site-packages/esptool/__init__.py", line 1032, in _main
main()
File "/home/elias/.espressif/python_env/idf5.0_py3.10_env/lib/python3.10/site-packages/esptool/__init__.py", line 832, in main
operation_func(esp, args)
File "/home/elias/.espressif/python_env/idf5.0_py3.10_env/lib/python3.10/site-packages/esptool/cmds.py", line 1069, in read_flash
data = esp.read_flash(args.address, args.size, flash_progress)
File "/home/elias/.espressif/python_env/idf5.0_py3.10_env/lib/python3.10/site-packages/esptool/loader.py", line 1114, in read_flash
return self.read_flash_slow(offset, length, progress_fn) # ROM-only routine
File "/home/elias/.espressif/python_env/idf5.0_py3.10_env/lib/python3.10/site-packages/esptool/targets/esp32.py", line 330, in read_flash_slow
r = self.check_command(
File "/home/elias/.espressif/python_env/idf5.0_py3.10_env/lib/python3.10/site-packages/esptool/loader.py", line 435, in check_command
val, data = self.command(op, data, chk, timeout=timeout)
File "/home/elias/.espressif/python_env/idf5.0_py3.10_env/lib/python3.10/site-packages/esptool/loader.py", line 418, in command
raise UnsupportedCommandError(self, op)
esptool.util.UnsupportedCommandError: This command (0xe) is not supported in Secure Download Mode
An exception: ** Command '['/home/elias/.espressif/python_env/idf5.0_py3.10_env/bin/python', '/home/elias/esp/esp-idf/components/esptool_py/esptool/esptool.py', '--no-stub', '--port', '/dev/ttyACM0', 'read_flash', '65536', '3072', '/tmp
/tmpb3i46_kk']' returned non-zero exit status 1. ** occurred in _call_esptool.
Traceback (most recent call last):
File "/home/elias/esp/esp-idf/components/partition_table/parttool.py", line 358, in <module>
main()
File "/home/elias/esp/esp-idf/components/partition_table/parttool.py", line 327, in main
target = ParttoolTarget(**target_args)
File "/home/elias/esp/esp-idf/components/partition_table/parttool.py", line 103, in __init__
self._call_esptool(['read_flash', str(partition_table_offset), str(gen.MAX_PARTITION_LENGTH), temp_file.name])
File "/home/elias/esp/esp-idf/components/partition_table/parttool.py", line 130, in _call_esptool
raise e
File "/home/elias/esp/esp-idf/components/partition_table/parttool.py", line 127, in _call_esptool
subprocess.check_call(esptool_args, stdout=out, stderr=subprocess.STDOUT)
File "/usr/lib/python3.10/subprocess.py", line 369, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/home/elias/.espressif/python_env/idf5.0_py3.10_env/bin/python', '/home/elias/esp/esp-idf/components/esptool_py/esptool/esptool.py', '--no-stub', '--port', '/dev/ttyACM0', 'read_flash', '65536',
'3072', '/tmp/tmpb3i46_kk']' returned non-zero exit status 1.
and indeed, reading fails.esptool.util.UnsupportedCommandError: This command (0xe) is not supported in Secure Download Mode
But if we read the technical documentation (https://www.espressif.com/sites/default ... ection.8.2), it explicitly states:
So why doesn't this read work? Is this expected behavior?EFUSE_ENABLE_SECURITY_DOWNLOAD
If this eFuse is 1, Joint Download Boot mode only allows reading, writing, and erasing plaintext flash and
does not support any SRAM or register operations