Skip to content

Commit 3d48b5d

Browse files
author
Marek Matej
committed
tools: esptool_py: Update to latest version
Bring the latest feature and fixes from the upstream. Signed-off-by: Marek Matej <marek.matej@espressif.com>
1 parent 3339ff2 commit 3d48b5d

File tree

217 files changed

+26839
-12040
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

217 files changed

+26839
-12040
lines changed

tools/esptool_py/CHANGELOG.md

Lines changed: 287 additions & 233 deletions
Large diffs are not rendered by default.

tools/esptool_py/CONTRIBUTING.rst

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
Contributions Guide
22
===================
33

4-
We welcome contributions to the ``esptool.py`` project!
4+
We welcome contributions to the ``esptool`` project!
55

66
How to Contribute
77
-----------------
88

9-
Contributions to ``esptool.py`` - fixing bugs, adding features, adding documentation - are welcome. We accept contributions via `Github Pull Requests <https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests>`_.
9+
Contributions to ``esptool`` - fixing bugs, adding features, adding documentation - are welcome. We accept contributions via `Github Pull Requests <https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests>`_.
1010

1111
.. _development-setup:
1212

1313
Development Setup
1414
-----------------
1515

16-
Development mode allows you to run the latest development version from the `esptool.py repository on GitHub <https://github.com/espressif/esptool>`_.
16+
Development mode allows you to run the latest development version from the `esptool repository on GitHub <https://github.com/espressif/esptool>`_.
1717

1818
.. code-block:: sh
1919
2020
$ git clone https://github.com/espressif/esptool.git
2121
$ cd esptool
2222
$ pip install --user -e .
2323
24-
This will install ``esptool.py``’s dependencies and create some executable script wrappers in the users ``bin`` directory. The wrappers will run the scripts found in the git working directory directly, so any time the working directory contents change it will pick up the new versions.
24+
This will install ``esptool``'s dependencies and create some executable script wrappers in the user's ``bin`` directory. The wrappers will run the scripts found in the git working directory directly, so any time the working directory contents change it will pick up the new versions.
2525

26-
Its also possible to run the scripts directly from the working directory with this Development Mode installation.
26+
It's also possible to run the scripts directly from the working directory with this Development Mode installation.
2727

28-
To also install additional tools needed for actually developing and testing ``esptool.py``, run this command to install a development copy of ``esptool.py`` *plus* packages useful for development:
28+
To also install additional tools needed for actually developing and testing ``esptool``, run this command to install a development copy of ``esptool`` *plus* packages useful for development:
2929

3030
::
3131

@@ -36,14 +36,16 @@ To also install additional tools needed for actually developing and testing ``es
3636
Reporting Issues
3737
----------------
3838

39-
Please report bugs in ``esptool.py`` if you find them. However, before reporting a bug please check through the following:
39+
Please report bugs in ``esptool`` if you find them. However, before reporting a bug please check through the following:
4040

4141
* `Troubleshooting Guide <https://docs.espressif.com/projects/esptool/en/latest/troubleshooting.html>`_ - common problems and known issues.
4242

4343
* `Existing Open Issues <https://github.com/espressif/esptool/issues>`_ - someone might have already encountered this.
4444

4545
If you don’t find anything, please `open a new issue <https://github.com/espressif/esptool/issues/new/choose>`_.
4646

47+
.. _feature-requests:
48+
4749
Sending Feature Requests
4850
------------------------
4951

@@ -56,7 +58,7 @@ Before Contributing
5658

5759
Before sending us a Pull Request, please consider this list of points:
5860

59-
* Have you tried running ``esptool.py`` test suite locally?
61+
* Have you tried running ``esptool`` test suite locally?
6062

6163
* Is the code adequately commented for people to understand how it is structured?
6264

@@ -71,9 +73,9 @@ Before sending us a Pull Request, please consider this list of points:
7173
Code Style & Static Analysis
7274
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7375

74-
Please follow these coding standards when writing code for ``esptool.py``:
76+
Please follow these coding standards when writing code for ``esptool``:
7577

