esptool 5.0.dev1__tar.gz → 5.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {esptool-5.0.dev1 → esptool-5.0.2}/MANIFEST.in +1 -1
- {esptool-5.0.dev1/esptool.egg-info → esptool-5.0.2}/PKG-INFO +7 -7
- {esptool-5.0.dev1 → esptool-5.0.2}/README.md +4 -4
- {esptool-5.0.dev1 → esptool-5.0.2}/esp_rfc2217_server/__init__.py +2 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/esp_rfc2217_server/esp_port_manager.py +1 -1
- {esptool-5.0.dev1 → esptool-5.0.2}/esp_rfc2217_server.py +1 -1
- esptool-5.0.2/espefuse/__init__.py +233 -0
- esptool-5.0.2/espefuse/cli_util.py +246 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/base_fields.py +210 -132
- esptool-5.0.2/espefuse/efuse/base_operations.py +1193 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/csv_table_parser.py +3 -1
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/emulate_efuse_controller_base.py +2 -1
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/esp32/__init__.py +2 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/esp32/emulate_efuse_controller.py +5 -6
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/esp32/fields.py +14 -23
- esptool-5.0.2/espefuse/efuse/esp32/operations.py +327 -0
- {esptool-5.0.dev1/espefuse/efuse/esp32c3 → esptool-5.0.2/espefuse/efuse/esp32c2}/__init__.py +2 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/esp32c2/fields.py +24 -30
- esptool-5.0.2/espefuse/efuse/esp32c2/operations.py +292 -0
- {esptool-5.0.dev1/espefuse/efuse/esp32c2 → esptool-5.0.2/espefuse/efuse/esp32c3}/__init__.py +2 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/esp32c3/fields.py +28 -34
- esptool-5.0.2/espefuse/efuse/esp32c3/operations.py +310 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/esp32c5/__init__.py +2 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/esp32c5/fields.py +66 -37
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/esp32c5/mem_definition.py +20 -0
- esptool-5.0.2/espefuse/efuse/esp32c5/operations.py +317 -0
- esptool-5.0.2/espefuse/efuse/esp32c6/__init__.py +5 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/esp32c6/fields.py +25 -32
- esptool-5.0.2/espefuse/efuse/esp32c6/operations.py +315 -0
- esptool-5.0.2/espefuse/efuse/esp32c61/__init__.py +5 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/esp32c61/fields.py +26 -32
- esptool-5.0.2/espefuse/efuse/esp32c61/operations.py +316 -0
- esptool-5.0.2/espefuse/efuse/esp32h2/__init__.py +5 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/esp32h2/fields.py +22 -28
- esptool-5.0.2/espefuse/efuse/esp32h2/operations.py +334 -0
- esptool-5.0.2/espefuse/efuse/esp32h21/__init__.py +5 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/esp32h21/fields.py +22 -28
- esptool-5.0.2/espefuse/efuse/esp32h21/operations.py +313 -0
- esptool-5.0.2/espefuse/efuse/esp32h4/__init__.py +5 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/esp32h4/fields.py +22 -28
- esptool-5.0.2/espefuse/efuse/esp32h4/operations.py +305 -0
- esptool-5.0.2/espefuse/efuse/esp32p4/__init__.py +5 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/esp32p4/fields.py +39 -32
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/esp32p4/mem_definition.py +11 -0
- esptool-5.0.2/espefuse/efuse/esp32p4/operations.py +318 -0
- esptool-5.0.2/espefuse/efuse/esp32s2/__init__.py +5 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/esp32s2/fields.py +23 -29
- esptool-5.0.2/espefuse/efuse/esp32s2/operations.py +384 -0
- esptool-5.0.2/espefuse/efuse/esp32s3/__init__.py +5 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/esp32s3/fields.py +28 -33
- esptool-5.0.2/espefuse/efuse/esp32s3/operations.py +388 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/mem_definition_base.py +3 -2
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/util.py +1 -3
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse_defs/esp32p4.yaml +3 -3
- esptool-5.0.2/espefuse/efuse_interface.py +197 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espsecure/__init__.py +4 -2
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool/__init__.py +11 -13
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool/bin_image.py +120 -52
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool/cli_util.py +28 -8
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool/cmds.py +79 -66
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool/loader.py +199 -78
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool/logger.py +1 -1
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool/targets/esp32.py +2 -4
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool/targets/esp32p4.py +2 -1
- esptool-5.0.2/esptool/targets/stub_flasher/1/.DS_Store +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool/targets/stub_flasher/1/README.md +1 -1
- esptool-5.0.2/esptool/targets/stub_flasher/1/esp32.json +8 -0
- esptool-5.0.2/esptool/targets/stub_flasher/1/esp32c2.json +8 -0
- esptool-5.0.2/esptool/targets/stub_flasher/1/esp32c3.json +8 -0
- esptool-5.0.2/esptool/targets/stub_flasher/1/esp32c5.json +8 -0
- esptool-5.0.2/esptool/targets/stub_flasher/1/esp32c6.json +8 -0
- esptool-5.0.2/esptool/targets/stub_flasher/1/esp32c61.json +8 -0
- esptool-5.0.2/esptool/targets/stub_flasher/1/esp32h2.json +8 -0
- esptool-5.0.2/esptool/targets/stub_flasher/1/esp32p4.json +8 -0
- esptool-5.0.2/esptool/targets/stub_flasher/1/esp32s2.json +8 -0
- esptool-5.0.2/esptool/targets/stub_flasher/1/esp32s3.json +8 -0
- esptool-5.0.2/esptool/test.py +21 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool/util.py +13 -0
- {esptool-5.0.dev1 → esptool-5.0.2/esptool.egg-info}/PKG-INFO +7 -7
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool.egg-info/SOURCES.txt +5 -0
- esptool-5.0.2/esptool.egg-info/entry_points.txt +5 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool.egg-info/requires.txt +2 -2
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool.egg-info/top_level.txt +2 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/pyproject.toml +4 -15
- esptool-5.0.2/setup.py +34 -0
- esptool-5.0.dev1/espefuse/__init__.py +0 -364
- esptool-5.0.dev1/espefuse/efuse/base_operations.py +0 -807
- esptool-5.0.dev1/espefuse/efuse/esp32/operations.py +0 -373
- esptool-5.0.dev1/espefuse/efuse/esp32c2/operations.py +0 -353
- esptool-5.0.dev1/espefuse/efuse/esp32c3/operations.py +0 -403
- esptool-5.0.dev1/espefuse/efuse/esp32c5/operations.py +0 -467
- esptool-5.0.dev1/espefuse/efuse/esp32c6/__init__.py +0 -3
- esptool-5.0.dev1/espefuse/efuse/esp32c6/operations.py +0 -410
- esptool-5.0.dev1/espefuse/efuse/esp32c61/__init__.py +0 -3
- esptool-5.0.dev1/espefuse/efuse/esp32c61/operations.py +0 -467
- esptool-5.0.dev1/espefuse/efuse/esp32h2/__init__.py +0 -3
- esptool-5.0.dev1/espefuse/efuse/esp32h2/operations.py +0 -425
- esptool-5.0.dev1/espefuse/efuse/esp32h21/__init__.py +0 -3
- esptool-5.0.dev1/espefuse/efuse/esp32h21/operations.py +0 -407
- esptool-5.0.dev1/espefuse/efuse/esp32h4/__init__.py +0 -3
- esptool-5.0.dev1/espefuse/efuse/esp32h4/operations.py +0 -390
- esptool-5.0.dev1/espefuse/efuse/esp32p4/__init__.py +0 -3
- esptool-5.0.dev1/espefuse/efuse/esp32p4/operations.py +0 -467
- esptool-5.0.dev1/espefuse/efuse/esp32s2/__init__.py +0 -3
- esptool-5.0.dev1/espefuse/efuse/esp32s2/operations.py +0 -524
- esptool-5.0.dev1/espefuse/efuse/esp32s3/__init__.py +0 -3
- esptool-5.0.dev1/espefuse/efuse/esp32s3/operations.py +0 -525
- esptool-5.0.dev1/esptool/targets/stub_flasher/1/esp32.json +0 -8
- esptool-5.0.dev1/esptool/targets/stub_flasher/1/esp32c2.json +0 -8
- esptool-5.0.dev1/esptool/targets/stub_flasher/1/esp32c3.json +0 -8
- esptool-5.0.dev1/esptool/targets/stub_flasher/1/esp32c5.json +0 -8
- esptool-5.0.dev1/esptool/targets/stub_flasher/1/esp32c6.json +0 -8
- esptool-5.0.dev1/esptool/targets/stub_flasher/1/esp32c61.json +0 -8
- esptool-5.0.dev1/esptool/targets/stub_flasher/1/esp32h2.json +0 -8
- esptool-5.0.dev1/esptool/targets/stub_flasher/1/esp32p4.json +0 -8
- esptool-5.0.dev1/esptool/targets/stub_flasher/1/esp32s2.json +0 -8
- esptool-5.0.dev1/esptool/targets/stub_flasher/1/esp32s3.json +0 -8
- esptool-5.0.dev1/setup.py +0 -21
- {esptool-5.0.dev1 → esptool-5.0.2}/LICENSE +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/esp_rfc2217_server/__main__.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/esp_rfc2217_server/redirector.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/__main__.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/__init__.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/esp32/mem_definition.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/esp32c2/emulate_efuse_controller.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/esp32c2/mem_definition.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/esp32c3/emulate_efuse_controller.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/esp32c3/mem_definition.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/esp32c5/emulate_efuse_controller.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/esp32c6/emulate_efuse_controller.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/esp32c6/mem_definition.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/esp32c61/emulate_efuse_controller.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/esp32c61/mem_definition.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/esp32h2/emulate_efuse_controller.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/esp32h2/mem_definition.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/esp32h21/emulate_efuse_controller.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/esp32h21/mem_definition.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/esp32h4/emulate_efuse_controller.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/esp32h4/mem_definition.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/esp32p4/emulate_efuse_controller.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/esp32s2/emulate_efuse_controller.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/esp32s2/mem_definition.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/esp32s3/emulate_efuse_controller.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse/esp32s3/mem_definition.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse_defs/esp32.yaml +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse_defs/esp32c2.yaml +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse_defs/esp32c3.yaml +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse_defs/esp32c5.yaml +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse_defs/esp32c6.yaml +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse_defs/esp32c61.yaml +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse_defs/esp32h2.yaml +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse_defs/esp32h21.yaml +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse_defs/esp32h2_v0.0_v1.1.yaml +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse_defs/esp32h4.yaml +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse_defs/esp32s2.yaml +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse/efuse_defs/esp32s3.yaml +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espefuse.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espsecure/__main__.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espsecure/esp_hsm_sign/__init__.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espsecure/esp_hsm_sign/exceptions.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/espsecure.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool/__main__.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool/config.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool/reset.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool/targets/__init__.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool/targets/esp32c2.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool/targets/esp32c3.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool/targets/esp32c5.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool/targets/esp32c6.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool/targets/esp32c61.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool/targets/esp32h2.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool/targets/esp32h21.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool/targets/esp32h4.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool/targets/esp32s2.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool/targets/esp32s3.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool/targets/esp8266.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool/targets/stub_flasher/1/esp8266.json +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool/targets/stub_flasher/2/LICENSE-APACHE +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool/targets/stub_flasher/2/LICENSE-MIT +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool/targets/stub_flasher/2/README.md +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool/targets/stub_flasher/2/esp32.json +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool/targets/stub_flasher/2/esp32c2.json +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool/targets/stub_flasher/2/esp32c3.json +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool/targets/stub_flasher/2/esp32c5.json +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool/targets/stub_flasher/2/esp32c6.json +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool/targets/stub_flasher/2/esp32c61.json +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool/targets/stub_flasher/2/esp32h2.json +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool/targets/stub_flasher/2/esp32p4.json +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool/targets/stub_flasher/2/esp32s2.json +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool/targets/stub_flasher/2/esp32s3.json +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool/targets/stub_flasher/2/esp8266.json +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool/uf2_writer.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool.egg-info/dependency_links.txt +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/esptool.py +0 -0
- {esptool-5.0.dev1 → esptool-5.0.2}/setup.cfg +0 -0
|
@@ -3,7 +3,7 @@ include LICENSE
|
|
|
3
3
|
include esptool/targets/stub_flasher/1/*
|
|
4
4
|
include esptool/targets/stub_flasher/2/*
|
|
5
5
|
include espefuse/efuse_defs/*.yaml
|
|
6
|
-
# sdist includes test/test*.py by default, but esptool
|
|
6
|
+
# sdist includes test/test*.py by default, but esptool tests
|
|
7
7
|
# are so far only intended to run from the git repo itself
|
|
8
8
|
prune test
|
|
9
9
|
prune .github
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: esptool
|
|
3
|
-
Version: 5.0.
|
|
3
|
+
Version: 5.0.2
|
|
4
4
|
Summary: A serial utility for flashing, provisioning, and interacting with Espressif SoCs.
|
|
5
5
|
Author: Fredrik Ahlberg (themadinventor), Angus Gratton (projectgus), Espressif Systems
|
|
6
6
|
License: GPLv2+
|
|
@@ -32,7 +32,7 @@ Requires-Dist: reedsolo<1.8,>=1.5.3
|
|
|
32
32
|
Requires-Dist: PyYAML>=5.1
|
|
33
33
|
Requires-Dist: intelhex
|
|
34
34
|
Requires-Dist: rich_click
|
|
35
|
-
Requires-Dist: click<
|
|
35
|
+
Requires-Dist: click<9
|
|
36
36
|
Provides-Extra: dev
|
|
37
37
|
Requires-Dist: pyelftools; extra == "dev"
|
|
38
38
|
Requires-Dist: coverage~=6.0; extra == "dev"
|
|
@@ -40,7 +40,7 @@ Requires-Dist: pre-commit; extra == "dev"
|
|
|
40
40
|
Requires-Dist: pytest; extra == "dev"
|
|
41
41
|
Requires-Dist: pytest-rerunfailures; extra == "dev"
|
|
42
42
|
Requires-Dist: requests; extra == "dev"
|
|
43
|
-
Requires-Dist:
|
|
43
|
+
Requires-Dist: czespressif; extra == "dev"
|
|
44
44
|
Provides-Extra: hsm
|
|
45
45
|
Requires-Dist: python-pkcs11; extra == "hsm"
|
|
46
46
|
Provides-Extra: docs
|
|
@@ -48,7 +48,7 @@ Requires-Dist: esp-docs~=1.10; extra == "docs"
|
|
|
48
48
|
Requires-Dist: sphinx-tabs; extra == "docs"
|
|
49
49
|
Dynamic: license-file
|
|
50
50
|
|
|
51
|
-
# esptool
|
|
51
|
+
# esptool
|
|
52
52
|
|
|
53
53
|
A Python-based, open-source, platform-independent serial utility for flashing, provisioning, and interacting with Espressif SoCs.
|
|
54
54
|
|
|
@@ -56,15 +56,15 @@ A Python-based, open-source, platform-independent serial utility for flashing, p
|
|
|
56
56
|
|
|
57
57
|
## Documentation
|
|
58
58
|
|
|
59
|
-
Visit the [documentation](https://docs.espressif.com/projects/esptool/) or run `esptool
|
|
59
|
+
Visit the [documentation](https://docs.espressif.com/projects/esptool/) or run `esptool -h`.
|
|
60
60
|
|
|
61
61
|
## Contribute
|
|
62
62
|
|
|
63
|
-
If you're interested in contributing to esptool
|
|
63
|
+
If you're interested in contributing to esptool, please check the [contributions guide](https://docs.espressif.com/projects/esptool/en/latest/contributing.html).
|
|
64
64
|
|
|
65
65
|
## About
|
|
66
66
|
|
|
67
|
-
esptool
|
|
67
|
+
esptool was initially created by Fredrik Ahlberg (@[themadinventor](https://github.com/themadinventor/)), and later maintained by Angus Gratton (@[projectgus](https://github.com/projectgus/)). It is now supported by Espressif Systems. It has also received improvements from many members of the community.
|
|
68
68
|
|
|
69
69
|
## License
|
|
70
70
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# esptool
|
|
1
|
+
# esptool
|
|
2
2
|
|
|
3
3
|
A Python-based, open-source, platform-independent serial utility for flashing, provisioning, and interacting with Espressif SoCs.
|
|
4
4
|
|
|
@@ -6,15 +6,15 @@ A Python-based, open-source, platform-independent serial utility for flashing, p
|
|
|
6
6
|
|
|
7
7
|
## Documentation
|
|
8
8
|
|
|
9
|
-
Visit the [documentation](https://docs.espressif.com/projects/esptool/) or run `esptool
|
|
9
|
+
Visit the [documentation](https://docs.espressif.com/projects/esptool/) or run `esptool -h`.
|
|
10
10
|
|
|
11
11
|
## Contribute
|
|
12
12
|
|
|
13
|
-
If you're interested in contributing to esptool
|
|
13
|
+
If you're interested in contributing to esptool, please check the [contributions guide](https://docs.espressif.com/projects/esptool/en/latest/contributing.html).
|
|
14
14
|
|
|
15
15
|
## About
|
|
16
16
|
|
|
17
|
-
esptool
|
|
17
|
+
esptool was initially created by Fredrik Ahlberg (@[themadinventor](https://github.com/themadinventor/)), and later maintained by Angus Gratton (@[projectgus](https://github.com/projectgus/)). It is now supported by Espressif Systems. It has also received improvements from many members of the community.
|
|
18
18
|
|
|
19
19
|
## License
|
|
20
20
|
|
|
@@ -18,9 +18,11 @@ import sys
|
|
|
18
18
|
import serial
|
|
19
19
|
|
|
20
20
|
from esp_rfc2217_server.redirector import Redirector
|
|
21
|
+
from esptool.util import check_deprecated_py_suffix
|
|
21
22
|
|
|
22
23
|
|
|
23
24
|
def main():
|
|
25
|
+
check_deprecated_py_suffix("esp_rfc2217_server")
|
|
24
26
|
import argparse
|
|
25
27
|
|
|
26
28
|
parser = argparse.ArgumentParser(
|
|
@@ -82,7 +82,7 @@ class EspPortManager(serial.rfc2217.PortManager):
|
|
|
82
82
|
|
|
83
83
|
def _reset_thread(self):
|
|
84
84
|
"""
|
|
85
|
-
The reset logic is used from esptool
|
|
85
|
+
The reset logic is used from esptool because the RTS and DTR signals
|
|
86
86
|
cannot be retransmitted through RFC 2217 with proper timing.
|
|
87
87
|
"""
|
|
88
88
|
if self.logger:
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
# Esptool can connect to the ESP device through that server as it is
|
|
27
27
|
# demonstrated in the following example:
|
|
28
28
|
#
|
|
29
|
-
# esptool
|
|
29
|
+
# esptool --port rfc2217://localhost:4000?ign_set_control flash-id
|
|
30
30
|
#
|
|
31
31
|
|
|
32
32
|
import contextlib
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2016-2025 Espressif Systems (Shanghai) CO LTD
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
4
|
+
|
|
5
|
+
import sys
|
|
6
|
+
|
|
7
|
+
import rich_click as click
|
|
8
|
+
|
|
9
|
+
import esptool
|
|
10
|
+
from esptool.cli_util import ChipType, ResetModeType
|
|
11
|
+
from esptool.logger import log
|
|
12
|
+
|
|
13
|
+
from espefuse.cli_util import Group
|
|
14
|
+
from espefuse.efuse.base_operations import BaseCommands
|
|
15
|
+
from espefuse.efuse_interface import (
|
|
16
|
+
DEPRECATED_COMMANDS,
|
|
17
|
+
get_esp,
|
|
18
|
+
init_commands,
|
|
19
|
+
SUPPORTED_COMMANDS,
|
|
20
|
+
SUPPORTED_BURN_COMMANDS,
|
|
21
|
+
SUPPORTED_READ_COMMANDS,
|
|
22
|
+
SUPPORTED_CHIPS,
|
|
23
|
+
)
|
|
24
|
+
from esptool.util import check_deprecated_py_suffix
|
|
25
|
+
|
|
26
|
+
__all__ = [
|
|
27
|
+
"get_esp",
|
|
28
|
+
"init_commands",
|
|
29
|
+
"BaseCommands",
|
|
30
|
+
"SUPPORTED_COMMANDS",
|
|
31
|
+
"SUPPORTED_CHIPS",
|
|
32
|
+
"SUPPORTED_BURN_COMMANDS",
|
|
33
|
+
"SUPPORTED_READ_COMMANDS",
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@click.group(
|
|
38
|
+
cls=Group,
|
|
39
|
+
chain=True, # allow using multiple commands in a single run
|
|
40
|
+
no_args_is_help=True,
|
|
41
|
+
context_settings=dict(help_option_names=["-h", "--help"], max_content_width=120),
|
|
42
|
+
help=f"espefuse v{esptool.__version__} - "
|
|
43
|
+
"Utility for eFuse configuration in Espressif SoCs.",
|
|
44
|
+
)
|
|
45
|
+
@click.option(
|
|
46
|
+
"--chip",
|
|
47
|
+
"-c",
|
|
48
|
+
type=ChipType(choices=["auto"] + list(SUPPORTED_CHIPS.keys())),
|
|
49
|
+
default="auto",
|
|
50
|
+
envvar="ESPTOOL_CHIP",
|
|
51
|
+
help="Target chip type.",
|
|
52
|
+
)
|
|
53
|
+
@click.option(
|
|
54
|
+
"--baud",
|
|
55
|
+
"-b",
|
|
56
|
+
type=int,
|
|
57
|
+
default=esptool.ESPLoader.ESP_ROM_BAUD,
|
|
58
|
+
envvar="ESPTOOL_BAUD",
|
|
59
|
+
help="Serial port baud rate used when flashing/reading.",
|
|
60
|
+
)
|
|
61
|
+
@click.option(
|
|
62
|
+
"--port",
|
|
63
|
+
"-p",
|
|
64
|
+
envvar="ESPTOOL_PORT",
|
|
65
|
+
type=click.Path(),
|
|
66
|
+
help="Serial port device.",
|
|
67
|
+
)
|
|
68
|
+
@click.option(
|
|
69
|
+
"--before",
|
|
70
|
+
type=ResetModeType(
|
|
71
|
+
choices=["default-reset", "usb-reset", "no-reset", "no-reset-no-sync"]
|
|
72
|
+
),
|
|
73
|
+
default="default-reset",
|
|
74
|
+
help="Which reset to perform before connecting to the chip.",
|
|
75
|
+
)
|
|
76
|
+
@click.option(
|
|
77
|
+
"--debug", "-d", is_flag=True, help="Show debugging information (loglevel=DEBUG)."
|
|
78
|
+
)
|
|
79
|
+
@click.option(
|
|
80
|
+
"--virt",
|
|
81
|
+
is_flag=True,
|
|
82
|
+
help="For host tests, work in virtual mode (no chip connection).",
|
|
83
|
+
)
|
|
84
|
+
@click.option(
|
|
85
|
+
"--path-efuse-file",
|
|
86
|
+
type=click.Path(),
|
|
87
|
+
help="For host tests, save eFuse memory to file.",
|
|
88
|
+
)
|
|
89
|
+
@click.option(
|
|
90
|
+
"--do-not-confirm",
|
|
91
|
+
is_flag=True,
|
|
92
|
+
help="Do not pause for confirmation before permanently writing eFuses. "
|
|
93
|
+
"Use with caution!",
|
|
94
|
+
)
|
|
95
|
+
@click.option(
|
|
96
|
+
"--postpone",
|
|
97
|
+
is_flag=True,
|
|
98
|
+
help="Postpone burning some eFuses from BLOCK0 at the end.",
|
|
99
|
+
)
|
|
100
|
+
@click.option(
|
|
101
|
+
"--extend-efuse-table",
|
|
102
|
+
type=click.File("r"),
|
|
103
|
+
help="CSV file from ESP-IDF (esp_efuse_custom_table.csv).",
|
|
104
|
+
)
|
|
105
|
+
@click.pass_context
|
|
106
|
+
def cli(
|
|
107
|
+
ctx,
|
|
108
|
+
chip,
|
|
109
|
+
baud,
|
|
110
|
+
port,
|
|
111
|
+
before,
|
|
112
|
+
debug,
|
|
113
|
+
virt,
|
|
114
|
+
path_efuse_file,
|
|
115
|
+
do_not_confirm,
|
|
116
|
+
postpone,
|
|
117
|
+
extend_efuse_table,
|
|
118
|
+
):
|
|
119
|
+
log.print(f"espefuse v{esptool.__version__}")
|
|
120
|
+
|
|
121
|
+
ctx.ensure_object(dict)
|
|
122
|
+
esp = ctx.obj.get("esp", None)
|
|
123
|
+
external_esp = esp is not None
|
|
124
|
+
is_help = ctx.obj.get("is_help", False)
|
|
125
|
+
used_cmds = ctx.obj.get("used_cmds", [])
|
|
126
|
+
|
|
127
|
+
if any(cmd.replace("_", "-") in DEPRECATED_COMMANDS for cmd in used_cmds):
|
|
128
|
+
return # do not connect to ESP if any command is deprecated
|
|
129
|
+
|
|
130
|
+
if not port and not external_esp and not is_help and not virt:
|
|
131
|
+
raise click.BadOptionUsage(
|
|
132
|
+
"--port", "Missing required argument. Please specify the --port option."
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
if not esp:
|
|
136
|
+
try:
|
|
137
|
+
esp = get_esp(
|
|
138
|
+
port, baud, before, chip, is_help, virt, debug, path_efuse_file
|
|
139
|
+
)
|
|
140
|
+
except esptool.FatalError as e:
|
|
141
|
+
raise esptool.FatalError(
|
|
142
|
+
f"{e}\nPlease make sure you specified the right port with --port."
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
def close_port():
|
|
146
|
+
if not external_esp and not virt and esp._port:
|
|
147
|
+
esp._port.close()
|
|
148
|
+
|
|
149
|
+
ctx.call_on_close(close_port)
|
|
150
|
+
|
|
151
|
+
# handle chip auto
|
|
152
|
+
if chip == "auto":
|
|
153
|
+
if ctx.obj.get("is_help", False):
|
|
154
|
+
log.note(
|
|
155
|
+
"Chip not specified, showing commands for ESP32 by default. "
|
|
156
|
+
"Specify the --chip option to get chip-specific help."
|
|
157
|
+
)
|
|
158
|
+
chip = esp.CHIP_NAME.lower()
|
|
159
|
+
|
|
160
|
+
commands = init_commands(
|
|
161
|
+
esp=esp,
|
|
162
|
+
skip_connect=is_help,
|
|
163
|
+
debug=debug,
|
|
164
|
+
do_not_confirm=do_not_confirm,
|
|
165
|
+
extend_efuse_table=extend_efuse_table,
|
|
166
|
+
)
|
|
167
|
+
commands.efuses.postpone = postpone
|
|
168
|
+
commands.add_cli_commands(cli)
|
|
169
|
+
|
|
170
|
+
multiple_burn_commands = (
|
|
171
|
+
sum(cmd.replace("_", "-") in SUPPORTED_BURN_COMMANDS for cmd in used_cmds) > 1
|
|
172
|
+
)
|
|
173
|
+
if multiple_burn_commands:
|
|
174
|
+
commands.use_batch_mode()
|
|
175
|
+
|
|
176
|
+
# Add the objects to the context
|
|
177
|
+
ctx.obj["debug"] = debug
|
|
178
|
+
ctx.obj["commands"] = commands
|
|
179
|
+
ctx.obj["efuses"] = commands.efuses
|
|
180
|
+
ctx.obj["do_not_confirm"] = do_not_confirm
|
|
181
|
+
|
|
182
|
+
@cli.result_callback()
|
|
183
|
+
def process_result(result, *args, **kwargs):
|
|
184
|
+
if multiple_burn_commands:
|
|
185
|
+
if not commands.burn_all(check_batch_mode=True):
|
|
186
|
+
raise esptool.FatalError("BURN was not done.")
|
|
187
|
+
log.print("Successful.")
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
@cli.command("execute-scripts", hidden=True)
|
|
191
|
+
@click.argument("scripts", nargs=-1, type=click.UNPROCESSED)
|
|
192
|
+
@click.option("--index", type=click.UNPROCESSED)
|
|
193
|
+
@click.option("--configfiles", type=click.UNPROCESSED)
|
|
194
|
+
def execute_scripts_cli(scripts, index, configfiles):
|
|
195
|
+
"""REMOVED: See Migration guide in documentation for details."""
|
|
196
|
+
log.error(
|
|
197
|
+
"REMOVED: `execute_scripts` was replaced with the public API in v5. "
|
|
198
|
+
"Please see Migration Guide in documentation for details: "
|
|
199
|
+
"https://docs.espressif.com/projects/esptool/en/latest/migration-guide.html#espefuse-py-v5-migration-guide"
|
|
200
|
+
)
|
|
201
|
+
sys.exit(2)
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
def main(argv: list[str] | None = None, esp: esptool.ESPLoader | None = None):
|
|
205
|
+
"""
|
|
206
|
+
Main function for espefuse
|
|
207
|
+
|
|
208
|
+
argv - Optional override for default arguments parsing
|
|
209
|
+
(that uses sys.argv), can be a list of custom arguments as strings.
|
|
210
|
+
Arguments and their values need to be added as individual items to the list
|
|
211
|
+
e.g. "--port /dev/ttyUSB1" thus becomes ['--port', '/dev/ttyUSB1'].
|
|
212
|
+
|
|
213
|
+
esp - Optional override of the connected device previously
|
|
214
|
+
returned by esptool.get_default_connected_device()
|
|
215
|
+
"""
|
|
216
|
+
args = esptool.expand_file_arguments(argv or sys.argv[1:])
|
|
217
|
+
cli(args=args, esp=esp)
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
def _main():
|
|
221
|
+
check_deprecated_py_suffix(__name__)
|
|
222
|
+
try:
|
|
223
|
+
main()
|
|
224
|
+
except esptool.FatalError as e:
|
|
225
|
+
log.error(f"\nA fatal error occurred: {e}")
|
|
226
|
+
sys.exit(2)
|
|
227
|
+
except KeyboardInterrupt:
|
|
228
|
+
log.error("KeyboardInterrupt: Run cancelled by user.")
|
|
229
|
+
sys.exit(2)
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
if __name__ == "__main__":
|
|
233
|
+
_main()
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
import rich_click as click
|
|
8
|
+
from click.parser import OptionParser, ParsingState, _unpack_args
|
|
9
|
+
from esptool.cli_util import Group as EsptoolGroup
|
|
10
|
+
from esptool.logger import log
|
|
11
|
+
|
|
12
|
+
from espefuse.efuse_interface import (
|
|
13
|
+
DEPRECATED_COMMANDS,
|
|
14
|
+
init_commands,
|
|
15
|
+
SUPPORTED_BURN_COMMANDS,
|
|
16
|
+
SUPPORTED_READ_COMMANDS,
|
|
17
|
+
SUPPORTED_COMMANDS,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
click.rich_click.USE_CLICK_SHORT_HELP = True
|
|
22
|
+
click.rich_click.COMMAND_GROUPS = {
|
|
23
|
+
"*": [
|
|
24
|
+
{
|
|
25
|
+
"name": "Burn commands",
|
|
26
|
+
"commands": SUPPORTED_BURN_COMMANDS,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"name": "Read commands",
|
|
30
|
+
"commands": SUPPORTED_READ_COMMANDS,
|
|
31
|
+
},
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class ChainParser(OptionParser):
|
|
37
|
+
"""
|
|
38
|
+
This is a modified version of the OptionParser class from click.parser.
|
|
39
|
+
It allows for the processing of arguments and options in interspersed order
|
|
40
|
+
together with chaining commands.
|
|
41
|
+
"""
|
|
42
|
+
|
|
43
|
+
def _process_args_for_options(self, state: ParsingState) -> None:
|
|
44
|
+
while state.rargs:
|
|
45
|
+
arg = state.rargs.pop(0)
|
|
46
|
+
arglen = len(arg)
|
|
47
|
+
# Double dashes always handled explicitly regardless of what
|
|
48
|
+
# prefixes are valid.
|
|
49
|
+
if arg == "--":
|
|
50
|
+
return
|
|
51
|
+
# if the argument is a command, stop parsing options
|
|
52
|
+
elif arg.replace("_", "-") in SUPPORTED_COMMANDS:
|
|
53
|
+
state.largs.append(arg)
|
|
54
|
+
return
|
|
55
|
+
elif arg[:1] in self._opt_prefixes and arglen > 1:
|
|
56
|
+
self._process_opts(arg, state)
|
|
57
|
+
elif self.allow_interspersed_args:
|
|
58
|
+
state.largs.append(arg)
|
|
59
|
+
else:
|
|
60
|
+
state.rargs.insert(0, arg)
|
|
61
|
+
return
|
|
62
|
+
|
|
63
|
+
def _process_args_for_args(self, state: ParsingState) -> None:
|
|
64
|
+
pargs, args = _unpack_args(
|
|
65
|
+
state.largs + state.rargs, [x.nargs for x in self._args]
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
# This check is required because of the way we modify nargs in ChainingCommand
|
|
69
|
+
if len(pargs) > 0:
|
|
70
|
+
for idx, arg in enumerate(self._args):
|
|
71
|
+
arg.process(pargs[idx], state)
|
|
72
|
+
|
|
73
|
+
state.largs = args
|
|
74
|
+
state.rargs = []
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class EfuseContext(click.RichContext):
|
|
78
|
+
@property
|
|
79
|
+
def show_sensitive_info(self) -> bool:
|
|
80
|
+
self.ensure_object(dict)
|
|
81
|
+
value: bool = self.obj.get("show_sensitive_info", False)
|
|
82
|
+
if not value:
|
|
83
|
+
log.print("Sensitive data will be hidden (see --show-sensitive-info)")
|
|
84
|
+
return value
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
class ChainingCommand(click.RichCommand, click.Command):
|
|
88
|
+
context_class = EfuseContext
|
|
89
|
+
|
|
90
|
+
def __init__(self, *args, **kwargs):
|
|
91
|
+
super().__init__(*args, **kwargs)
|
|
92
|
+
|
|
93
|
+
def _is_option(self, arg: str) -> bool:
|
|
94
|
+
return arg.startswith("--") or arg.startswith("-")
|
|
95
|
+
|
|
96
|
+
def invoke(self, ctx: click.Context) -> Any:
|
|
97
|
+
log.print(f'\n=== Run "{self.name}" command ===')
|
|
98
|
+
return super().invoke(ctx)
|
|
99
|
+
|
|
100
|
+
def parse_args(self, ctx: click.Context, args: list[str]):
|
|
101
|
+
# This is a hack to set nargs of the last argument to the number of arguments
|
|
102
|
+
# that will be processed separately
|
|
103
|
+
param_changed = None
|
|
104
|
+
for idx, arg in enumerate(args):
|
|
105
|
+
# command found in args or option found after argument
|
|
106
|
+
if arg.replace("_", "-") in SUPPORTED_COMMANDS or (
|
|
107
|
+
self._is_option(arg) and idx > 0
|
|
108
|
+
):
|
|
109
|
+
arguments_count = sum(
|
|
110
|
+
isinstance(param, click.Argument) for param in self.params
|
|
111
|
+
)
|
|
112
|
+
for param in self.params:
|
|
113
|
+
if param.nargs != -1:
|
|
114
|
+
continue
|
|
115
|
+
# set nargs of parameter to actual count of arguments and deduct
|
|
116
|
+
# arguments_count as each argument will be processed separately,
|
|
117
|
+
# we only care about the last one with nargs=-1
|
|
118
|
+
# at the end we add 1 to account for the processedargument itself
|
|
119
|
+
# e.g. if we have burn-bit BLOCK2 1 2 3, we want to set nargs to 3,
|
|
120
|
+
# so we need to account for BLOCK2 being processed separately
|
|
121
|
+
param.nargs = args.index(arg) - arguments_count + 1
|
|
122
|
+
param_changed = param
|
|
123
|
+
if (
|
|
124
|
+
param.nargs == 0
|
|
125
|
+
and param.required
|
|
126
|
+
and not ctx.resilient_parsing
|
|
127
|
+
):
|
|
128
|
+
raise click.UsageError(
|
|
129
|
+
f"Command `{self.name}` requires the `{param.name}` "
|
|
130
|
+
"argument."
|
|
131
|
+
)
|
|
132
|
+
break
|
|
133
|
+
break
|
|
134
|
+
ret = super().parse_args(ctx, args)
|
|
135
|
+
# restore nargs of the last argument to -1, in case it is going to be used again
|
|
136
|
+
if param_changed is not None:
|
|
137
|
+
param.nargs = -1
|
|
138
|
+
return ret
|
|
139
|
+
|
|
140
|
+
def make_parser(self, ctx: click.Context) -> OptionParser:
|
|
141
|
+
"""Creates the underlying option parser for this command."""
|
|
142
|
+
parser = ChainParser(ctx)
|
|
143
|
+
parser.allow_interspersed_args = True
|
|
144
|
+
for param in self.get_params(ctx):
|
|
145
|
+
param.add_to_parser(parser, ctx)
|
|
146
|
+
return parser
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
class Group(EsptoolGroup):
|
|
150
|
+
DEPRECATED_OPTIONS = {
|
|
151
|
+
"--file_name": "--file-name",
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
command_class = ChainingCommand
|
|
155
|
+
context_class = EfuseContext
|
|
156
|
+
|
|
157
|
+
@staticmethod
|
|
158
|
+
def _split_to_groups(args: list[str]) -> tuple[list[list[str]], list[str]]:
|
|
159
|
+
"""
|
|
160
|
+
This function splits the args list into groups,
|
|
161
|
+
where each item is a cmd with all its args.
|
|
162
|
+
|
|
163
|
+
Example:
|
|
164
|
+
all_args:
|
|
165
|
+
['burn-key-digest', 'secure_images/ecdsa256_secure_boot_signing_key_v2.pem',
|
|
166
|
+
'burn-key', 'BLOCK_KEY0', 'images/efuse/128bit_key',
|
|
167
|
+
'XTS_AES_128_KEY_DERIVED_FROM_128_EFUSE_BITS']
|
|
168
|
+
|
|
169
|
+
used_cmds: ['burn-key-digest', 'burn-key']
|
|
170
|
+
groups:
|
|
171
|
+
[['burn-key-digest', 'secure_images/ecdsa256_secure_boot_signing_key_v2.pem'],
|
|
172
|
+
['burn-key', 'BLOCK_KEY0', 'images/efuse/128bit_key',
|
|
173
|
+
'XTS_AES_128_KEY_DERIVED_FROM_128_EFUSE_BITS']]
|
|
174
|
+
"""
|
|
175
|
+
groups: list[list[str]] = []
|
|
176
|
+
args_group: list[str] = []
|
|
177
|
+
used_cmds: list[str] = []
|
|
178
|
+
for arg in args:
|
|
179
|
+
if arg.replace("_", "-") in SUPPORTED_COMMANDS:
|
|
180
|
+
groups.append(args_group)
|
|
181
|
+
used_cmds.append(arg)
|
|
182
|
+
args_group = [arg]
|
|
183
|
+
else:
|
|
184
|
+
args_group.append(arg)
|
|
185
|
+
groups.append(args_group)
|
|
186
|
+
return groups, used_cmds
|
|
187
|
+
|
|
188
|
+
@staticmethod
|
|
189
|
+
def repeat_read_commands(
|
|
190
|
+
used_cmds: list[str], groups: list[list[str]]
|
|
191
|
+
) -> list[list[str]]:
|
|
192
|
+
if (
|
|
193
|
+
sum(cmd in SUPPORTED_BURN_COMMANDS for cmd in used_cmds) > 0
|
|
194
|
+
and sum(cmd in SUPPORTED_READ_COMMANDS for cmd in used_cmds) > 0
|
|
195
|
+
):
|
|
196
|
+
# append all read commands at the end of group
|
|
197
|
+
read_commands = []
|
|
198
|
+
for group in groups:
|
|
199
|
+
if group[0] in SUPPORTED_READ_COMMANDS:
|
|
200
|
+
read_commands.append(group)
|
|
201
|
+
groups.extend(read_commands)
|
|
202
|
+
return groups
|
|
203
|
+
|
|
204
|
+
def parse_args(self, ctx: click.Context, args: list[str]):
|
|
205
|
+
ctx.ensure_object(dict)
|
|
206
|
+
ctx.obj["is_help"] = any(help_arg in args for help_arg in ctx.help_option_names)
|
|
207
|
+
idx = (
|
|
208
|
+
args.index("--chip")
|
|
209
|
+
if "--chip" in args
|
|
210
|
+
else (args.index("-c") if "-c" in args else -1)
|
|
211
|
+
)
|
|
212
|
+
ctx.obj["chip"] = args[idx + 1] if idx != -1 and idx + 1 < len(args) else "auto"
|
|
213
|
+
# override the default behavior of EsptoolGroup, because we don't need
|
|
214
|
+
# support for parameters with nargs=-1
|
|
215
|
+
args = self._replace_deprecated_args(args)
|
|
216
|
+
cmd_groups, used_cmds = self._split_to_groups(args)
|
|
217
|
+
|
|
218
|
+
# Add commands for shell completion
|
|
219
|
+
if ctx.resilient_parsing:
|
|
220
|
+
commands = init_commands(port=None, chip=ctx.obj["chip"], skip_connect=True)
|
|
221
|
+
commands.add_cli_commands(self)
|
|
222
|
+
elif len(used_cmds) == 0:
|
|
223
|
+
self.get_help(ctx)
|
|
224
|
+
ctx.exit()
|
|
225
|
+
|
|
226
|
+
cmd_groups = self.repeat_read_commands(used_cmds, cmd_groups)
|
|
227
|
+
args = [arg for group in cmd_groups for arg in group]
|
|
228
|
+
|
|
229
|
+
ctx.obj["used_cmds"] = used_cmds
|
|
230
|
+
ctx.obj["args"] = args
|
|
231
|
+
return super(click.RichGroup, self).parse_args(ctx, args)
|
|
232
|
+
|
|
233
|
+
def get_help(self, ctx: click.Context) -> str:
|
|
234
|
+
# help was called without any commands, so we need to add the commands for the
|
|
235
|
+
# default chip
|
|
236
|
+
if not (set(self.list_commands(ctx)) - set(DEPRECATED_COMMANDS)):
|
|
237
|
+
chip = ctx.obj["chip"]
|
|
238
|
+
if chip == "auto":
|
|
239
|
+
log.note(
|
|
240
|
+
"Chip not specified, showing commands for ESP32 by default. "
|
|
241
|
+
"Specify the --chip option to get chip-specific help."
|
|
242
|
+
)
|
|
243
|
+
chip = "esp32"
|
|
244
|
+
commands = init_commands(port=None, chip=chip, skip_connect=True)
|
|
245
|
+
commands.add_cli_commands(self)
|
|
246
|
+
return super().get_help(ctx) # type: ignore
|