Skip to content

Commit 9332689

Browse files
Jason2866peterdragunradimkarnisdobairolandDzarda7
authored
updates
* docs: fix minor issues and improve vague statements * feat(esp32h21): Add Microsoft UF2 family ID * fix(logging): Avoid crashes when flushing if sys.stdout is not available Closes espressif#1064 Closes espressif#1063 * change(github): Add Github workflow for bot responses to issues * fix(elf2image): Print correct MMU page size in error message * fix(elf2image): Try to correct MMU page size if not specified This commit fixes issue with using elf2image command without --flash-mmu-page-size. In that case, app info segment might be incorrectly placed in the image. This is fixed by checking if app info segment is present and if so, use page size from it or from its alignment. Closes espressif#1062 * fix(elf2image): support --flash-mmu-page-config for all chips This commit fixes the issue where the `--flash-mmu-page-config` option did not work for chips that do not have configurable MMU page sizes. * fix(esptool): Fix efuse base address for esp32h21 * remove: Deprecate Python versions 3.7, 3.8 and 3.9 BREAKING CHANGE * docs(logger): Fix custom logger example code Closes espressif#1066 * feat(esp32h4): add ESP32H4 esptool support * feat(espefuse): Updates esp32h4 efuse table and fixes tests - Added esp32h4 efuse table - Fixed h4 test - Enabled some tests for p4 chip. * feat(esp32h4): update the ESP32H4StubLoader * change: fix issues reported by ruff linter * ci: update pre-commit hooks to the latest versions * feat(flash_attach): Encapsulate logic for flash attaching and configuration * refactor(cli_mode): Improve CLI mode workflow code * feat(cmds): Rework the public API to work as a Python module BREAKING CHANGE Closes espressif#208 * feat(cmds): Allow commands to output bytes, as well as write to a file * fix(lint): Correct type annotations issues reported by mypy * Tasmota changes * update manifest * Update build_esptool.yml * Update build_esptool.yml * docs(logger): Fix custom logger example code Closes espressif#1066 --------- Co-authored-by: Peter Dragun <peter.dragun@espressif.com> Co-authored-by: Radim Karniš <radim.karnis@espressif.com> Co-authored-by: Roland Dobai <roland.dobai@espressif.com> Co-authored-by: Jaroslav Burian <jaroslav.burian@espressif.com> Co-authored-by: Konstantin Kondrashov <konstantin@espressif.com> Co-authored-by: Chen Jichang <chenjichang@espressif.com>
1 parent d4fb78a commit 9332689

File tree

98 files changed

+5728
-1620
lines changed

Some content is hidden

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

98 files changed

+5728
-1620
lines changed

.git-blame-ignore-revs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@ b57f69bd13222b1753446a0f7c17386eda1dc2c9
1313

1414
# Refactoring documentation
1515
6282f98dbfca58add4992c259c0aac3c3ec64d3f
16+
17+
# Fixing linter issues
18+
2e4e77cde269379f3aba2e1344c912f47c5974de

.github/ISSUE_TEMPLATE/bug-report-no-hw.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ body:
2323
attributes:
2424
label: Python Version
2525
description: Which Python version are you using? Run `python -V` to check this.
26-
placeholder: ex. Python 3.9.6
26+
placeholder: ex. Python 3.10.6
2727
validations:
2828
required: true
2929
- type: input

.github/ISSUE_TEMPLATE/issue-with-hw.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ body:
3030
attributes:
3131
label: Python Version
3232
description: Which Python version are you using? Run `python -V` to check this.
33-
placeholder: ex. Python 3.9.6
33+
placeholder: ex. Python 3.10.6
3434
validations:
3535
required: true
3636
- type: input

.github/workflows/build_esptool.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
name: Build and test in ${{ matrix.platform }}
2828
with:
2929
arch: ${{ matrix.platform }}
30-
distro: ubuntu20.04
30+
distro: ubuntu22.04
3131
shell: /bin/bash
3232
# Not required, but speeds up builds by storing container images in
3333
# a GitHub package registry.
@@ -45,8 +45,7 @@ jobs:
4545
export PATH=\$PATH:/home/builder/.local/bin
4646
# Install dependencies
4747
python -m pip install --upgrade pip
48-
# PyInstaller >=6.0 results in significantly more antivirus false positives
49-
pip install pyinstaller==5.13.2
48+
pip install pyinstaller==6.11.1
5049
pip install --user -e .
5150
5251
# Build with PyInstaller
@@ -90,7 +89,7 @@ jobs:
9089
- platform: linux-amd64
9190
TARGET: linux-amd64
9291
SEPARATOR: ':'
93-
RUN_ON: ubuntu-20.04
92+
RUN_ON: ubuntu-24.04
9493
env:
9594
DISTPATH: esptool-${{ matrix.TARGET }}
9695
STUBS_DIR: ./esptool/targets/stub_flasher/