76-
Pre-commit checks
78+
Pre-Commit Checks
7779
"""""""""""""""""
7880

7981
`pre-commit <https://pre-commit.com/>`_ is a framework for managing pre-commit hooks. These hooks help to identify simple issues before committing code for review.
@@ -90,27 +92,27 @@ On the first commit ``pre-commit`` will install the hooks, subsequent checks wil
9092
Conventional Commits
9193
""""""""""""""""""""
9294

93-
``esptool.py`` complies with the `Conventional Commits standard <https://www.conventionalcommits.org/en/v1.0.0/#specification>`_. Every commit message is checked with `Conventional Precommit Linter <https://github.com/espressif/conventional-precommit-linter>`_, ensuring it adheres to the standard.
95+
``esptool`` complies with the `Conventional Commits standard <https://www.conventionalcommits.org/en/v1.0.0/#specification>`_. Every commit message is checked with `Conventional Precommit Linter <https://github.com/espressif/conventional-precommit-linter>`_, ensuring it adheres to the standard.
9496

9597

9698
Ruff
9799
""""
98100

99-
``esptool.py`` is `PEP8 <https://peps.python.org/pep-0008/>`_ compliant and enforces this style guide. For compliance checking, we use `ruff <https://docs.astral.sh/ruff/>`_.
101+
``esptool`` is `PEP8 <https://peps.python.org/pep-0008/>`_ compliant and enforces this style guide. For compliance checking, we use `ruff <https://docs.astral.sh/ruff/>`_.
100102
``Ruff`` also auto-format files in the same style as previously used ``black``.
101103

102104

103105
``Ruff`` and ``Conventional Precommit Linter`` tools will be automatically run by ``pre-commit`` if that is configured. To check your code manually before submitting, run ``python -m ruff`` (this tool is installed as part of the development requirements shown at the beginning of this document).
104106

105107
When you submit a Pull Request, the GitHub Actions automated build system will run automated checks using these tools.
106108

107-
Shinx-lint
108-
""""""""""
109+
Sphinx-Lint
110+
"""""""""""
109111

110112
The documentation is checked for stylistic and formal issues by ``sphinx-lint``.
111113

112114

