Skip to content

Commit 9a31b3f

Browse files
committed
esptool: bump to v4.8.1
Update esptool to latest release. Signed-off-by: Sylvio Alves <[email protected]>
1 parent 592a675 commit 9a31b3f

File tree

265 files changed

+10576
-823
lines changed

Some content is hidden

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

265 files changed

+10576
-823
lines changed

tools/esptool_py/CHANGELOG.md

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,102 @@
1+
## v4.8.1 (2024-09-25)
2+
3+
### Bug Fixes
4+
5+
- **esp32c2**: Add esp32c2 eco4 rom magic value
6+
- **packaging**: Correctly exclude the unwanted sub/modules
7+
8+
## v4.8.0 (2024-09-18)
9+
10+
### New Features
11+
12+
- **espefuse**: Supports wafer efuse versions for esp32c61
13+
- **esptool**: add new command SFDP read
14+
- **esptool**: Add option to retry connection in a loop
15+
- **efuse**: Updates efuse table for esp32c5
16+
- **efuse**: Updates efuse table for esp32p4
17+
- **esp32c61**: Added stub flasher support
18+
- **cli**: add autocompletions
19+
- **esptool**: allow picking UART by VID/PID/Name
20+
- **esp32c5**: Add USB-serial/JTAG stub support
21+
- **esp32c5**: Add UART stub support
22+
- **esptool**: Print key_purpose name for get_security_info cmd
23+
- **espefuse**: Adds support extend efuse table by user CSV file
24+
- **espefuse**: Adds efuse dump formats: separated(default) and united(new)
25+
- **espefuse**: Adds incompatible eFuse settings check for S3
26+
- **reset**: Apply reconnections to the whole reset sequence, not line transitions
27+
- **reset**: Automatically reconnect if port disconnects during reset
28+
- **esp32-p4**: Add ECO1 magic number
29+
- **espsecure**: Add support for secure boot v2 using ECDSA-P384 signatures
30+
- **write_flash**: retry flashing if chip disconnects
31+
- **espefuse**: Allow filtering efuses based on command line arguments
32+
- **esploader**: Enable context manager for esp instances
33+
- **espefuse**: Added check for correctness of written data
34+
- **espefuse**: Improves help for burn_efuse cmd
35+
- **esp32s3**: clear boot control register on hard reset
36+
- **esp32-p4**: add spi-connection restriction to ROM class
37+
- add UF2 IDs for ESP32-C5 and ESP32-C61
38+
- **espefuse**: Updates efuses for C5 and C61
39+
- **esp32c61**: add c61 basic flash support (no_stub)
40+
- **esp32c5**: skipped the stub check for esp32c5 mp
41+
- **esp32c5**: base support of esp32c5 mp (no stub)
42+
- Added warning when secure boot enabled
43+
- **cmds/write_flash**: Recalculated SHA digest for image binary
44+
- print flash voltage in flash_id command
45+
- **esptool**: Adds wafer and pkg versions
46+
- **espefuse**: Update adc_info commands for all chips
47+
- **espefuse**: Adds new efuses for esp32p4
48+
- **espefuse**: Allow the espefuse.py to work when coding scheme == 3
49+
- **err_defs**: Add ROM bootloader flash error definitions
50+
- Use ruff instead of flake8 and black both in pre-commit and CI
51+
- **esp32p4**: Enable USB-serial/JTAG in flasher stub
52+
- **espefuse**: Postpone some efuses to burn them at the very end
53+
- add advisory port locking
54+
- **espefuse**: check_error --recover chip even if there are num_errors
55+
- **espefuse**: Adds new efuses for esp32c6 and esp32h2
56+
- **esp32c5**: add target esp32c5 beta3
57+
58+
### Bug Fixes
59+
60+
- **esptool**: Fix esp32c61 flash frequency config
61+
- **esptool**: Fix incorrect chip version for esp32c5
62+
- **write_flash**: Verify if files will fit against the real flash size when possible
63+
- **remote_ports**: Disable reset sequence when a socket is used
64+
- **bitstring**: Restricted bitstring dependency to fix 32-bit compatibility
65+
- **esp32_d0wdr2_v3**: Print correct chip name
66+
- pass error message to exception in OTG mode
67+
- **bin_image**: add check for ELF file segment when saving RAM segments
68+
- **docs**: Add a note about entering manual bootloader mode
69+
- **esp32c5**: Fix MAC reading for esptool
70+
- Erase non-aligned bytes with --no-stub
71+
- **esp32-c5**: Use a longer reset delay with usb-serial/jtag to stabilize boot-up
72+
- **espefuse**: Use stub class if stub flasher is running
73+
- Do not append SHA256 when `--ram-only-header`
74+
- **elf2image**: add ELF flags to merge condition
75+
- ram_only_header: pad flash segment to next boundary
76+
- sort segments if ram_only_header is used
77+
- **espefuse**: Fix efuse base addr for esp32c5 MP
78+
- fix type annotation to comply with mypy
79+
- **espefuse**: Fix burn_key for ECDSA_KEY, it can read pem file
80+
- **secure_download_mode**: Disable secure boot detection and print more info
81+
- **esptool**: clear boot control register on ESP32-S3
82+
- **intelhex**: catch unicode decode errors when converting hex to binary
83+
- ROM doesn't attach in-package flash chips
84+
- close file gracefully in espsecure
85+
- Fixed glitches on RTS line when no_reset option on Windows
86+
- **merge_bin**: treat files starting with colon as raw files
87+
- Index image segments from 0 instead of 1
88+
- **read_flash**: add flash size arg to enable reading past 2MB without stub
89+
- **read_flash**: flush transmit buffer less often to inrease throughput
90+
- **esptool**: Proper alignment for SoCs with offset load
91+
- ignore resetting on unsupported ports
92+
- **esptool**: Remove the shebang from uf2_writer.py
93+
94+
### Code Refactoring
95+
96+
- Migrated esp_rfc2217_server into standalone subpackage
97+
- **test/esptool**: Updated tests according to SHA recomputation for binary
98+
- **style**: Comply with black>=24.0.0
99+
1100
## v4.7.0 (2023-12-13)
2101

