mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-16 18:13:49 +01:00
Merge pull request #21557 from gschorcht/pkg/esptool
pkg: use esptool.py v4.9.0 as package
This commit is contained in:
commit
e6741e6bf9
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
include $(RIOTCPU)/esp_common/Makefile.dep
|
include $(RIOTCPU)/esp_common/Makefile.dep
|
||||||
|
|
||||||
|
USEPKG += esptool
|
||||||
USEPKG += esp32_sdk
|
USEPKG += esp32_sdk
|
||||||
|
|
||||||
USEMODULE += esp_idf_common
|
USEMODULE += esp_idf_common
|
||||||
|
|||||||
@ -92,7 +92,10 @@ endif
|
|||||||
|
|
||||||
FLASHFILE_POS ?= 0x10000
|
FLASHFILE_POS ?= 0x10000
|
||||||
|
|
||||||
ESPTOOL ?= $(RIOTTOOLS)/esptools/esptool_v3.2.py
|
ifeq (,$(ESPTOOL))
|
||||||
|
ESPTOOL ?= $(PKGDIRBASE)/esptool/venv/bin/esptool.py
|
||||||
|
ESPTOOL_FLASH ?= $(PKGDIRBASE)/esptool/venv_flash/bin/esptool.py
|
||||||
|
endif
|
||||||
|
|
||||||
include $(RIOTCPU)/esp_common/Makefile.include
|
include $(RIOTCPU)/esp_common/Makefile.include
|
||||||
|
|
||||||
|
|||||||
@ -418,7 +418,7 @@ $(ESP_SDK_BOOTLOADER_ELF): \
|
|||||||
$(Q)$(CC) -o $@ $(LINKFLAGS) -Wl,-Map=$(@:%.elf=%.map)
|
$(Q)$(CC) -o $@ $(LINKFLAGS) -Wl,-Map=$(@:%.elf=%.map)
|
||||||
|
|
||||||
FLASH_CHIP = $(CPU_FAM)
|
FLASH_CHIP = $(CPU_FAM)
|
||||||
ESPTOOL ?= $(RIOTTOOLS)/esptools/esptool_v3.2.py
|
ESPTOOL ?= $(PKGDIRBASE)/esptool/venv/bin/esptool.py
|
||||||
# TODO: These should be exported/configurable from the app side. That would
|
# TODO: These should be exported/configurable from the app side. That would
|
||||||
# require to export these values.
|
# require to export these values.
|
||||||
FLASH_MODE ?= dio # ESP-IDF uses dio as default flash mode for the bootloader
|
FLASH_MODE ?= dio # ESP-IDF uses dio as default flash mode for the bootloader
|
||||||
|
|||||||
@ -439,30 +439,7 @@ The building process using Docker comprises two steps:
|
|||||||
Both steps can also be performed with a single command on the host system
|
Both steps can also be performed with a single command on the host system
|
||||||
by setting the `BUILD_IN_DOCKER` variable:
|
by setting the `BUILD_IN_DOCKER` variable:
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
$ BUILD_IN_DOCKER=1 DOCKER="sudo docker" \
|
$ BUILD_IN_DOCKER=1 make flash BOARD=...
|
||||||
make flash BOARD=...
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
@note
|
|
||||||
During the migration phase from the ESP32 toolchain with GCC 5.2.0, which was
|
|
||||||
specially compiled for RIOT, to Espressif's precompiled ESP32 vendor toolchain
|
|
||||||
with GCC 8.4.0, the RIOT Docker build image
|
|
||||||
[schorcht/riotbuild_esp32_espressif_gcc_8.4.0](https://hub.docker.com/repository/docker/schorcht/riotbuild_esp32_espressif_gcc_8.4.0)
|
|
||||||
has to be used instead of `riot/riotbuild` as this already contains the
|
|
||||||
precompiled ESP32 vendor toolchain from Espressif while `riot/riotbuild`
|
|
||||||
does not.
|
|
||||||
Therefore, the RIOT Docker build image has to be pulled with command:
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
$ sudo docker pull schorcht/riotbuild_esp32_espressif_gcc_8.4.0
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
and the RIOT Docker build image in step 1 has to be started with command:
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
$ sudo docker run --rm -i -t -u $UID -v $(pwd):/data/riotbuild schorcht/riotbuild_esp32_espressif_gcc_8.4.0
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
The single step build command on the host system has then to be:
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
$ BUILD_IN_DOCKER=1 DOCKER="sudo docker" DOCKER_IMAGE=schorcht/riotbuild_esp32_espressif_gcc_8.4.0 \
|
|
||||||
make flash BOARD=...
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
[Back to table of contents](#esp32_toc)
|
[Back to table of contents](#esp32_toc)
|
||||||
@ -547,25 +524,17 @@ install it separately.
|
|||||||
|
|
||||||
### Installation of esptool.py (ESP flash programmer tool) {#esp32_installation_of_esptool}
|
### Installation of esptool.py (ESP flash programmer tool) {#esp32_installation_of_esptool}
|
||||||
|
|
||||||
The RIOT port does not work with the `esptool.py` ESP flasher program
|
The RIOT port uses the ESP flasher programme `esptool.py` as a package directly
|
||||||
available on [GitHub](https://github.com/espressif/esptool) or
|
from [GitHub](https://github.com/espressif/esptool) within a virtual Python
|
||||||
as a package for your OS. Instead, a modified version included in
|
environment. The `esptool.py` version that is available as a Python package
|
||||||
ESP-IDF SDK is required.
|
for your operating system does not normally work.
|
||||||
|
|
||||||
To avoid the installation of the complete ESP-IDF SDK, for example, because
|
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.
|
||||||
RIOT Docker build image 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
|
It is also possible to use your own version of `esptool.py` by overriding
|
||||||
`esptool.py` depends on `pySerial` which can be installed either
|
the make variable `ESPTOOL` in the command line, for example:
|
||||||
using `pip`
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
$ sudo pip3 install pyserial
|
$ ESPTOOL=/path/to/esptool.py make flash BOARD=...
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
or the package manager of your OS, for example on Debian/Ubuntu systems:
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
$ apt install python3-serial
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
For more information on `esptool.py`, please refer to the
|
For more information on `esptool.py`, please refer to the
|
||||||
|
|||||||
@ -5,6 +5,7 @@ ifneq (,$(filter qout qio,$(FLASH_MODE)))
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
ESPTOOL ?= $(RIOTTOOLS)/esptools/esptool.py
|
ESPTOOL ?= $(RIOTTOOLS)/esptools/esptool.py
|
||||||
|
ESPTOOL_FLASH ?= $(ESPTOOL)
|
||||||
|
|
||||||
# flasher configuration
|
# flasher configuration
|
||||||
ifneq (,$(filter esp_qemu,$(USEMODULE)))
|
ifneq (,$(filter esp_qemu,$(USEMODULE)))
|
||||||
@ -13,7 +14,7 @@ ifneq (,$(filter esp_qemu,$(USEMODULE)))
|
|||||||
FLASHDEPS += esp-qemu
|
FLASHDEPS += esp-qemu
|
||||||
else
|
else
|
||||||
PROGRAMMER_SPEED ?= 460800
|
PROGRAMMER_SPEED ?= 460800
|
||||||
FLASHER = $(ESPTOOL)
|
FLASHER = $(ESPTOOL_FLASH)
|
||||||
FFLAGS += --chip $(FLASH_CHIP) --port $(PROG_DEV) --baud $(PROGRAMMER_SPEED)
|
FFLAGS += --chip $(FLASH_CHIP) --port $(PROG_DEV) --baud $(PROGRAMMER_SPEED)
|
||||||
FFLAGS += --before default_reset write_flash -z
|
FFLAGS += --before default_reset write_flash -z
|
||||||
FFLAGS += --flash_mode $(FLASH_MODE) --flash_freq $(FLASH_FREQ)
|
FFLAGS += --flash_mode $(FLASH_MODE) --flash_freq $(FLASH_FREQ)
|
||||||
@ -21,9 +22,10 @@ else
|
|||||||
FFLAGS += $(BOOTLOADER_POS) $(BOOTLOADER_BIN)
|
FFLAGS += $(BOOTLOADER_POS) $(BOOTLOADER_BIN)
|
||||||
FFLAGS += 0x8000 $(BINDIR)/partitions.bin
|
FFLAGS += 0x8000 $(BINDIR)/partitions.bin
|
||||||
FFLAGS += $(FLASHFILE_POS) $(FLASHFILE)
|
FFLAGS += $(FLASHFILE_POS) $(FLASHFILE)
|
||||||
|
FLASHDEPS += esptool_flash
|
||||||
endif
|
endif
|
||||||
|
|
||||||
.PHONY: esp-qemu
|
.PHONY: esp-qemu esptool_flash clean
|
||||||
|
|
||||||
esp-qemu: $(FLASHFILE)
|
esp-qemu: $(FLASHFILE)
|
||||||
ifeq (esp32,$(CPU))
|
ifeq (esp32,$(CPU))
|
||||||
@ -51,6 +53,12 @@ else
|
|||||||
head -c $(FLASH_SIZE)MB > $(BINDIR)/$(CPU)flash.bin && rm tmp.bin
|
head -c $(FLASH_SIZE)MB > $(BINDIR)/$(CPU)flash.bin && rm tmp.bin
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
esptool_flash: $(PKGDIRBASE)/esptool/venv_flash/bin/esptool.py
|
||||||
|
|
||||||
|
$(PKGDIRBASE)/esptool/venv_flash/bin/esptool.py:
|
||||||
|
python3 -m venv $(PKGDIRBASE)/esptool/venv_flash
|
||||||
|
$(PKGDIRBASE)/esptool/venv_flash/bin/pip install esptool
|
||||||
|
|
||||||
# reset tool configuration
|
# reset tool configuration
|
||||||
RESET ?= $(RIOTTOOLS)/esptools/espreset.py
|
RESET ?= $(RIOTTOOLS)/esptools/espreset.py
|
||||||
RESET_FLAGS ?= --port $(PROG_DEV)
|
RESET_FLAGS ?= --port $(PROG_DEV)
|
||||||
|
|||||||
16
pkg/esptool/Makefile
Normal file
16
pkg/esptool/Makefile
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
PKG_NAME=esptool
|
||||||
|
PKG_URL=https://github.com/espressif/esptool
|
||||||
|
# esptool v4.9.0
|
||||||
|
PKG_VERSION=8c3e3bf5d4292f1451744a838b2e60f50aa02b3c
|
||||||
|
PKG_LICENSE=GPLv2
|
||||||
|
|
||||||
|
include $(RIOTBASE)/pkg/pkg.mk
|
||||||
|
|
||||||
|
all: $(PKG_SOURCE_DIR)/venv/bin/esptool.py
|
||||||
|
|
||||||
|
clean::
|
||||||
|
rm -rf $(PKG_SOURCE_DIR)/venv*
|
||||||
|
|
||||||
|
$(PKG_SOURCE_DIR)/venv/bin/esptool.py:
|
||||||
|
python3 -m venv $(PKG_SOURCE_DIR)/venv
|
||||||
|
$(PKG_SOURCE_DIR)/venv/bin/pip install esptool
|
||||||
1
pkg/esptool/Makefile.include
Normal file
1
pkg/esptool/Makefile.include
Normal file
@ -0,0 +1 @@
|
|||||||
|
PSEUDOMODULES += esptool
|
||||||
Loading…
x
Reference in New Issue
Block a user