Skip to content

pkg: use esptool.py v4.9.0 as package #21557

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 23, 2025
Merged

Conversation

gschorcht
Copy link
Contributor

@gschorcht gschorcht commented Jun 22, 2025

Contribution description

This PR adds esptool.py v4.9.0 as a package and installs it in virtual Python environments.

For newer ESP32x variants like ESP32-H2 and ESP32-C6 a newer version of esptool.py is required, for example version v4.9.0 However, this version became a more complex Python project with a number of dependencies instead of a single Python file. Therefore, I decided to use esptool.py as a package from now on and install it in a virtual Python environment.

Since esptool.py is required for compilation as well as for flashing, esptool.py is installed in two separate virtual Python environments, one for compilation and one for flashing only. This is needed to be able

  • to flash a precompiled application without compiling the package or
  • to compile an application in RIOT Docker and flashing it on the host system.

It is still possible to use your own installation of esptool.py by overriding the variable ESPTOOL in the make command.

Since the virtual Python environments are created in $(RIOTBASE)/build, it could be that the compilation in CI takes too long and it would be better to install it once directly in $(RIOTBASE)/dist/tools/esptools, which would also require an update of RIOT Docker. On my local system the installation of esptool.py in a fresh build directory costs about 15 seconds.

Testing procedure

BOARD=esp32-wroom-32 make -j4 -C tests/sys/shell

should install esptool.py in $(RIOTBASE)/build/pkg/esptool/venv and should use it for the preparation of the .bin file.

BOARD=esp32-wroom-32 make -j4 -C tests/sys/shell flash-only

should install esptool.py in $(RIOTBASE)/build/pkg/esptool/venv_flash and should work.

BOARD=esp32-wroom-32 make -j4 -C tests/sys/shell clean
BUILD_IN_DOCKER=1 BOARD=esp32-wroom-32 make -j4 -C tests/sys/shell flash

should install esptool.py in /data/riotbuild/riotbase/build/pkg/esptool/venv in RIOT docker and in $(RIOTBASE)/build/pkg/esptool/venv_flash on host and should work.

Issues/PRs references

Prerequisite for PR #21522

`esptool.py` is now used as a package within a virtual Python environment. Since `esptool.py` is used for compilation on the one hand and for flashing on the other, `esptool.py` is installed in two separate virtual Python environments, one for compilation and one for flashing only. This is required
1. to be able to flash a precompiled application only without compiling the package and
2. to be able to compile an application in RIOT Docker and flash it on the host system.
@github-actions github-actions bot added Area: doc Area: Documentation Area: build system Area: Build system Area: pkg Area: External package ports Area: tools Area: Supplementary tools Platform: ESP Platform: This PR/issue effects ESP-based platforms Area: cpu Area: CPU/MCU ports labels Jun 22, 2025
@gschorcht gschorcht added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Jun 22, 2025
@riot-ci
Copy link

riot-ci commented Jun 22, 2025

Murdock results

✔️ PASSED

2fff341 cpu/esp32: using esptool.py as package

Success Failures Total Runtime
10379 0 10379 13m:16s

Artifacts

Copy link
Contributor

@benpicco benpicco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, works like a charm! (tried with esp8266-esp-12x)

@benpicco benpicco added this pull request to the merge queue Jun 23, 2025
@gschorcht
Copy link
Contributor Author

Thank you, works like a charm! (tried with esp8266-esp-12x)

Hm, for the ESP8266, the old and simple version 2.4.0 in dist/tools/esptools/esptool.py is still used 😎 which is only a single file and is therefore still part of the repository. Version v4.9.0 is only installed and used as part of the compilation process for any ESP32 board. It is not necessary to have the hardware for testing.

Merged via the queue into RIOT-OS:master with commit e6741e6 Jun 23, 2025
26 checks passed
@gschorcht
Copy link
Contributor Author

@benpicco Thanks for reviewing, testing and merging.

@gschorcht gschorcht deleted the pkg/esptool branch June 24, 2025 15:40
@Teufelchen1 Teufelchen1 added this to the Release 2025.07 milestone Jul 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: build system Area: Build system Area: cpu Area: CPU/MCU ports Area: doc Area: Documentation Area: pkg Area: External package ports Area: tools Area: Supplementary tools CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: ESP Platform: This PR/issue effects ESP-based platforms Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants