esptool 4.7.dev2__tar.gz → 4.8.0__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-4.7.dev2 → esptool-4.8.0}/MANIFEST.in +2 -2
- esptool-4.8.0/PKG-INFO +53 -0
- esptool-4.8.0/esp_rfc2217_server/__init__.py +124 -0
- esptool-4.8.0/esp_rfc2217_server/__main__.py +9 -0
- esptool-4.8.0/esp_rfc2217_server/esp_port_manager.py +97 -0
- esptool-4.8.0/esp_rfc2217_server/redirector.py +89 -0
- esptool-4.8.0/esp_rfc2217_server.py +56 -0
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/__init__.py +71 -6
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/base_fields.py +129 -12
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/base_operations.py +123 -50
- esptool-4.8.0/espefuse/efuse/csv_table_parser.py +266 -0
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/esp32/emulate_efuse_controller.py +7 -8
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/esp32/fields.py +14 -3
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/esp32/mem_definition.py +2 -2
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/esp32c2/emulate_efuse_controller.py +4 -4
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/esp32c2/fields.py +21 -10
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/esp32c2/mem_definition.py +2 -2
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/esp32c2/operations.py +7 -12
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/esp32c3/emulate_efuse_controller.py +4 -4
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/esp32c3/fields.py +19 -7
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/esp32c3/mem_definition.py +2 -2
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/esp32c3/operations.py +11 -29
- esptool-4.8.0/espefuse/efuse/esp32c5/emulate_efuse_controller.py +92 -0
- esptool-4.8.0/espefuse/efuse/esp32c5/fields.py +464 -0
- esptool-4.8.0/espefuse/efuse/esp32c5/mem_definition.py +169 -0
- esptool-4.8.0/espefuse/efuse/esp32c5/operations.py +395 -0
- esptool-4.8.0/espefuse/efuse/esp32c5beta3/emulate_efuse_controller.py +92 -0
- esptool-4.8.0/espefuse/efuse/esp32c5beta3/fields.py +464 -0
- {esptool-4.7.dev2/espefuse/efuse/esp32p4 → esptool-4.8.0/espefuse/efuse/esp32c5beta3}/mem_definition.py +4 -4
- {esptool-4.7.dev2/espefuse/efuse/esp32p4 → esptool-4.8.0/espefuse/efuse/esp32c5beta3}/operations.py +8 -4
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/esp32c6/emulate_efuse_controller.py +4 -4
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/esp32c6/fields.py +19 -7
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/esp32c6/mem_definition.py +2 -2
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/esp32c6/operations.py +17 -19
- esptool-4.8.0/espefuse/efuse/esp32c61/emulate_efuse_controller.py +92 -0
- esptool-4.8.0/espefuse/efuse/esp32c61/fields.py +466 -0
- esptool-4.8.0/espefuse/efuse/esp32c61/mem_definition.py +159 -0
- esptool-4.8.0/espefuse/efuse/esp32c61/operations.py +462 -0
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/esp32h2/emulate_efuse_controller.py +4 -4
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/esp32h2/fields.py +20 -8
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/esp32h2/mem_definition.py +3 -3
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/esp32h2/operations.py +26 -30
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/esp32h2beta1/emulate_efuse_controller.py +4 -4
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/esp32h2beta1/fields.py +20 -8
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/esp32h2beta1/mem_definition.py +4 -3
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/esp32h2beta1/operations.py +17 -30
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/esp32p4/emulate_efuse_controller.py +4 -4
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/esp32p4/fields.py +20 -7
- esptool-4.8.0/espefuse/efuse/esp32p4/mem_definition.py +159 -0
- esptool-4.8.0/espefuse/efuse/esp32p4/operations.py +458 -0
- esptool-4.8.0/espefuse/efuse/esp32s2/__init__.py +3 -0
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/esp32s2/emulate_efuse_controller.py +4 -4
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/esp32s2/fields.py +19 -7
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/esp32s2/mem_definition.py +2 -2
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/esp32s2/operations.py +19 -30
- esptool-4.8.0/espefuse/efuse/esp32s3/__init__.py +3 -0
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/esp32s3/emulate_efuse_controller.py +4 -4
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/esp32s3/fields.py +41 -7
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/esp32s3/mem_definition.py +2 -2
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/esp32s3/operations.py +20 -30
- esptool-4.8.0/espefuse/efuse/esp32s3beta2/__init__.py +3 -0
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/esp32s3beta2/emulate_efuse_controller.py +4 -4
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/esp32s3beta2/fields.py +41 -7
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/esp32s3beta2/mem_definition.py +2 -2
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/esp32s3beta2/operations.py +20 -30
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/mem_definition_base.py +67 -6
- esptool-4.8.0/espefuse/efuse_defs/esp32c5.yaml +104 -0
- esptool-4.8.0/espefuse/efuse_defs/esp32c5beta3.yaml +104 -0
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse_defs/esp32c6.yaml +11 -5
- esptool-4.8.0/espefuse/efuse_defs/esp32c61.yaml +84 -0
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse_defs/esp32h2.yaml +31 -17
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse_defs/esp32p4.yaml +74 -59
- {esptool-4.7.dev2 → esptool-4.8.0}/espsecure/__init__.py +164 -74
- {esptool-4.7.dev2 → esptool-4.8.0}/esptool/__init__.py +284 -71
- {esptool-4.7.dev2 → esptool-4.8.0}/esptool/bin_image.py +168 -42
- {esptool-4.7.dev2 → esptool-4.8.0}/esptool/cmds.py +244 -109
- {esptool-4.7.dev2 → esptool-4.8.0}/esptool/config.py +1 -0
- {esptool-4.7.dev2 → esptool-4.8.0}/esptool/loader.py +134 -33
- {esptool-4.7.dev2 → esptool-4.8.0}/esptool/reset.py +41 -10
- {esptool-4.7.dev2 → esptool-4.8.0}/esptool/targets/__init__.py +6 -0
- {esptool-4.7.dev2 → esptool-4.8.0}/esptool/targets/esp32.py +109 -34
- {esptool-4.7.dev2 → esptool-4.8.0}/esptool/targets/esp32c2.py +19 -1
- {esptool-4.7.dev2 → esptool-4.8.0}/esptool/targets/esp32c3.py +36 -5
- esptool-4.8.0/esptool/targets/esp32c5.py +190 -0
- esptool-4.8.0/esptool/targets/esp32c5beta3.py +129 -0
- {esptool-4.7.dev2 → esptool-4.8.0}/esptool/targets/esp32c6.py +16 -5
- esptool-4.8.0/esptool/targets/esp32c61.py +144 -0
- {esptool-4.7.dev2 → esptool-4.8.0}/esptool/targets/esp32h2.py +28 -0
- {esptool-4.7.dev2 → esptool-4.8.0}/esptool/targets/esp32h2beta1.py +26 -4
- {esptool-4.7.dev2 → esptool-4.8.0}/esptool/targets/esp32p4.py +63 -21
- {esptool-4.7.dev2 → esptool-4.8.0}/esptool/targets/esp32s2.py +49 -13
- {esptool-4.7.dev2 → esptool-4.8.0}/esptool/targets/esp32s3.py +61 -13
- {esptool-4.7.dev2 → esptool-4.8.0}/esptool/targets/esp8266.py +11 -4
- esptool-4.8.0/esptool/targets/stub_flasher/1/README.md +3 -0
- esptool-4.8.0/esptool/targets/stub_flasher/1/esp32.json +8 -0
- esptool-4.7.dev2/esptool/targets/stub_flasher/stub_flasher_32c2.json → esptool-4.8.0/esptool/targets/stub_flasher/1/esp32c2.json +4 -3
- esptool-4.8.0/esptool/targets/stub_flasher/1/esp32c3.json +8 -0
- esptool-4.8.0/esptool/targets/stub_flasher/1/esp32c5.json +8 -0
- esptool-4.8.0/esptool/targets/stub_flasher/1/esp32c5beta3.json +8 -0
- esptool-4.8.0/esptool/targets/stub_flasher/1/esp32c6.json +8 -0
- esptool-4.8.0/esptool/targets/stub_flasher/1/esp32c61.json +8 -0
- esptool-4.7.dev2/esptool/targets/stub_flasher/stub_flasher_32c6beta.json → esptool-4.8.0/esptool/targets/stub_flasher/1/esp32c6beta.json +4 -3
- esptool-4.8.0/esptool/targets/stub_flasher/1/esp32h2.json +8 -0
- esptool-4.7.dev2/esptool/targets/stub_flasher/stub_flasher_32h2beta1.json → esptool-4.8.0/esptool/targets/stub_flasher/1/esp32h2beta1.json +4 -3
- esptool-4.7.dev2/esptool/targets/stub_flasher/stub_flasher_32h2beta2.json → esptool-4.8.0/esptool/targets/stub_flasher/1/esp32h2beta2.json +4 -3
- esptool-4.8.0/esptool/targets/stub_flasher/1/esp32p4.json +8 -0
- esptool-4.8.0/esptool/targets/stub_flasher/1/esp32s2.json +8 -0
- esptool-4.8.0/esptool/targets/stub_flasher/1/esp32s3.json +8 -0
- esptool-4.8.0/esptool/targets/stub_flasher/1/esp32s3beta2.json +8 -0
- esptool-4.7.dev2/esptool/targets/stub_flasher/stub_flasher_8266.json → esptool-4.8.0/esptool/targets/stub_flasher/1/esp8266.json +2 -1
- esptool-4.8.0/esptool/targets/stub_flasher/2/LICENSE-APACHE +201 -0
- esptool-4.8.0/esptool/targets/stub_flasher/2/LICENSE-MIT +25 -0
- esptool-4.8.0/esptool/targets/stub_flasher/2/README.md +3 -0
- esptool-4.8.0/esptool/targets/stub_flasher/2/esp32.json +1 -0
- esptool-4.8.0/esptool/targets/stub_flasher/2/esp32c2.json +1 -0
- esptool-4.8.0/esptool/targets/stub_flasher/2/esp32c3.json +1 -0
- esptool-4.8.0/esptool/targets/stub_flasher/2/esp32c6.json +1 -0
- esptool-4.8.0/esptool/targets/stub_flasher/2/esp32h2.json +1 -0
- esptool-4.8.0/esptool/targets/stub_flasher/2/esp32s2.json +1 -0
- esptool-4.8.0/esptool/targets/stub_flasher/2/esp32s3.json +1 -0
- {esptool-4.7.dev2 → esptool-4.8.0}/esptool/uf2_writer.py +0 -2
- {esptool-4.7.dev2 → esptool-4.8.0}/esptool/util.py +21 -1
- esptool-4.8.0/esptool.egg-info/PKG-INFO +53 -0
- {esptool-4.7.dev2 → esptool-4.8.0}/esptool.egg-info/SOURCES.txt +54 -13
- {esptool-4.7.dev2 → esptool-4.8.0}/esptool.egg-info/requires.txt +7 -6
- esptool-4.8.0/esptool.egg-info/top_level.txt +7 -0
- esptool-4.8.0/pyproject.toml +166 -0
- esptool-4.8.0/setup.cfg +4 -0
- esptool-4.8.0/setup.py +21 -0
- esptool-4.7.dev2/PKG-INFO +0 -45
- esptool-4.7.dev2/esp_rfc2217_server.py +0 -288
- esptool-4.7.dev2/esptool/targets/stub_flasher/stub_flasher_32.json +0 -7
- esptool-4.7.dev2/esptool/targets/stub_flasher/stub_flasher_32c3.json +0 -7
- esptool-4.7.dev2/esptool/targets/stub_flasher/stub_flasher_32c6.json +0 -7
- esptool-4.7.dev2/esptool/targets/stub_flasher/stub_flasher_32h2.json +0 -7
- esptool-4.7.dev2/esptool/targets/stub_flasher/stub_flasher_32s2.json +0 -7
- esptool-4.7.dev2/esptool/targets/stub_flasher/stub_flasher_32s3.json +0 -7
- esptool-4.7.dev2/esptool/targets/stub_flasher/stub_flasher_32s3beta2.json +0 -7
- esptool-4.7.dev2/esptool.egg-info/PKG-INFO +0 -45
- esptool-4.7.dev2/esptool.egg-info/top_level.txt +0 -3
- esptool-4.7.dev2/setup.cfg +0 -23
- esptool-4.7.dev2/setup.py +0 -138
- {esptool-4.7.dev2 → esptool-4.8.0}/LICENSE +0 -0
- {esptool-4.7.dev2 → esptool-4.8.0}/README.md +0 -0
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/__main__.py +0 -0
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/__init__.py +0 -0
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/emulate_efuse_controller_base.py +0 -0
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/esp32/__init__.py +0 -0
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/esp32/operations.py +0 -0
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/esp32c2/__init__.py +0 -0
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/esp32c3/__init__.py +0 -0
- {esptool-4.7.dev2/espefuse/efuse/esp32c6 → esptool-4.8.0/espefuse/efuse/esp32c5}/__init__.py +0 -0
- {esptool-4.7.dev2/espefuse/efuse/esp32h2 → esptool-4.8.0/espefuse/efuse/esp32c5beta3}/__init__.py +0 -0
- {esptool-4.7.dev2/espefuse/efuse/esp32h2beta1 → esptool-4.8.0/espefuse/efuse/esp32c6}/__init__.py +0 -0
- {esptool-4.7.dev2/espefuse/efuse/esp32p4 → esptool-4.8.0/espefuse/efuse/esp32c61}/__init__.py +0 -0
- {esptool-4.7.dev2/espefuse/efuse/esp32s2 → esptool-4.8.0/espefuse/efuse/esp32h2}/__init__.py +0 -0
- {esptool-4.7.dev2/espefuse/efuse/esp32s3 → esptool-4.8.0/espefuse/efuse/esp32h2beta1}/__init__.py +0 -0
- {esptool-4.7.dev2/espefuse/efuse/esp32s3beta2 → esptool-4.8.0/espefuse/efuse/esp32p4}/__init__.py +0 -0
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse/util.py +0 -0
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse_defs/esp32.yaml +0 -0
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse_defs/esp32c2.yaml +0 -0
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse_defs/esp32c3.yaml +0 -0
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse_defs/esp32s2.yaml +0 -0
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse/efuse_defs/esp32s3.yaml +0 -0
- {esptool-4.7.dev2 → esptool-4.8.0}/espefuse.py +0 -0
- {esptool-4.7.dev2 → esptool-4.8.0}/espsecure/__main__.py +0 -0
- {esptool-4.7.dev2 → esptool-4.8.0}/espsecure/esp_hsm_sign/__init__.py +0 -0
- {esptool-4.7.dev2 → esptool-4.8.0}/espsecure/esp_hsm_sign/exceptions.py +0 -0
- {esptool-4.7.dev2 → esptool-4.8.0}/espsecure.py +0 -0
- {esptool-4.7.dev2 → esptool-4.8.0}/esptool/__main__.py +0 -0
- {esptool-4.7.dev2 → esptool-4.8.0}/esptool/targets/esp32c6beta.py +0 -0
- {esptool-4.7.dev2 → esptool-4.8.0}/esptool/targets/esp32h2beta2.py +0 -0
- {esptool-4.7.dev2 → esptool-4.8.0}/esptool/targets/esp32s3beta2.py +0 -0
- {esptool-4.7.dev2 → esptool-4.8.0}/esptool.egg-info/dependency_links.txt +0 -0
- {esptool-4.7.dev2 → esptool-4.8.0}/esptool.py +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
include README.md
|
|
2
2
|
include LICENSE
|
|
3
|
-
include esptool/targets/stub_flasher
|
|
3
|
+
include esptool/targets/stub_flasher/1/*
|
|
4
|
+
include esptool/targets/stub_flasher/2/*
|
|
4
5
|
include espefuse/efuse_defs/*.yaml
|
|
5
6
|
# sdist includes test/test*.py by default, but esptool.py tests
|
|
6
7
|
# are so far only intended to run from the git repo itself
|
|
7
8
|
prune test
|
|
8
|
-
prune flasher_stub
|
|
9
9
|
prune .github
|
|
10
10
|
prune docs
|
|
11
11
|
exclude .git*
|
esptool-4.8.0/PKG-INFO
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: esptool
|
|
3
|
+
Version: 4.8.0
|
|
4
|
+
Summary: A serial utility to communicate & flash code to Espressif chips.
|
|
5
|
+
Author: Fredrik Ahlberg (themadinventor), Angus Gratton (projectgus), Espressif Systems
|
|
6
|
+
License: GPLv2+
|
|
7
|
+
Project-URL: Homepage, https://github.com/espressif/esptool/
|
|
8
|
+
Project-URL: Documentation, https://docs.espressif.com/projects/esptool/
|
|
9
|
+
Project-URL: Source, https://github.com/espressif/esptool/
|
|
10
|
+
Project-URL: Tracker, https://github.com/espressif/esptool/issues/
|
|
11
|
+
Project-URL: Changelog, https://github.com/espressif/esptool/blob/master/CHANGELOG.md
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Natural Language :: English
|
|
15
|
+
Classifier: Operating System :: POSIX
|
|
16
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
17
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
18
|
+
Classifier: Topic :: Software Development :: Embedded Systems
|
|
19
|
+
Classifier: Environment :: Console
|
|
20
|
+
Classifier: License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
27
|
+
Requires-Python: >=3.7
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Provides-Extra: hsm
|
|
31
|
+
License-File: LICENSE
|
|
32
|
+
|
|
33
|
+
# esptool.py
|
|
34
|
+
|
|
35
|
+
A Python-based, open-source, platform-independent utility to communicate with the ROM bootloader in Espressif chips.
|
|
36
|
+
|
|
37
|
+
[](https://github.com/espressif/esptool/actions/workflows/test_esptool.yml) [](https://github.com/espressif/esptool/actions/workflows/build_esptool.yml)
|
|
38
|
+
|
|
39
|
+
## Documentation
|
|
40
|
+
|
|
41
|
+
Visit the [documentation](https://docs.espressif.com/projects/esptool/) or run `esptool.py -h`.
|
|
42
|
+
|
|
43
|
+
## Contribute
|
|
44
|
+
|
|
45
|
+
If you're interested in contributing to esptool.py, please check the [contributions guide](https://docs.espressif.com/projects/esptool/en/latest/contributing.html).
|
|
46
|
+
|
|
47
|
+
## About
|
|
48
|
+
|
|
49
|
+
esptool.py 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.
|
|
50
|
+
|
|
51
|
+
## License
|
|
52
|
+
|
|
53
|
+
This document and the attached source code are released as Free Software under GNU General Public License Version 2 or later. See the accompanying [LICENSE file](https://github.com/espressif/esptool/blob/master/LICENSE) for a copy.
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2009-2015 Chris Liechti
|
|
2
|
+
# SPDX-FileContributor: 2020-2024 Espressif Systems (Shanghai) CO LTD
|
|
3
|
+
# SPDX-License-Identifier: BSD-3-Clause
|
|
4
|
+
#
|
|
5
|
+
# Redirect data from a TCP/IP connection to a serial port and vice versa using RFC 2217.
|
|
6
|
+
|
|
7
|
+
###################################################################################
|
|
8
|
+
# redirect data from a TCP/IP connection to a serial port and vice versa
|
|
9
|
+
# using RFC 2217
|
|
10
|
+
#
|
|
11
|
+
# (C) 2009-2015 Chris Liechti <cliechti@gmx.net>
|
|
12
|
+
#
|
|
13
|
+
# SPDX-License-Identifier: BSD-3-Clause
|
|
14
|
+
|
|
15
|
+
import logging
|
|
16
|
+
import socket
|
|
17
|
+
import sys
|
|
18
|
+
import serial
|
|
19
|
+
|
|
20
|
+
from esp_rfc2217_server.redirector import Redirector
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def main():
|
|
24
|
+
import argparse
|
|
25
|
+
|
|
26
|
+
parser = argparse.ArgumentParser(
|
|
27
|
+
description="RFC 2217 Serial to Network (TCP/IP) redirector.",
|
|
28
|
+
epilog="NOTE: no security measures are implemented. "
|
|
29
|
+
"Anyone can remotely connect to this service over the network.\n"
|
|
30
|
+
"Only one connection at once is supported. "
|
|
31
|
+
"When the connection is terminated it waits for the next connect.",
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
parser.add_argument("SERIALPORT")
|
|
35
|
+
|
|
36
|
+
parser.add_argument(
|
|
37
|
+
"-p",
|
|
38
|
+
"--localport",
|
|
39
|
+
type=int,
|
|
40
|
+
help="local TCP port, default: %(default)s",
|
|
41
|
+
metavar="TCPPORT",
|
|
42
|
+
default=2217,
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
parser.add_argument(
|
|
46
|
+
"-v",
|
|
47
|
+
"--verbose",
|
|
48
|
+
dest="verbosity",
|
|
49
|
+
action="count",
|
|
50
|
+
help="print more diagnostic messages (option can be given multiple times)",
|
|
51
|
+
default=0,
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
parser.add_argument(
|
|
55
|
+
"--r0",
|
|
56
|
+
help="Use delays necessary for ESP32 revision 0 chips",
|
|
57
|
+
action="store_true",
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
args = parser.parse_args()
|
|
61
|
+
|
|
62
|
+
if args.verbosity > 3:
|
|
63
|
+
args.verbosity = 3
|
|
64
|
+
level = (logging.WARNING, logging.INFO, logging.DEBUG, logging.NOTSET)[
|
|
65
|
+
args.verbosity
|
|
66
|
+
]
|
|
67
|
+
logging.basicConfig(level=logging.INFO)
|
|
68
|
+
# logging.getLogger('root').setLevel(logging.INFO)
|
|
69
|
+
logging.getLogger("rfc2217").setLevel(level)
|
|
70
|
+
|
|
71
|
+
# connect to serial port
|
|
72
|
+
ser = serial.serial_for_url(args.SERIALPORT, do_not_open=True, exclusive=True)
|
|
73
|
+
ser.timeout = 3 # required so that the reader thread can exit
|
|
74
|
+
# reset control line as no _remote_ "terminal" has been connected yet
|
|
75
|
+
ser.dtr = False
|
|
76
|
+
ser.rts = False
|
|
77
|
+
|
|
78
|
+
logging.info(" RFC 2217 TCP/IP to Serial redirector - type Ctrl-C / BREAK to quit")
|
|
79
|
+
|
|
80
|
+
try:
|
|
81
|
+
ser.open()
|
|
82
|
+
except serial.SerialException as e:
|
|
83
|
+
logging.error(" Could not open serial port {}: {}".format(ser.name, e))
|
|
84
|
+
sys.exit(1)
|
|
85
|
+
|
|
86
|
+
logging.info(" Serving serial port: {}".format(ser.name))
|
|
87
|
+
settings = ser.get_settings()
|
|
88
|
+
|
|
89
|
+
srv = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
90
|
+
srv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
|
91
|
+
srv.bind(("", args.localport))
|
|
92
|
+
srv.listen(1)
|
|
93
|
+
logging.info(" TCP/IP port: {}".format(args.localport))
|
|
94
|
+
while True:
|
|
95
|
+
try:
|
|
96
|
+
client_socket, addr = srv.accept()
|
|
97
|
+
logging.info("Connected by {}:{}".format(addr[0], addr[1]))
|
|
98
|
+
client_socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
|
|
99
|
+
ser.rts = True
|
|
100
|
+
ser.dtr = True
|
|
101
|
+
# enter network <-> serial loop
|
|
102
|
+
r = Redirector(ser, client_socket, args.verbosity > 0, args.r0)
|
|
103
|
+
try:
|
|
104
|
+
r.shortcircuit()
|
|
105
|
+
finally:
|
|
106
|
+
logging.info("Disconnected")
|
|
107
|
+
r.stop()
|
|
108
|
+
client_socket.close()
|
|
109
|
+
ser.dtr = False
|
|
110
|
+
ser.rts = False
|
|
111
|
+
# Restore port settings (may have been changed by RFC 2217
|
|
112
|
+
# capable client)
|
|
113
|
+
ser.apply_settings(settings)
|
|
114
|
+
except KeyboardInterrupt:
|
|
115
|
+
sys.stdout.write("\n")
|
|
116
|
+
break
|
|
117
|
+
except socket.error as msg:
|
|
118
|
+
logging.error(str(msg))
|
|
119
|
+
|
|
120
|
+
logging.info("--- exit ---")
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
if __name__ == "__main__":
|
|
124
|
+
main()
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2014-2024 Fredrik Ahlberg, Angus Gratton,
|
|
2
|
+
# Espressif Systems (Shanghai) CO LTD, other contributors as noted.
|
|
3
|
+
#
|
|
4
|
+
# SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
|
|
6
|
+
import esp_rfc2217_server
|
|
7
|
+
|
|
8
|
+
if __name__ == "__main__":
|
|
9
|
+
esp_rfc2217_server.main()
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2014-2024 Fredrik Ahlberg, Angus Gratton,
|
|
2
|
+
# Espressif Systems (Shanghai) CO LTD, other contributors as noted.
|
|
3
|
+
#
|
|
4
|
+
# SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
import os
|
|
6
|
+
import threading
|
|
7
|
+
from esptool.reset import (
|
|
8
|
+
ClassicReset,
|
|
9
|
+
CustomReset,
|
|
10
|
+
DEFAULT_RESET_DELAY,
|
|
11
|
+
HardReset,
|
|
12
|
+
UnixTightReset,
|
|
13
|
+
)
|
|
14
|
+
import serial
|
|
15
|
+
import serial.rfc2217
|
|
16
|
+
from serial.rfc2217 import (
|
|
17
|
+
COM_PORT_OPTION,
|
|
18
|
+
SET_CONTROL,
|
|
19
|
+
SET_CONTROL_DTR_OFF,
|
|
20
|
+
SET_CONTROL_DTR_ON,
|
|
21
|
+
SET_CONTROL_RTS_OFF,
|
|
22
|
+
SET_CONTROL_RTS_ON,
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
from esptool.config import load_config_file
|
|
26
|
+
|
|
27
|
+
cfg, _ = load_config_file(verbose=True)
|
|
28
|
+
cfg = cfg["esptool"]
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class EspPortManager(serial.rfc2217.PortManager):
|
|
32
|
+
"""
|
|
33
|
+
The beginning of the reset sequence is detected and the proper reset sequence
|
|
34
|
+
is applied in a thread. The rest of the reset sequence received is just ignored
|
|
35
|
+
and not sent to the serial port.
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
def __init__(self, serial_port, connection, esp32r0_delay, logger=None):
|
|
39
|
+
self.esp32r0_delay = esp32r0_delay
|
|
40
|
+
self.is_download_mode = False
|
|
41
|
+
super(EspPortManager, self).__init__(serial_port, connection, logger)
|
|
42
|
+
|
|
43
|
+
def _telnet_process_subnegotiation(self, suboption):
|
|
44
|
+
if suboption[0:1] == COM_PORT_OPTION and suboption[1:2] == SET_CONTROL:
|
|
45
|
+
if suboption[2:3] == SET_CONTROL_DTR_OFF:
|
|
46
|
+
self.is_download_mode = False
|
|
47
|
+
self.serial.dtr = False
|
|
48
|
+
return
|
|
49
|
+
elif suboption[2:3] == SET_CONTROL_RTS_OFF and not self.is_download_mode:
|
|
50
|
+
reset_thread = threading.Thread(target=self._hard_reset_thread)
|
|
51
|
+
reset_thread.daemon = True
|
|
52
|
+
reset_thread.name = "hard_reset_thread"
|
|
53
|
+
reset_thread.start()
|
|
54
|
+
return
|
|
55
|
+
elif suboption[2:3] == SET_CONTROL_DTR_ON and not self.is_download_mode:
|
|
56
|
+
self.is_download_mode = True
|
|
57
|
+
reset_thread = threading.Thread(target=self._reset_thread)
|
|
58
|
+
reset_thread.daemon = True
|
|
59
|
+
reset_thread.name = "reset_thread"
|
|
60
|
+
reset_thread.start()
|
|
61
|
+
return
|
|
62
|
+
elif suboption[2:3] in [
|
|
63
|
+
SET_CONTROL_DTR_ON,
|
|
64
|
+
SET_CONTROL_RTS_ON,
|
|
65
|
+
SET_CONTROL_RTS_OFF,
|
|
66
|
+
]:
|
|
67
|
+
return
|
|
68
|
+
# only in cases not handled above do the original implementation in PortManager
|
|
69
|
+
super(EspPortManager, self)._telnet_process_subnegotiation(suboption)
|
|
70
|
+
|
|
71
|
+
def _hard_reset_thread(self):
|
|
72
|
+
"""
|
|
73
|
+
The reset logic used for hard resetting the chip.
|
|
74
|
+
"""
|
|
75
|
+
if self.logger:
|
|
76
|
+
self.logger.info("Activating hard reset in thread")
|
|
77
|
+
HardReset(self.serial)()
|
|
78
|
+
|
|
79
|
+
def _reset_thread(self):
|
|
80
|
+
"""
|
|
81
|
+
The reset logic is used from esptool.py because the RTS and DTR signals
|
|
82
|
+
cannot be retransmitted through RFC 2217 with proper timing.
|
|
83
|
+
"""
|
|
84
|
+
if self.logger:
|
|
85
|
+
self.logger.info("Activating reset in thread")
|
|
86
|
+
|
|
87
|
+
delay = DEFAULT_RESET_DELAY
|
|
88
|
+
if self.esp32r0_delay:
|
|
89
|
+
delay += 0.5
|
|
90
|
+
|
|
91
|
+
cfg_custom_reset_sequence = cfg.get("custom_reset_sequence")
|
|
92
|
+
if cfg_custom_reset_sequence is not None:
|
|
93
|
+
CustomReset(self.serial, cfg_custom_reset_sequence)()
|
|
94
|
+
elif os.name != "nt":
|
|
95
|
+
UnixTightReset(self.serial, delay)()
|
|
96
|
+
else:
|
|
97
|
+
ClassicReset(self.serial, delay)()
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2014-2024 Fredrik Ahlberg, Angus Gratton,
|
|
2
|
+
# Espressif Systems (Shanghai) CO LTD, other contributors as noted.
|
|
3
|
+
#
|
|
4
|
+
# SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
import threading
|
|
6
|
+
import time
|
|
7
|
+
import logging
|
|
8
|
+
import socket
|
|
9
|
+
|
|
10
|
+
from esp_rfc2217_server.esp_port_manager import EspPortManager
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class Redirector(object):
|
|
14
|
+
def __init__(self, serial_instance, socket, debug=False, esp32r0delay=False):
|
|
15
|
+
self.serial = serial_instance
|
|
16
|
+
self.socket = socket
|
|
17
|
+
self._write_lock = threading.Lock()
|
|
18
|
+
self.rfc2217 = EspPortManager(
|
|
19
|
+
self.serial,
|
|
20
|
+
self,
|
|
21
|
+
esp32r0delay,
|
|
22
|
+
logger=logging.getLogger("rfc2217.server") if debug else None,
|
|
23
|
+
)
|
|
24
|
+
self.log = logging.getLogger("redirector")
|
|
25
|
+
self.force_exit = False
|
|
26
|
+
|
|
27
|
+
def statusline_poller(self):
|
|
28
|
+
self.log.debug("status line poll thread started")
|
|
29
|
+
while self.alive:
|
|
30
|
+
time.sleep(1)
|
|
31
|
+
self.rfc2217.check_modem_lines()
|
|
32
|
+
self.log.debug("status line poll thread terminated")
|
|
33
|
+
|
|
34
|
+
def shortcircuit(self):
|
|
35
|
+
"""connect the serial port to the TCP port by copying everything
|
|
36
|
+
from one side to the other"""
|
|
37
|
+
self.alive = True
|
|
38
|
+
self.thread_read = threading.Thread(target=self.reader)
|
|
39
|
+
self.thread_read.daemon = True
|
|
40
|
+
self.thread_read.name = "serial->socket"
|
|
41
|
+
self.thread_read.start()
|
|
42
|
+
self.thread_poll = threading.Thread(target=self.statusline_poller)
|
|
43
|
+
self.thread_poll.daemon = True
|
|
44
|
+
self.thread_poll.name = "status line poll"
|
|
45
|
+
self.thread_poll.start()
|
|
46
|
+
self.writer()
|
|
47
|
+
|
|
48
|
+
def reader(self):
|
|
49
|
+
"""loop forever and copy serial->socket"""
|
|
50
|
+
self.log.debug("reader thread started")
|
|
51
|
+
while self.alive:
|
|
52
|
+
try:
|
|
53
|
+
data = self.serial.read(self.serial.in_waiting or 1)
|
|
54
|
+
if data:
|
|
55
|
+
# escape outgoing data when needed (Telnet IAC (0xff) character)
|
|
56
|
+
self.write(b"".join(self.rfc2217.escape(data)))
|
|
57
|
+
except socket.error as msg:
|
|
58
|
+
self.log.error("{}".format(msg))
|
|
59
|
+
# probably got disconnected
|
|
60
|
+
break
|
|
61
|
+
self.alive = False
|
|
62
|
+
self.log.debug("reader thread terminated")
|
|
63
|
+
|
|
64
|
+
def write(self, data):
|
|
65
|
+
"""thread safe socket write with no data escaping. used to send telnet stuff"""
|
|
66
|
+
with self._write_lock:
|
|
67
|
+
self.socket.sendall(data)
|
|
68
|
+
|
|
69
|
+
def writer(self):
|
|
70
|
+
"""loop forever and copy socket->serial"""
|
|
71
|
+
while self.alive:
|
|
72
|
+
try:
|
|
73
|
+
data = self.socket.recv(1024)
|
|
74
|
+
if not data:
|
|
75
|
+
break
|
|
76
|
+
self.serial.write(b"".join(self.rfc2217.filter(data)))
|
|
77
|
+
except socket.error as msg:
|
|
78
|
+
self.log.error("{}".format(msg))
|
|
79
|
+
# probably got disconnected
|
|
80
|
+
break
|
|
81
|
+
self.stop()
|
|
82
|
+
|
|
83
|
+
def stop(self):
|
|
84
|
+
"""Stop copying"""
|
|
85
|
+
self.log.debug("stopping")
|
|
86
|
+
if self.alive:
|
|
87
|
+
self.alive = False
|
|
88
|
+
self.thread_read.join()
|
|
89
|
+
self.thread_poll.join()
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
#
|
|
3
|
+
# SPDX-FileCopyrightText: 2014-2024 Fredrik Ahlberg, Angus Gratton,
|
|
4
|
+
# Espressif Systems (Shanghai) CO LTD, other contributors as noted.
|
|
5
|
+
#
|
|
6
|
+
# SPDX-License-Identifier: BSD-3-Clause
|
|
7
|
+
|
|
8
|
+
# This executable script is a thin wrapper around the main functionality
|
|
9
|
+
# in the esp_rfc2217_server Python package
|
|
10
|
+
|
|
11
|
+
# When updating this script, please also update esptool.py, espefuse.py and espsecure.py
|
|
12
|
+
|
|
13
|
+
###################################################################################
|
|
14
|
+
# Redirect data from a TCP/IP connection to a serial port and vice versa using RFC 2217.
|
|
15
|
+
#
|
|
16
|
+
# This is a modified version of rfc2217_server.py provided by the pyserial package
|
|
17
|
+
# (pythonhosted.org/pyserial/examples.html#single-port-tcp-ip-serial-bridge-rfc-2217).
|
|
18
|
+
# It uses a custom PortManager to properly apply the RTS & DTR signals
|
|
19
|
+
# for resetting ESP chips.
|
|
20
|
+
#
|
|
21
|
+
# Run the following command on the server side to make
|
|
22
|
+
# connection between /dev/ttyUSB1 and TCP port 4000:
|
|
23
|
+
#
|
|
24
|
+
# python esp_rfc2217_server.py -p 4000 /dev/ttyUSB1
|
|
25
|
+
#
|
|
26
|
+
# Esptool can connect to the ESP device through that server as it is
|
|
27
|
+
# demonstrated in the following example:
|
|
28
|
+
#
|
|
29
|
+
# esptool.py --port rfc2217://localhost:4000?ign_set_control flash_id
|
|
30
|
+
#
|
|
31
|
+
|
|
32
|
+
import contextlib
|
|
33
|
+
import os
|
|
34
|
+
import sys
|
|
35
|
+
|
|
36
|
+
if os.name != "nt":
|
|
37
|
+
# Linux/macOS: remove current script directory to avoid importing this file
|
|
38
|
+
# as a module; we want to import the installed esp_rfc2217_server module instead
|
|
39
|
+
with contextlib.suppress(ValueError):
|
|
40
|
+
executable_dir = os.path.dirname(sys.executable)
|
|
41
|
+
sys.path = [
|
|
42
|
+
path
|
|
43
|
+
for path in sys.path
|
|
44
|
+
if not path.endswith(("/bin", "/sbin")) and path != executable_dir
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
# Linux/macOS: delete imported module entry to force Python to load
|
|
48
|
+
# the module from scratch; this enables importing esp_rfc2217_server module in
|
|
49
|
+
# other Python scripts
|
|
50
|
+
with contextlib.suppress(KeyError):
|
|
51
|
+
del sys.modules["esp_rfc2217_server"]
|
|
52
|
+
|
|
53
|
+
import esp_rfc2217_server
|
|
54
|
+
|
|
55
|
+
if __name__ == "__main__":
|
|
56
|
+
esp_rfc2217_server.main()
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# SPDX-FileCopyrightText: 2016-2022 Espressif Systems (Shanghai) CO LTD
|
|
2
2
|
#
|
|
3
3
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
4
|
+
# PYTHON_ARGCOMPLETE_OK
|
|
4
5
|
|
|
5
6
|
import argparse
|
|
6
7
|
import os
|
|
@@ -11,7 +12,10 @@ from io import StringIO
|
|
|
11
12
|
import espefuse.efuse.esp32 as esp32_efuse
|
|
12
13
|
import espefuse.efuse.esp32c2 as esp32c2_efuse
|
|
13
14
|
import espefuse.efuse.esp32c3 as esp32c3_efuse
|
|
15
|
+
import espefuse.efuse.esp32c5 as esp32c5_efuse
|
|
16
|
+
import espefuse.efuse.esp32c5beta3 as esp32c5beta3_efuse
|
|
14
17
|
import espefuse.efuse.esp32c6 as esp32c6_efuse
|
|
18
|
+
import espefuse.efuse.esp32c61 as esp32c61_efuse
|
|
15
19
|
import espefuse.efuse.esp32h2 as esp32h2_efuse
|
|
16
20
|
import espefuse.efuse.esp32h2beta1 as esp32h2beta1_efuse
|
|
17
21
|
import espefuse.efuse.esp32p4 as esp32p4_efuse
|
|
@@ -36,19 +40,26 @@ SUPPORTED_BURN_COMMANDS = [
|
|
|
36
40
|
"execute_scripts",
|
|
37
41
|
]
|
|
38
42
|
|
|
39
|
-
|
|
43
|
+
SUPPORTED_READ_COMMANDS = [
|
|
40
44
|
"summary",
|
|
41
45
|
"dump",
|
|
42
46
|
"get_custom_mac",
|
|
43
47
|
"adc_info",
|
|
44
48
|
"check_error",
|
|
45
|
-
]
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
SUPPORTED_COMMANDS = SUPPORTED_READ_COMMANDS + SUPPORTED_BURN_COMMANDS
|
|
46
52
|
|
|
47
53
|
SUPPORTED_CHIPS = {
|
|
48
54
|
"esp32": DefChip("ESP32", esp32_efuse, esptool.targets.ESP32ROM),
|
|
49
55
|
"esp32c2": DefChip("ESP32-C2", esp32c2_efuse, esptool.targets.ESP32C2ROM),
|
|
50
56
|
"esp32c3": DefChip("ESP32-C3", esp32c3_efuse, esptool.targets.ESP32C3ROM),
|
|
51
57
|
"esp32c6": DefChip("ESP32-C6", esp32c6_efuse, esptool.targets.ESP32C6ROM),
|
|
58
|
+
"esp32c61": DefChip("ESP32-C61", esp32c61_efuse, esptool.targets.ESP32C61ROM),
|
|
59
|
+
"esp32c5": DefChip("ESP32-C5", esp32c5_efuse, esptool.targets.ESP32C5ROM),
|
|
60
|
+
"esp32c5beta3": DefChip(
|
|
61
|
+
"ESP32-C5(beta3)", esp32c5beta3_efuse, esptool.targets.ESP32C5BETA3ROM
|
|
62
|
+
),
|
|
52
63
|
"esp32h2": DefChip("ESP32-H2", esp32h2_efuse, esptool.targets.ESP32H2ROM),
|
|
53
64
|
"esp32p4": DefChip("ESP32-P4", esp32p4_efuse, esptool.targets.ESP32P4ROM),
|
|
54
65
|
"esp32h2beta1": DefChip(
|
|
@@ -86,15 +97,25 @@ def get_esp(
|
|
|
86
97
|
)
|
|
87
98
|
if not skip_connect:
|
|
88
99
|
esp.connect(connect_mode)
|
|
100
|
+
if esp.sync_stub_detected:
|
|
101
|
+
esp = esp.STUB_CLASS(esp)
|
|
89
102
|
return esp
|
|
90
103
|
|
|
91
104
|
|
|
92
|
-
def get_efuses(
|
|
105
|
+
def get_efuses(
|
|
106
|
+
esp,
|
|
107
|
+
skip_connect=False,
|
|
108
|
+
debug_mode=False,
|
|
109
|
+
do_not_confirm=False,
|
|
110
|
+
extend_efuse_table=None,
|
|
111
|
+
):
|
|
93
112
|
for name in SUPPORTED_CHIPS:
|
|
94
113
|
if SUPPORTED_CHIPS[name].chip_name == esp.CHIP_NAME:
|
|
95
114
|
efuse = SUPPORTED_CHIPS[name].efuse_lib
|
|
96
115
|
return (
|
|
97
|
-
efuse.EspEfuses(
|
|
116
|
+
efuse.EspEfuses(
|
|
117
|
+
esp, skip_connect, debug_mode, do_not_confirm, extend_efuse_table
|
|
118
|
+
),
|
|
98
119
|
efuse.operations,
|
|
99
120
|
)
|
|
100
121
|
else:
|
|
@@ -210,9 +231,21 @@ def main(custom_commandline=None, esp=None):
|
|
|
210
231
|
"Use with caution.",
|
|
211
232
|
action="store_true",
|
|
212
233
|
)
|
|
234
|
+
init_parser.add_argument(
|
|
235
|
+
"--postpone",
|
|
236
|
+
help="Postpone burning some efuses from BLOCK0 at the end, "
|
|
237
|
+
"(efuses which disable access to blocks or chip).",
|
|
238
|
+
action="store_true",
|
|
239
|
+
)
|
|
240
|
+
init_parser.add_argument(
|
|
241
|
+
"--extend-efuse-table",
|
|
242
|
+
help="CSV file from ESP-IDF (esp_efuse_custom_table.csv)",
|
|
243
|
+
type=argparse.FileType("r"),
|
|
244
|
+
default=None,
|
|
245
|
+
)
|
|
213
246
|
|
|
214
247
|
common_args, remaining_args = init_parser.parse_known_args(custom_commandline)
|
|
215
|
-
debug_mode = common_args.debug
|
|
248
|
+
debug_mode = common_args.debug
|
|
216
249
|
just_print_help = [
|
|
217
250
|
True for arg in remaining_args if arg in ["--help", "-h"]
|
|
218
251
|
] or remaining_args == []
|
|
@@ -239,7 +272,11 @@ def main(custom_commandline=None, esp=None):
|
|
|
239
272
|
# TODO: Require the --port argument in the next major release, ESPTOOL-490
|
|
240
273
|
|
|
241
274
|
efuses, efuse_operations = get_efuses(
|
|
242
|
-
esp,
|
|
275
|
+
esp,
|
|
276
|
+
just_print_help,
|
|
277
|
+
debug_mode,
|
|
278
|
+
common_args.do_not_confirm,
|
|
279
|
+
common_args.extend_efuse_table,
|
|
243
280
|
)
|
|
244
281
|
|
|
245
282
|
parser = argparse.ArgumentParser(parents=[init_parser])
|
|
@@ -249,6 +286,15 @@ def main(custom_commandline=None, esp=None):
|
|
|
249
286
|
|
|
250
287
|
efuse_operations.add_commands(subparsers, efuses)
|
|
251
288
|
|
|
289
|
+
# Enable argcomplete only on Unix-like systems
|
|
290
|
+
if sys.platform != "win32":
|
|
291
|
+
try:
|
|
292
|
+
import argcomplete
|
|
293
|
+
|
|
294
|
+
argcomplete.autocomplete(parser)
|
|
295
|
+
except ImportError:
|
|
296
|
+
pass
|
|
297
|
+
|
|
252
298
|
grouped_remaining_args, used_cmds = split_on_groups(remaining_args)
|
|
253
299
|
if len(grouped_remaining_args) == 0:
|
|
254
300
|
parser.print_help()
|
|
@@ -259,6 +305,8 @@ def main(custom_commandline=None, esp=None):
|
|
|
259
305
|
if there_are_multiple_burn_commands_in_args:
|
|
260
306
|
efuses.batch_mode_cnt += 1
|
|
261
307
|
|
|
308
|
+
efuses.postpone = common_args.postpone
|
|
309
|
+
|
|
262
310
|
try:
|
|
263
311
|
for rem_args in grouped_remaining_args:
|
|
264
312
|
args, unused_args = parser.parse_known_args(rem_args, namespace=common_args)
|
|
@@ -285,6 +333,23 @@ def main(custom_commandline=None, esp=None):
|
|
|
285
333
|
efuses.batch_mode_cnt -= 1
|
|
286
334
|
if not efuses.burn_all(check_batch_mode=True):
|
|
287
335
|
raise esptool.FatalError("BURN was not done")
|
|
336
|
+
print("Successful")
|
|
337
|
+
|
|
338
|
+
if (
|
|
339
|
+
sum(cmd in SUPPORTED_BURN_COMMANDS for cmd in used_cmds) > 0
|
|
340
|
+
and sum(cmd in SUPPORTED_READ_COMMANDS for cmd in used_cmds) > 0
|
|
341
|
+
):
|
|
342
|
+
# [burn_cmd1] [burn_cmd2] [read_cmd1] [burn_cmd3] [read_cmd2]
|
|
343
|
+
print("\n=== Run read commands after burn commands ===")
|
|
344
|
+
for rem_args in grouped_remaining_args:
|
|
345
|
+
args, unused_args = parser.parse_known_args(
|
|
346
|
+
rem_args, namespace=common_args
|
|
347
|
+
)
|
|
348
|
+
current_cmd = args.operation
|
|
349
|
+
if current_cmd in SUPPORTED_READ_COMMANDS:
|
|
350
|
+
print(f"\n=== Run {args.operation} command ===")
|
|
351
|
+
operation_func = vars(efuse_operations)[current_cmd]
|
|
352
|
+
operation_func(esp, efuses, args)
|
|
288
353
|
finally:
|
|
289
354
|
if not external_esp and not common_args.virt and esp._port:
|
|
290
355
|
esp._port.close()
|