Skip to content

Commit

Permalink
ESP32 precompiled toolchain (#2730)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
devsaurus authored Apr 22, 2019
1 parent 386cd9d commit 13735b7
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ sdkconfig.old*
build/
app/
components/*/.output/
tools/toolchains

#ignore Eclipse project files
.cproject
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -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
Expand Down
27 changes: 24 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 0 additions & 1 deletion tools/toolchains
Submodule toolchains deleted from 3f4f38

0 comments on commit 13735b7

Please sign in to comment.