.github/workflows/issue_bot.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Bot response to issues
2+
3+
on:
4+
issues:
5+
types: [opened, edited]
6+
7+
jobs:
8+
docs_bot:
9+
name: Generate automated response by docs bot
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Docs bot action
13+
if: ${{ github.repository_owner == 'espressif' }}
14+
uses: espressif/docs-bot-action@master
15+
env:
16+
BOT_API_KEY: ${{ secrets.BOT_API_KEY }}
17+
BOT_INTEGRATION_ID: ${{ secrets.BOT_INTEGRATION_ID }}
18+
BOT_API_ENDPOINT: ${{ secrets.BOT_API_ENDPOINT }}
19+
with:
20+
github_token: ${{ secrets.GITHUB_TOKEN }}
21+
github_repository: ${{ github.repository }}
22+
github_issue_number: ${{ github.event.issue.number }}
23+
title: ${{ github.event.issue.title }}
24+
in_msg: ${{ github.event.issue.body }}
25+
prefix_out_msg: >
26+
Hi @${{ github.event.issue.user.login }}! Please be aware that
27+
(1) the following suggestions are generated by a bot and haven't been fact-checked by Espressif
28+
Systems,
29+
(2) burning eFuses and enabling security features are irreversible operations and can damage your ESP32 device.
30+
We hope that this message will help you until an Espressif Engineer looks at your issue.

.github/workflows/test_esptool.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ on: [push, pull_request]
44

55
jobs:
66
test_esptool:
7-
runs-on: ubuntu-22.04 # 22.04 is the last version with Python 3.7
7+
runs-on: ubuntu-22.04
88

99
strategy:
1010
matrix:
11-
python-version: ['3.9', '3.10', '3.11', '3.12']
11+
python-version: ['3.10', '3.11', '3.12', '3.13']
1212

1313
steps:
1414
- name: Checkout ref commit
@@ -62,14 +62,14 @@ jobs:
6262
git diff --exit-code
6363
6464
lint_esptool:
65-
runs-on: ubuntu-22.04 # 22.04 is the last version with Python 3.7
65+
runs-on: ubuntu-22.04
6666
steps:
6767
- name: Checkout
6868
uses: actions/checkout@master
69-
- name: Set up Python 3.9
69+
- name: Set up Python 3.10
7070
uses: actions/setup-python@master
7171
with:
72-
python-version: '3.9'
72+
python-version: '3.10'
7373
- name: Lint and format with ruff
7474
run: |
7575
pip install --extra-index-url https://dl.espressif.com/pypi -e .[dev]

.gitlab-ci.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ cache:
3838

3939
.test_template: &test_template
4040
stage: test
41-
image: python:3.7-bullseye
41+
image: python:3.10-bullseye
4242
tags:
4343
- host_test
4444
dependencies: []
@@ -117,6 +117,7 @@ host_tests_espefuse:
117117
- esp32s2
118118
- esp32s3
119119
- esp32h21
120+
- esp32h4
120121
script:
121122
- coverage run --parallel-mode -m pytest ${CI_PROJECT_DIR}/test/test_espefuse.py --chip ${TARGET}
122123
# some .coverage files in sub-directories are not collected on some runners, move them first
@@ -137,7 +138,7 @@ host_tests_latest_python:
137138
- pytest ${CI_PROJECT_DIR}/test/test_espefuse.py --chip esp32
138139

139140
# A new job "host_test_hsm" is created for the test "test_espsecure_hsm.py" which runs an ubuntu image,
140-
# because python-pkcs11 (v0.7.0) package is compiled using GLIBC_2.34 but docker image python:3.7-bullseye
141+
# because python-pkcs11 (v0.7.0) package is compiled using GLIBC_2.34 but docker image python:3.10-bullseye
141142
# support versions only upto GLIBC_2.31.
142143
host_tests_hsm:
143144
<<: *host_tests_template
@@ -157,7 +158,7 @@ host_tests_hsm:
157158

158159
run_pre_commit_hooks:
159160
stage: test
160-
image: python:3.7-bullseye
161+
image: python:3.10-bullseye
161162
rules:
162163
- if: $CI_PIPELINE_SOURCE != "schedule"
163164
tags:
@@ -189,7 +190,6 @@ check_install_coverage:
189190
- ".coverage*"
190191
expire_in: 1 week
191192
script:
192-
- coverage run --parallel-mode setup.py install
193193
- coverage run --parallel-mode esptool.py --help
194194
- coverage run --parallel-mode espefuse.py --help
195195
- coverage run --parallel-mode espsecure.py --help
@@ -250,7 +250,7 @@ check_stub_build:
250250

251251
.target_esptool_test:
252252
stage: test
253-
image: python:3.7-bullseye
253+
image: python:3.10-bullseye
254254
variables:
255255
PYTHONPATH: "$PYTHONPATH:${CI_PROJECT_DIR}/test"
256256
COVERAGE_PROCESS_START: "${CI_PROJECT_DIR}/test/.covconf"
@@ -479,7 +479,7 @@ target_tests_windows:
479479

480480
combine_reports:
481481
stage: report
482-
image: python:3.7-bullseye
482+
image: python:3.10-bullseye
483483
tags:
484484
- host_test
485485
artifacts:
@@ -509,7 +509,7 @@ combine_reports:
509509

