Skip to content

Commit 17a84ac

Browse files
committed
cpu/esp32: using esptool.py as package
1 parent 8ff29b1 commit 17a84ac

3 files changed

Lines changed: 14 additions & 41 deletions

File tree

cpu/esp32/Makefile.dep

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
include $(RIOTCPU)/esp_common/Makefile.dep
44

5+
USEPKG += esptool
56
USEPKG += esp32_sdk
67

78
USEMODULE += esp_idf_common

cpu/esp32/Makefile.include

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,10 @@ endif
9292

9393
FLASHFILE_POS ?= 0x10000
9494

95-
ESPTOOL ?= $(RIOTTOOLS)/esptools/esptool_v3.2.py
95+
ifeq (,$(ESPTOOL))
96+
ESPTOOL ?= $(PKGDIRBASE)/esptool/venv/bin/esptool.py
97+
ESPTOOL_FLASH ?= $(PKGDIRBASE)/esptool/venv_flash/bin/esptool.py
98+
endif
9699

97100
include $(RIOTCPU)/esp_common/Makefile.include
98101

cpu/esp32/doc.txt

Lines changed: 9 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -439,30 +439,7 @@ The building process using Docker comprises two steps:
439439
Both steps can also be performed with a single command on the host system
440440
by setting the `BUILD_IN_DOCKER` variable:
441441
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
442-
$ BUILD_IN_DOCKER=1 DOCKER="sudo docker" \
443-
make flash BOARD=...
444-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
445-
446-
@note
447-
During the migration phase from the ESP32 toolchain with GCC 5.2.0, which was
448-
specially compiled for RIOT, to Espressif's precompiled ESP32 vendor toolchain
449-
with GCC 8.4.0, the RIOT Docker build image
450-
[schorcht/riotbuild_esp32_espressif_gcc_8.4.0](https://hub.docker.com/repository/docker/schorcht/riotbuild_esp32_espressif_gcc_8.4.0)
451-
has to be used instead of `riot/riotbuild` as this already contains the
452-
precompiled ESP32 vendor toolchain from Espressif while `riot/riotbuild`
453-
does not.
454-
Therefore, the RIOT Docker build image has to be pulled with command:
455-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
456-
$ sudo docker pull schorcht/riotbuild_esp32_espressif_gcc_8.4.0
457-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
458-
and the RIOT Docker build image in step 1 has to be started with command:
459-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
460-
$ sudo docker run --rm -i -t -u $UID -v $(pwd):/data/riotbuild schorcht/riotbuild_esp32_espressif_gcc_8.4.0
461-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
462-
The single step build command on the host system has then to be:
463-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
464-
$ BUILD_IN_DOCKER=1 DOCKER="sudo docker" DOCKER_IMAGE=schorcht/riotbuild_esp32_espressif_gcc_8.4.0 \
465-
make flash BOARD=...
442+
$ BUILD_IN_DOCKER=1 make flash BOARD=...
466443
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
467444

468445
[Back to table of contents](#esp32_toc)
@@ -547,25 +524,17 @@ install it separately.
547524

548525
### Installation of esptool.py (ESP flash programmer tool) {#esp32_installation_of_esptool}
549526

550-
The RIOT port does not work with the `esptool.py` ESP flasher program
551-
available on [GitHub](https://github.com/espressif/esptool) or
552-
as a package for your OS. Instead, a modified version included in
553-
ESP-IDF SDK is required.
527+
The RIOT port uses the ESP flasher programme `esptool.py` as a package directly
528+
from [GitHub](https://github.com/espressif/esptool) within a virtual Python
529+
environment. The `esptool.py` version that is available as a Python package
530+
for your operating system does not normally work.
554531

555-
To avoid the installation of the complete ESP-IDF SDK, for example, because
556-
RIOT Docker build image is used for compilation, `esptool.py` has been
557-
extracted from the SDK and placed in RIOT's directory `dist/tools/esptool`.
558-
For convenience, the build system uses always the version from this directory.
532+
The RIOT port uses the ESP flasher program `esptool.py` as package directly from [GitHub](https://github.com/espressif/esptool) within an virtual Python environment. The version of `esptool.py` available as Python package for your OS does not usually work.
559533

560-
Therefore, it is **not necessary to install** `esptool.py` explicitly. However
561-
`esptool.py` depends on `pySerial` which can be installed either
562-
using `pip`
563-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
564-
$ sudo pip3 install pyserial
565-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
566-
or the package manager of your OS, for example on Debian/Ubuntu systems:
534+
It is also possible to use your own version of `esptool.py` by overriding
535+
the make variable `ESPTOOL` in the command line, for example:
567536
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
568-
$ apt install python3-serial
537+
$ ESPTOOL=/path/to/esptool.py make flash BOARD=...
569538
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
570539

571540
For more information on `esptool.py`, please refer to the

0 commit comments

Comments
 (0)