113-
Codespell check
115+
Codespell Check
114116
"""""""""""""""
115117

116118
This repository utilizes an automatic `spell checker <https://github.com/codespell-project/codespell>`_ integrated into the pre-commit process. If any spelling issues are detected, the recommended corrections will be applied automatically to the file, ready for commit.
@@ -120,46 +122,46 @@ In the event of false positives, you can adjust the configuration in the `.codes
120122
Automated Integration Tests
121123
^^^^^^^^^^^^^^^^^^^^^^^^^^^
122124

123-
The test directory contains a `pytest <https://docs.pytest.org/>`_ integration suite with some integration tests for ``esptool.py``, ``espefuse.py``, and ``espsecure.py``.
125+
The test directory contains a `pytest <https://docs.pytest.org/>`_ integration suite with some integration tests for ``esptool``, ``espefuse``, and ``espsecure``.
124126

125-
It is necessary to have ``esptool.py`` installed (see `Development Setup`_) in your environment in order to run these tests.
127+
It is necessary to have ``esptool`` installed (see `Development Setup`_) in your environment in order to run these tests.
126128

127129
The following tests run automatically by GitHub Actions for each Pull Request. You can run them locally to check for regressions in the respective functionality:
128130

129131
* ``test_imagegen.py`` tests the ``elf2image`` command
130-
* ``test_image_info.py`` tests the ``image_info`` command
131-
* ``test_mergebin.py`` tests the ``merge_bin`` command
132-
* ``test_modules.py`` tests the modules used by ``esptool.py`` for regressions
133-
* ``test_espsecure.py`` tests ``espsecure.py`` functionality
134-
* ``test_espsecure_hsm.py`` tests support of external HSM signing in ``espsecure.py``. These tests require additional prerequisites, see ``SoftHSM2 setup`` in the `tests workflow definition <https://github.com/espressif/esptool/blob/master/.github/workflows/test_esptool.yml>`_ for more information.
132+
* ``test_image_info.py`` tests the ``image-info`` command
133+
* ``test_mergebin.py`` tests the ``merge-bin`` command
134+
* ``test_modules.py`` tests the modules used by ``esptool`` for regressions
135+
* ``test_espsecure.py`` tests ``espsecure`` functionality
136+
* ``test_espsecure_hsm.py`` tests support of external HSM signing in ``espsecure``. These tests require additional prerequisites, see ``SoftHSM2 setup`` in the `tests workflow definition <https://github.com/espressif/esptool/blob/master/.github/workflows/test_esptool.yml>`_ for more information.
135137

136138
The following tests are not run automatically by GitHub Actions, because they need real connected hardware. Therefore, they need to be run locally in a command line:
137139

138-
* ``test_esptool.py`` contains integration tests for ``esptool.py`` and needs to be run against real Espressif hardware with the following format:
140+
* ``test_esptool.py`` contains integration tests for ``esptool`` and needs to be run against real Espressif hardware with the following format:
139141

140142
``pytest test_esptool.py --port <serial port> --chip <name of chip> --baud <baud rate>``
141143

142144
For example, to run all tests on an ESP32 board connected to /dev/ttyUSB0, at 230400bps:
143145

144146
``pytest test_esptool.py --port /dev/ttyUSB0 --chip esp32 --baud 230400``
145147

146-
Or to run the TestFlashing suite only (using the pytest ``-k`` option to select tests based on their name) on an ESP8266 board connected to /dev/ttyUSB2, at 460800bps:
148+
Or to run the ``TestFlashing`` suite only (using the pytest ``-k`` option to select tests based on their name) on an ESP8266 board connected to /dev/ttyUSB2, at 460800bps:
147149

148150
``pytest test_esptool.py --port /dev/ttyUSB2 --chip esp8266 --baud 460800 -k TestFlashing``
149151

150152
.. note::
151153

152154
Some tests might fail at higher baud rates on some hardware.
153155

154-
* ``test_esptool_sdm.py`` contains integration tests for ``esptool.py`` with chips in secure download mode. It needs to be run against real Espressif hardware (with active SDM). The command line format is the same as for ``test_esptool.py``.
156+
* ``test_esptool_sdm.py`` contains integration tests for ``esptool`` with chips in secure download mode. It needs to be run against real Espressif hardware (with active SDM). The command line format is the same as for ``test_esptool.py``.
155157

156158
The following tests are not run automatically by GitHub Actions, but can be run locally in a command line:
157159

158-
* ``test_espefuse.py`` tests ``espefuse.py`` functionality. To run it:
160+
* ``test_espefuse.py`` tests ``espefuse`` functionality. To run it:
159161

160162
``pytest test_espefuse.py --chip <name of chip>``
161163

162-
These test use the ``--virt`` virtual mode of ``espefuse.py`` to safely test the functionality without a connection to a chip and without the possibility of affecting the actual eFuses in a real hardware.
164+
These test use the ``--virt`` virtual mode of ``espefuse`` to safely test the functionality without a connection to a chip and without the possibility of affecting the actual eFuses in a real hardware.
163165

164166
.. warning::
165167

@@ -171,9 +173,7 @@ The whole test suite (without the tests needing an actual hardware or installati
171173
Pull Request Process
172174
--------------------
173175

174-
.. note::
175-
176-
If you are developing the stub flasher and plan to send a pull request, please use the latest toolchains available.
176+
If you would like to contribute to the flasher stub, please see the `Flasher stub repository <https://github.com/espressif/esptool-legacy-flasher-stub>`_.
177177

178178
After you open the Pull Request, there will probably be some discussion in the comments field of the request itself.
179179

tools/esptool_py/MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ include LICENSE
33
include esptool/targets/stub_flasher/1/*
44
include esptool/targets/stub_flasher/2/*
55
include espefuse/efuse_defs/*.yaml
6-
# sdist includes test/test*.py by default, but esptool.py tests
6+
# sdist includes test/test*.py by default, but esptool tests
77
# are so far only intended to run from the git repo itself
88
prune test
99
prune .github

tools/esptool_py/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
# esptool.py
1+
# esptool
22

3-
A Python-based, open-source, platform-independent utility to communicate with the ROM bootloader in Espressif chips.
3+
A Python-based, open-source, platform-independent serial utility for flashing, provisioning, and interacting with Espressif SoCs.
44

55
[![Test esptool](https://github.com/espressif/esptool/actions/workflows/test_esptool.yml/badge.svg?branch=master)](https://github.com/espressif/esptool/actions/workflows/test_esptool.yml) [![Build esptool](https://github.com/espressif/esptool/actions/workflows/build_esptool.yml/badge.svg?branch=master)](https://github.com/espressif/esptool/actions/workflows/build_esptool.yml)
66

77
## Documentation
88

9-
Visit the [documentation](https://docs.espressif.com/projects/esptool/) or run `esptool.py -h`.
9+
Visit the [documentation](https://docs.espressif.com/projects/esptool/) or run `esptool -h`.
1010

1111
## Contribute
1212

13-
If you're interested in contributing to esptool.py, please check the [contributions guide](https://docs.espressif.com/projects/esptool/en/latest/contributing.html).
13+
If you're interested in contributing to esptool, please check the [contributions guide](https://docs.espressif.com/projects/esptool/en/latest/contributing.html).
1414

1515
## About
1616

17-
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.
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.
1818

1919
## License
2020

tools/esptool_py/ci/download_flasher_stubs.py

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python
22
#
3-
# SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
3+
# SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
44
# SPDX-License-Identifier: GPL-2.0-or-later
55

66
import glob
@@ -12,42 +12,43 @@
1212
"STUB_SET_VERSION": "1",
1313
"DOWNLOAD_URL": "https://github.com/espressif/esptool-legacy-flasher-stub/releases/download",
1414
"TAG_URL": "https://github.com/espressif/esptool-legacy-flasher-stub/releases/tag",
15-
"VERSION": "v1.3.0",
15+
"VERSION": "v1.6.0",
1616
"FILE_LIST": (
1717
"esp32",
1818
"esp32c2",
1919
"esp32c3",
2020
"esp32c5",
21-
"esp32c5beta3",
2221
"esp32c6",
2322
"esp32c61",
24-
"esp32c6beta",
2523
"esp32h2",
26-
"esp32h2beta1",
27-
"esp32h2beta2",
2824
"esp32p4",
2925
"esp32s2",
3026
"esp32s3",
31-
"esp32s3beta2",
3227
"esp8266",
3328
),
34-
"LICENSE": "released as Free Software under GNU General Public License Version 2 or later",
29+
"LICENSE": "released as Free Software under GNU General Public License "
30+
"Version 2 or later",
3531
},
3632
{
3733
"STUB_SET_VERSION": "2",
38-
"DOWNLOAD_URL": "https://github.com/esp-rs/esp-flasher-stub/releases/download",
39-
"TAG_URL": "https://github.com/esp-rs/esp-flasher-stub/releases/tag",
40-
"VERSION": "v0.3.0",
34+
"DOWNLOAD_URL": "https://github.com/espressif/esp-flasher-stub/releases/download",
35+
"TAG_URL": "https://github.com/espressif/esp-flasher-stub/releases/tag",
36+
"VERSION": "v0.1.0",
4137
"FILE_LIST": (
4238
"esp32",
4339
"esp32c2",
4440
"esp32c3",
41+
"esp32c5",
4542
"esp32c6",
43+
"esp32c61",
4644
"esp32h2",
45+
"esp32p4",
4746
"esp32s2",
4847
"esp32s3",
48+
"esp8266",
4949
),
50-
"LICENSE": "dual licensed under the Apache License Version 2.0 or the MIT license",
50+
"LICENSE": "dual licensed under the Apache License Version 2.0 or the MIT "
51+
"license",
5152
},
5253
)
5354

@@ -56,16 +57,17 @@
5657
README_TEMPLATE = """# Licensing
5758
5859
The binaries in JSON format distributed in this directory are {LICENSE}. They were released at {URL} from where the sources can be obtained.
59-
"""
60+
""" # noqa: E501
6061