510510
build_docs:
511511
stage: build_docs
512-
image: python:3.7-bullseye
512+
image: python:3.12-bookworm # 3.12 is the last version with imghdr
513513
tags:
514514
- build_docs
515515
rules:
@@ -518,6 +518,7 @@ build_docs:
518518
- changes:
519519
- "docs/**/*"
520520
- "CONTRIBUTING.rst"
521+
- "esptool/cmds.py"
521522
needs: []
522523
artifacts:
523524
when: always
@@ -526,13 +527,14 @@ build_docs:
526527
- docs/_build/*/*/html/*
527528
expire_in: 4 days
528529
script:
530+
- pip install . # esptool is needed for the automatic API documentation generation
529531
- cd docs
530532
- pip install -r requirements.txt --prefer-binary
531533
- build-docs -l en -t {esp8266,esp32,esp32s2,esp32c3,esp32s3,esp32c2,esp32c6,esp32h2,esp32p4,esp32c5,esp32c61}
532534

533535
.deploy_docs_template:
534536
stage: deploy_docs
535-
image: python:3.7-bullseye
537+
image: python:3.12-bookworm # 3.12 is the last version with imghdr
536538
tags:
537539
- deploy
538540
needs:
@@ -553,6 +555,7 @@ deploy_docs_preview:
553555
- changes:
554556
- "docs/**/*"
555557
- "CONTRIBUTING.rst"
558+
- "esptool/cmds.py"
556559
variables:
557560
TYPE: "preview"
558561
DOCS_BUILD_DIR: "${CI_PROJECT_DIR}/docs/_build/"
@@ -570,6 +573,7 @@ deploy_docs_production:
570573
changes:
571574
- "docs/**/*"
572575
- "CONTRIBUTING.rst"
576+
- "esptool/cmds.py"
573577
variables:
574578
TYPE: "production"
575579
DOCS_BUILD_DIR: "${CI_PROJECT_DIR}/docs/_build/"

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.1.14
3+
rev: v0.9.6
44
hooks:
55
- id: ruff # Runs ruff linter (replaces flake8)
66
args: [--fix, --exit-non-zero-on-fix] # --fix for fixing errors
77
- id: ruff-format
88
- repo: https://github.com/sphinx-contrib/sphinx-lint
9-
rev: v0.6.8
9+
rev: v1.0.0
1010
hooks:
1111
- id: sphinx-lint
1212
name: Lint RST files in docs folder using Sphinx Lint
1313
files: ^((docs/en)/.*\.(rst|inc))|CONTRIBUTING.rst$
1414
- repo: https://github.com/pre-commit/mirrors-mypy
15-
rev: v1.4.1 # the last version running on py3.7
15+
rev: v1.15.0
1616
hooks:
1717
- id: mypy
1818
additional_dependencies: ['types-PyYAML<=6.0.12.12']
1919
# ignore wrapper scripts because of name colision with efuse/__init__.py etc.
2020
exclude: test/|docs/|espefuse.py|espsecure.py|esptool.py|esp_rfc2217_server.py
2121
- repo: https://github.com/codespell-project/codespell
22-
rev: v2.2.5
22+
rev: v2.4.1
2323
hooks:
2424
- id: codespell
2525
additional_dependencies:
@@ -31,5 +31,5 @@ repos:
3131
stages: [commit-msg]
3232
args:
3333
- --allow-breaking
34-
default_stages: [commit]
34+
default_stages: [pre-commit]
3535
default_install_hook_types: [pre-commit, commit-msg]

CONTRIBUTING.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ Please report bugs in ``esptool.py`` if you find them. However, before reporting
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

@@ -73,7 +75,7 @@ Code Style & Static Analysis
7375

7476
Please follow these coding standards when writing code for ``esptool.py``:
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.
@@ -104,13 +106,13 @@ Ruff
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.
@@ -143,7 +145,7 @@ The following tests are not run automatically by GitHub Actions, because they ne
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

@@ -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

ci/download_flasher_stubs.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
"esp32s3",
2727
"esp8266",
2828
),
29-
"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",
3031
},
3132
{
3233
"STUB_SET_VERSION": "2",
@@ -42,7 +43,8 @@
4243
"esp32s2",
4344
"esp32s3",
4445
),
45-
"LICENSE": "dual licensed under the Apache License Version 2.0 or the MIT license",
46+
"LICENSE": "dual licensed under the Apache License Version 2.0 or the MIT "
47+
"license",
4648
},
4749
)
4850

@@ -51,16 +53,17 @@
5153
README_TEMPLATE = """# Licensing
5254
5355
The binaries in JSON format distributed in this directory are {LICENSE}. They were released at {URL} from where the sources can be obtained.
54-
"""
56+
""" # noqa: E501
5557

5658

5759
def main():
5860
for stub_set in STUBS:
5961
dest_sub_dir = os.path.join(DESTINATION_DIR, stub_set["STUB_SET_VERSION"])
6062

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

0 commit comments

Comments
 (0)