3102
### New Features

tools/esptool_py/MANIFEST.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
include README.md
22
include LICENSE
3-
include esptool/targets/stub_flasher/*.json
3+
include esptool/targets/stub_flasher/1/*
4+
include esptool/targets/stub_flasher/2/*
45
include espefuse/efuse_defs/*.yaml
56
# sdist includes test/test*.py by default, but esptool.py tests
67
# are so far only intended to run from the git repo itself
78
prune test
8-
prune flasher_stub
99
prune .github
1010
prune docs
1111
exclude .git*

tools/esptool_py/ci/Sign-File.ps1

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
[CmdletBinding()]
2+
param (
3+
[Parameter()]
4+
[String]
5+
$Path
6+
)
7+
8+
9+
function FindSignTool {
10+
$SignTool = "signtool.exe"
11+
if (Get-Command $SignTool -ErrorAction SilentlyContinue) {
12+
return $SignTool
13+
}
14+
$SignTool = "${env:ProgramFiles(x86)}\Windows Kits\10\bin\x64\signtool.exe"
15+
if (Test-Path -Path $SignTool -PathType Leaf) {
16+
return $SignTool
17+
}
18+
$SignTool = "${env:ProgramFiles(x86)}\Windows Kits\10\bin\x86\signtool.exe"
19+
if (Test-Path -Path $SignTool -PathType Leaf) {
20+
return $SignTool
21+
}
22+
$sdkVers = "10.0.22000.0", "10.0.20348.0", "10.0.19041.0", "10.0.17763.0"
23+
Foreach ($ver in $sdkVers)
24+
{
25+
$SignTool = "${env:ProgramFiles(x86)}\Windows Kits\10\bin\${ver}\x64\signtool.exe"
26+
if (Test-Path -Path $SignTool -PathType Leaf) {
27+
return $SignTool
28+
}
29+
}
30+
"signtool.exe not found"
31+
Exit 1
32+
}
33+
34+
function SignEsptool {
35+
param(
36+
[Parameter()]
37+
[String]
38+
$Path
39+
)
40+
41+
$SignTool = FindSignTool
42+
"Using: $SignTool"
43+
$CertificateFile = [system.io.path]::GetTempPath() + "certificate.pfx"
44+
45+
if ($null -eq $env:CERTIFICATE) {
46+
"CERTIFICATE variable not set, unable to sign the file"
47+
Exit 1
48+
}
49+
50+
if ("" -eq $env:CERTIFICATE) {
51+
"CERTIFICATE variable is empty, unable to sign the file"
52+
Exit 1
53+
}
54+
55+
$SignParameters = @("sign", "/tr", 'http://timestamp.digicert.com', "/td", "SHA256", "/f", $CertificateFile, "/fd", "SHA256")
56+
if ($env:CERTIFICATE_PASSWORD) {
57+
"CERTIFICATE_PASSWORD detected, using the password"
58+
$SignParameters += "/p"
59+
$SignParameters += $env:CERTIFICATE_PASSWORD
60+
}
61+
$SignParameters += $Path
62+
63+
[byte[]]$CertificateBytes = [convert]::FromBase64String($env:CERTIFICATE)
64+
[IO.File]::WriteAllBytes($CertificateFile, $CertificateBytes)
65+
66+
&$SignTool $SignParameters
67+
68+
if (0 -eq $LASTEXITCODE) {
69+
Remove-Item $CertificateFile
70+
} else {
71+
Remove-Item $CertificateFile
72+
"Signing failed"
73+
Exit 1
74+
}
75+
76+
}
77+
78+
SignEsptool ${Path}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
#!/usr/bin/env python
2+
#
3+
# SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
4+
# SPDX-License-Identifier: GPL-2.0-or-later
5+
6+
import glob
7+
import os
8+
import urllib.request
9+
10+
STUBS = (
11+
{
12+
"STUB_SET_VERSION": "1",
13+
"DOWNLOAD_URL": "https://github.com/espressif/esptool-legacy-flasher-stub/releases/download",
14+
"TAG_URL": "https://github.com/espressif/esptool-legacy-flasher-stub/releases/tag",
15+
"VERSION": "v1.3.0",
16+
"FILE_LIST": (
17+
"esp32",
18+
"esp32c2",
19+
"esp32c3",
20+
"esp32c5",
21+
"esp32c5beta3",
22+
"esp32c6",
23+
"esp32c61",
24+
"esp32c6beta",
25+
"esp32h2",
26+
"esp32h2beta1",
27+
"esp32h2beta2",
28+
"esp32p4",
29+
"esp32s2",
30+
"esp32s3",
31+
"esp32s3beta2",
32+
"esp8266",
33+
),
34+
"LICENSE": "released as Free Software under GNU General Public License Version 2 or later",
35+
},
36+
{
37+
"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",
41+
"FILE_LIST": (
42+
"esp32",
43+
"esp32c2",
44+
"esp32c3",
45+
"esp32c6",
46+
"esp32h2",
47+
"esp32s2",
48+
"esp32s3",
49+
),
50+
"LICENSE": "dual licensed under the Apache License Version 2.0 or the MIT license",
51+
},
52+
)
53+
54+
DESTINATION_DIR = os.path.join("esptool", "targets", "stub_flasher")
55+
56+
README_TEMPLATE = """# Licensing
57+
58+
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+
61+
62+
def main():
63+
for stub_set in STUBS:
64+
dest_sub_dir = os.path.join(DESTINATION_DIR, stub_set["STUB_SET_VERSION"])
65+
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."""
69+
for old_file in glob.glob(os.path.join(dest_sub_dir, "*.json")):
70+
print(f"Removing old file {old_file}")
71+
os.remove(old_file)
72+
73+
for file_name in stub_set["FILE_LIST"]:
74+
file = ".".join((file_name, "json"))
75+
url = "/".join((stub_set["DOWNLOAD_URL"], stub_set["VERSION"], file))
76+
dest = os.path.join(dest_sub_dir, file)
77+
print(f"Downloading {url} to {dest}")
78+
urllib.request.urlretrieve(url, dest)
79+
80+
with open(os.path.join(dest_sub_dir, "README.md"), "w") as f:
81+
print(f"Writing README to {f.name}")
82+
f.write(
83+
README_TEMPLATE.format(
84+
LICENSE=stub_set["LICENSE"],
85+
URL="/".join((stub_set["TAG_URL"], stub_set["VERSION"])),
86+
)
87+
)
88+
89+
90+
if __name__ == "__main__":
91+
main()

tools/esptool_py/ci/espressif.ico

115 KB
Binary file not shown.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{# This changelog template is used for automatically generated GH release notes. #}
2+
{# It is passed to commitizen's --template option in a GH Actions workflow run. #}
3+
4+
{% for entry in tree %}
5+
6+
{% for change_key, changes in entry.changes.items() %}
7+
8+
{% if change_key %}
9+
### {{ change_key }}
10+
{% endif %}
11+
12+
{% for change in changes %}
13+
{% if change.scope %}
14+
- **{{ change.scope }}**: {{ change.message }}
15+
{% elif change.message %}
16+
- {{ change.message }}
17+
{% endif %}
18+
{% endfor %}
19+
{% endfor %}
20+
{% endfor %}
21+
22+
Thanks to <FILL OUT CONTRIBUTORS>, and others for contributing to this release!
23+
24+
# Results of checking the release against common anti-virus SW
25+
26+
<Upload the release binaries to VirusTotal and ADD a link to the report here>
27+
28+
The failures are probably false positives. You can mark esptool as safe in your anti-virus SW, or [install esptool from source](https://docs.espressif.com/projects/esptool/en/latest/installation.html).
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
2+
#
3+
# SPDX-License-Identifier: GPL-2.0-or-later
4+
5+
import argparse
6+
import re
7+
8+
LINE_RE = re.compile(r"^__version__ = ['\"]([^'\"]*)['\"]")
9+
NEW_LINE = '__version__ = "{}"\n'
10+
11+
12+
def patch_file(path, new_version):
13+
assert ".dev" in new_version
14+
new_version = new_version.lstrip("v")
15+
16+
with open(path, "r") as fin:
17+
lines = fin.readlines()
18+
19+
for i, line in enumerate(lines, start=0):
20+
m = LINE_RE.search(line)
21+
if m:
22+
lines[i] = NEW_LINE.format(new_version)
23+
break
24+
25+
with open(path, "w") as fout:
26+
fout.writelines(lines)
27+
28+
29+
def main():
30+
parser = argparse.ArgumentParser()
31+
parser.add_argument("file", help="Path to script with __version__")
32+
parser.add_argument(
33+
"--version", help="Development version specifier to patch the version to"
34+
)
35+
args = parser.parse_args()
36+
patch_file(args.file, args.version)
37+
38+
39+
if __name__ == "__main__":
40+
main()

tools/esptool_py/ci/setup_softhsm2.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
# Init tokens for tests
4+
softhsm2-util --init-token --label softhsm-test-token --pin 1234 --so-pin 123456 --slot 0
5+
softhsm2-util --init-token --label softhsm-test-token-1 --pin 1234 --so-pin 123456 --slot 1
6+
softhsm2-util --init-token --label softhsm-test-token-2 --pin 1234 --so-pin 123456 --slot 2
7+
softhsm2-util --init-token --label softhsm-test-token-3 --pin 1234 --so-pin 123456 --slot 3

tools/esptool_py/docs/en/advanced-topics/boot-mode-selection.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,10 @@ Depending on the kind of hardware you have, it may also be possible to manually
166166
- For development boards produced by Espressif, this information can be found in the respective getting started guides or user guides. For example, to manually reset a development board, hold down the **Boot** button (``{IDF_TARGET_STRAP_BOOT_GPIO}``) and press the **EN** button (``EN`` (``CHIP_PU``)).
167167
- For other types of hardware, try pulling ``{IDF_TARGET_STRAP_BOOT_GPIO}`` down.
168168

169+
.. note::
170+
171+
If esptool is able to reset the chip but for some reason the chip is not entering into bootloader mode then hold down the Boot button (or pull down ``{IDF_TARGET_STRAP_BOOT_GPIO}``) while you start esptool and keep it down during reset.
172+
169173
.. only:: esp8266
170174

171175
.. _boot-log-esp8266:

tools/esptool_py/docs/en/espefuse/burn-efuse-cmd.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ Positional arguments:
1010
- ``eFuse name``
1111
- ``value``
1212

13+
Optional arguments:
14+
15+
* ``--force``. Suppress an error to burn eFuses. The tool checks for incompatible eFuse states to prevent them from burning and potentially **bricking the chip**. Use this flag only if you are sure. This will suppress the eFuse incompatibility error.
16+
1317
It can be list of eFuse names and values (like EFUSE_NAME1 1 EFUSE_NAME2 7 EFUSE_NAME3 10 etc.).
1418

1519
New values can be a numeric value in decimal or hex (with "0x" prefix). eFuse bits can only be burned from 0 to 1, attempting to set any back to 0 will have no effect. Most eFuses have a limited bit width (many are only 1-bit flags). Longer eFuses (MAC addresses, keys) can be set with this command, but it's better to use a specific command (``burn_custom_mac``, ``burn_key``) for a specific field.

0 commit comments

Comments
 (0)