6162

6263
def main():
6364
for stub_set in STUBS:
6465
dest_sub_dir = os.path.join(DESTINATION_DIR, stub_set["STUB_SET_VERSION"])
6566

66-
""" The directory is cleaned up so we would detect if a stub was just committed into the repository but the
67-
name was not added into the FILE_LIST of STUBS. This would be an unwanted state because the checker would not
68-
detect any changes in that stub."""
67+
""" The directory is cleaned up so we would detect if a stub was just committed
68+
into the repository but the name was not added into the FILE_LIST of STUBS.
69+
This would be an unwanted state because the checker would not detect any
70+
changes in that stub."""
6971
for old_file in glob.glob(os.path.join(dest_sub_dir, "*.json")):
7072
print(f"Removing old file {old_file}")
7173
os.remove(old_file)

tools/esptool_py/docs/_static/esptool_versions.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
var DOCUMENTATION_VERSIONS = {
2-
DEFAULTS: { has_targets: false,
2+
DEFAULTS: { has_targets: true,
33
supported_targets: [ "esp32" ]
44
},
5-
VERSIONS: [ ],
5+
VERSIONS: [
6+
{ name: "latest", old: false, pre_release: false, supported_targets: [ "esp8266", "esp32", "esp32s2", "esp32s3", "esp32c3", "esp32c2", "esp32c6", "esp32p4", "esp32h2", "esp32c5", "esp32c61" ] },
7+
{ name: "release-v4", old: false, pre_release: false, supported_targets: [ "esp8266", "esp32", "esp32s2", "esp32s3", "esp32c3", "esp32c2", "esp32c6", "esp32p4", "esp32h2", "esp32c5", "esp32c61" ] },
8+
],
69
IDF_TARGETS: [
710
{ text: "ESP8266", value: "esp8266" },
811
{ text: "ESP32", value: "esp32" },
@@ -13,5 +16,7 @@ var DOCUMENTATION_VERSIONS = {
1316
{ text: "ESP32-C6", value: "esp32c6" },
1417
{ text: "ESP32-H2", value: "esp32h2" },
1518
{ text: "ESP32-P4", value: "esp32p4" },
19+
{ text: "ESP32-C5", value: "esp32c5" },
20+
{ text: "ESP32-C61", value: "esp32c61" },
1621
]
1722
};

tools/esptool_py/docs/conf_common.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
"esp32c6",
1212
"esp32h2",
1313
"esp32p4",
14+
"esp32c5",
15+
"esp32c61",
1416
]
1517

1618
# link roles config
@@ -23,7 +25,14 @@
2325
html_static_path = ["../_static"]
2426

2527
# Conditional content
26-
extensions += ["esp_docs.esp_extensions.dummy_build_system"]
28+
extensions += [
29+
"esp_docs.esp_extensions.dummy_build_system",
30+
"sphinx.ext.autodoc",
31+
"sphinx.ext.napoleon",
32+
"sphinx_tabs.tabs",
33+
]
34+
35+
sphinx_tabs_disable_tab_closing = True
2736

2837
ESP8266_DOCS = []
2938

@@ -42,9 +51,15 @@
4251
"esp32c6": ESP32_DOCS,
4352
"esp32h2": ESP32_DOCS,
4453
"esp32p4": ESP32_DOCS,
54+
"esp32c5": ESP32_DOCS,
55+
"esp32c61": ESP32_DOCS,
4556
}
4657

4758
# Extra options required by sphinx_idf_theme
4859
project_slug = "esptool"
4960

5061
versions_url = "./_static/esptool_versions.js"
62+
63+
64+
def conf_setup(app, config):
65+
config.html_baseurl = f"https://docs.espressif.com/projects/esptool/{config.language}/stable/{config.idf_target}/"

0 commit comments

Comments
 (0)