diff --git a/cpu/esp32/Makefile.include b/cpu/esp32/Makefile.include
index 230d586f54b8..8c487c3631f3 100644
--- a/cpu/esp32/Makefile.include
+++ b/cpu/esp32/Makefile.include
@@ -64,7 +64,6 @@ PSEUDOMODULES += esp_spiffs
PSEUDOMODULES += esp_wifi_any
export TARGET_ARCH ?= xtensa-esp32-elf
-export ESPTOOL ?= $(ESP32_SDK_DIR)/components/esptool_py/esptool/esptool.py
USEMODULE += esp_idf
USEMODULE += esp_idf_driver
@@ -158,6 +157,8 @@ ifneq (,$(filter esp_cxx,$(USEMODULE)))
UNDEF += $(BINDIR)/esp_cxx/cxa_guard.o
endif
+ESPTOOL ?= $(RIOTBASE)/dist/tools/esptool/esptool.py
+
# The ELFFILE is the base one used for flashing
FLASHFILE ?= $(ELFFILE)
@@ -165,6 +166,7 @@ FLASHFILE ?= $(ELFFILE)
FLASH_MODE ?= dout # FIX configuration, DO NOT CHANGE
FLASH_FREQ = 40m # FIX configuration, DO NOT CHANGE
FLASH_SIZE ?= 2MB
+
PREFLASHER = $(ESPTOOL)
PREFFLAGS = --chip esp32 elf2image
PREFFLAGS += -fm $(FLASH_MODE) -fs $(FLASH_SIZE) -ff $(FLASH_FREQ)
@@ -175,7 +177,6 @@ PREFFLAGS += printf "phy_init, data, phy, 0xf000, 0x1000\n" >> $(BINDIR)/partiti
PREFFLAGS += printf "factory, app, factory, 0x10000, " >> $(BINDIR)/partitions.csv;
PREFFLAGS += ls -l $(FLASHFILE).bin | awk '{ print $$5 }' >> $(BINDIR)/partitions.csv;
-
PREFFLAGS += python $(RIOTCPU)/$(CPU)/gen_esp32part.py --disable-sha256sum
PREFFLAGS += --verify $(BINDIR)/partitions.csv $(BINDIR)/partitions.bin
FLASHDEPS += preflash
diff --git a/cpu/esp32/doc.txt b/cpu/esp32/doc.txt
index 230964786674..75ee6cbd3bab 100644
--- a/cpu/esp32/doc.txt
+++ b/cpu/esp32/doc.txt
@@ -202,7 +202,7 @@ The implementation of RIOT-OS for ESP32 SOCs has the following limitations at th
Following software components are required for compilation:
- Xtensa GCC compiler suite for ESP32
-- ESP-IDF SDK which includes all ESP32 SOC definitions, the hardware abstraction library ```libhal.a```, and the flash programmer tool ```esptool.py```
+- ESP-IDF SDK which includes all ESP32 SOC definitions, basic libraries and the hardware abstraction library `libhal.a`
There are two options to install the Toolchain:
@@ -216,7 +216,12 @@ The easiest way to use install the toolchain is the RIOT Docker image ```riotdoc
1. making the RIOT application in Docker with command ```make BOARD= ...```
2. flashing the RIOT application on the host computer with command ```make flash-only BOARD=...```
-where step 2 requires that the flasher program ```esptool.py``` is installed.
+where step 2 requires that the ESP flash programmer `esptool.py` is installed.
+Both steps can also be performed with a single command on the host system
+using the `BUILD_IN_DOCKER` variable:
+```
+BUILD_IN_DOCKER=1 make BOARD=... flash
+```
### Preparing the Environment [[TOC](#esp32_toc)]
@@ -224,30 +229,14 @@ Using RIOT Docker requires at least the following software:
- ```Docker``` container virtualization software
- RIOT Docker (```riotdocker```) image
-- flasher tool ```esptool.py```
+- ESP flash programmer tool `esptool.py`
For information about installing Docker on your host, refer to the appropriate manuals for your operating system. For example, the easiest way to install Docker on the Ubuntu/Debian system is:
```
sudo apt-get install docker.io
```
-
-The ESP flasher program ```esptool.py``` is available at [GitHub](https://github.com/espressif/esptool). Don't use the the ```esptool``` package of your OS. ```esptool.py``` requires either Python 2.7 or Python 3.4 or later. The latest stable version of ```esptool.py``` can be installed with ```pip```:
-```
-pip install esptool
-```
-
-```esptool.py``` depends on ```pySerial``` which can be installed either using ```pip```
-
-```
-pip install pyserial
-```
-or the package manager of your OS, for example on Debian/Ubuntu systems:
-```
-apt-get install pyserial
-```
-For more information on ```esptool.py```, please refer the [git repository](https://github.com/espressif/esptool)
-
-Please make sure that ```esptool.py``` is in your ```PATH``` variable.
+For information on how to install `esptool.py`, see section
+[Installation of `esptool.py`](#esp32_installation_of_esptool).
### Generating a riotdocker Image [[TOC](#esp32_toc)]
@@ -345,6 +334,32 @@ Since we only use a few header files, ESP-IDF does not need to be compiled in an
export ESP32_SDK_DIR=$HOME/esp/esp-idf
```
+### Installation of `esptool.py` (ESP flash programmer tool) [[TOC](#esp32_toc)]
+
+The RIOT port does not work with the `esptool.py` ESP flasher program
+available on [GitHub](https://github.com/espressif/esptool) or
+as a package for your OS. Instead, a modified version is required.
+
+To avoid the installation of the complete ESP-IDF SDK, for example,
+because RIOT Docker `riotdocker` is used for compilation, `esptool.py`
+has been extracted from the SDK and placed in RIOT's
+directory `dist/tools/esptool`.
+For convenience, the build system uses always the version from this directory.
+
+Therefore, it is **not necessary to install** `esptool.py` explicitly. However
+`esptool.py` depends on `pySerial` which can be installed either
+using `pip`
+
+```
+sudo pip install pyserial
+```
+or the package manager of your OS, for example on Debian/Ubuntu systems:
+```
+apt install python-pyserial
+```
+For more information on `esptool.py`, please refer to the
+[git repository](https://github.com/espressif/esptool).
+
# Flashing the Device [[TOC](#esp32_toc)]