From 13735b72289222ef1f5694cee807e292bdbfbd4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnim=20L=C3=A4uger?= Date: Mon, 22 Apr 2019 14:45:27 +0200 Subject: [PATCH] ESP32 precompiled toolchain (#2730) * remove toolchains submodule * remove toolchains dir * download precompiled toolchain from https://github.com/jmattsson/esp-toolchains/releases * remove toolchain target delete toolchain with clean target * avoid bash syntax --- .gitignore | 1 + .gitmodules | 3 --- Makefile | 27 ++++++++++++++++++++++++--- tools/toolchains | 1 - 4 files changed, 25 insertions(+), 7 deletions(-) delete mode 160000 tools/toolchains diff --git a/.gitignore b/.gitignore index f3a76626..cd04f50d 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ sdkconfig.old* build/ app/ components/*/.output/ +tools/toolchains #ignore Eclipse project files .cproject diff --git a/.gitmodules b/.gitmodules index 6ef2b33e..b467ca68 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "toolchains"] - path = tools/toolchains - url = https://github.com/jmattsson/nodemcu-prebuilt-toolchains.git [submodule "sdk/esp32-esp-idf"] path = sdk/esp32-esp-idf url = https://github.com/espressif/esp-idf.git diff --git a/Makefile b/Makefile index 8e4e22df..79504893 100644 --- a/Makefile +++ b/Makefile @@ -5,10 +5,31 @@ ifeq ($(IDF_PATH),) THIS_MK_FILE:=$(notdir $(lastword $(MAKEFILE_LIST))) THIS_DIR:=$(abspath $(dir $(lastword $(MAKEFILE_LIST)))) IDF_PATH=$(THIS_DIR)/sdk/esp32-esp-idf -all: -%: + +TOOLCHAIN_VERSION:=20181106.0 +PLATFORM:=linux-x86_64 + +ESP32_BIN:=$(THIS_DIR)/tools/toolchains/esp32-$(PLATFORM)-$(TOOLCHAIN_VERSION)/bin +ESP32_GCC:=$(ESP32_BIN)/xtensa-esp32-elf-gcc +ESP32_TOOLCHAIN_DL:=$(THIS_DIR)/cache/toolchain-esp32-$(PLATFORM)-$(TOOLCHAIN_VERSION).tar.xz + +all: | $(ESP32_GCC) +%: | $(ESP32_GCC) @echo Setting IDF_PATH and re-invoking... - @env IDF_PATH=$(IDF_PATH) PATH=$(PATH):$(THIS_DIR)/tools/toolchains/esp32/bin/ $(MAKE) -f $(THIS_MK_FILE) $@ + @env IDF_PATH=$(IDF_PATH) PATH=$(PATH):$(ESP32_BIN) $(MAKE) -f $(THIS_MK_FILE) $@ + @if test "$@" = "clean"; then rm -rf $(THIS_DIR)/tools/toolchains/esp32-*; fi + +$(ESP32_GCC): $(ESP32_TOOLCHAIN_DL) + @echo Uncompressing toolchain + @mkdir -p $(THIS_DIR)/tools/toolchains/ + @tar -xJf $< -C $(THIS_DIR)/tools/toolchains/ + # the archive contains ro files + @chmod -R u+w $(THIS_DIR)/tools/toolchains/esp32-* + @touch $@ + +$(ESP32_TOOLCHAIN_DL): + @mkdir -p $(THIS_DIR)/cache + wget --tries=10 --timeout=15 --waitretry=30 --read-timeout=20 --retry-connrefused https://github.com/jmattsson/esp-toolchains/releases/download/$(PLATFORM)-$(TOOLCHAIN_VERSION)/toolchain-esp32-$(PLATFORM)-$(TOOLCHAIN_VERSION).tar.xz -O $@ || { rm -f "$@"; exit 1; } else diff --git a/tools/toolchains b/tools/toolchains deleted file mode 160000 index 3f4f3890..00000000 --- a/tools/toolchains +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3f4f3890f97fe01870770dd5a624ee0823d71a13