Skip to content

Commit 8bb41fe

Browse files
ryanplusplusJohny Mattsson
authored andcommitted
Download pre-built toolchains (#2545)
* Download pre-built toolchains * Updated to include the platform in the name of the pre-built toolchain * Download archive into cache/ * Update Travis configuration to use pre-built toolchain via make
1 parent 2d95875 commit 8bb41fe

File tree

4 files changed

+27
-9
lines changed

4 files changed

+27
-9
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ server-ca.crt
88
luac.cross
99
uz_unzip
1010
uz_zip
11+
tools/toolchains/
1112

1213
#ignore Eclipse project files
1314
.cproject

.travis.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ addons:
77
cache:
88
- directories:
99
- cache
10-
install:
11-
- tar -Jxvf tools/esp-open-sdk.tar.xz
12-
- export PATH=$PATH:$PWD/esp-open-sdk/xtensa-lx106-elf/bin
1310
script:
1411
- export BUILD_DATE=$(date +%Y%m%d)
1512
- make EXTRA_CCFLAGS="-DBUILD_DATE='\"'$BUILD_DATE'\"'" all

Makefile

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#
33
.NOTPARALLEL:
44

5+
TOOLCHAIN_VERSION:=20181106.0
6+
57
# SDK base version, as released by Espressif
68
SDK_BASE_VER:=2.2.1
79

@@ -47,7 +49,7 @@ ifeq ($(OS),Windows_NT)
4749
OBJCOPY = xt-objcopy
4850
#MAKE = xt-make
4951
CCFLAGS += --rename-section .text=.irom0.text --rename-section .literal=.irom0.literal
50-
else
52+
else
5153
# It is gcc, may be cygwin
5254
# Can we use -fdata-sections?
5355
CCFLAGS += -ffunction-sections -fno-jump-tables -fdata-sections
@@ -73,11 +75,13 @@ ifeq ($(OS),Windows_NT)
7375
else
7476
# We are under other system, may be Linux. Assume using gcc.
7577
# Can we use -fdata-sections?
78+
PLATFORM:=linux-x86_64
7679
ifndef COMPORT
7780
ESPPORT = /dev/ttyUSB0
7881
else
7982
ESPPORT = $(COMPORT)
8083
endif
84+
export PATH := $(PATH):$(TOP_DIR)/tools/toolchains/esp8266-$(PLATFORM)-$(TOOLCHAIN_VERSION)/bin/
8185
CCFLAGS += -ffunction-sections -fno-jump-tables -fdata-sections
8286
AR = xtensa-lx106-elf-ar
8387
CC = $(WRAPCC) xtensa-lx106-elf-gcc
@@ -145,9 +149,9 @@ endif
145149
endif
146150

147151
#
148-
# Note:
152+
# Note:
149153
# https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
150-
# If you add global optimize options like "-O2" here
154+
# If you add global optimize options like "-O2" here
151155
# they will override "-Os" defined above.
152156
# "-Os" should be used to reduce code size
153157
#
@@ -161,7 +165,7 @@ CCFLAGS += \
161165
-nostdlib \
162166
-mlongcalls \
163167
-mtext-section-literals
164-
# -Wall
168+
# -Wall
165169

166170
CFLAGS = $(CCFLAGS) $(DEFINES) $(EXTRA_CCFLAGS) $(STD_CFLAGS) $(INCLUDES)
167171
DFLAGS = $(CCFLAGS) $(DDEFINES) $(EXTRA_CCFLAGS) $(STD_CFLAGS) $(INCLUDES)
@@ -191,7 +195,7 @@ DEP_LIBS_$(1) = $$(foreach lib,$$(filter %.a,$$(COMPONENTS_$(1))),$$(dir $$(lib)
191195
DEP_OBJS_$(1) = $$(foreach obj,$$(filter %.o,$$(COMPONENTS_$(1))),$$(dir $$(obj))$$(OBJODIR)/$$(notdir $$(obj)))
192196
$$(IMAGEODIR)/$(1).out: $$(OBJS) $$(DEP_OBJS_$(1)) $$(DEP_LIBS_$(1)) $$(DEPENDS_$(1))
193197
@mkdir -p $$(IMAGEODIR)
194-
$$(CC) $$(LDFLAGS) $$(if $$(LINKFLAGS_$(1)),$$(LINKFLAGS_$(1)),$$(LINKFLAGS_DEFAULT) $$(OBJS) $$(DEP_OBJS_$(1)) $$(DEP_LIBS_$(1))) -o $$@
198+
$$(CC) $$(LDFLAGS) $$(if $$(LINKFLAGS_$(1)),$$(LINKFLAGS_$(1)),$$(LINKFLAGS_DEFAULT) $$(OBJS) $$(DEP_OBJS_$(1)) $$(DEP_LIBS_$(1))) -o $$@
195199
endef
196200

197201
$(BINODIR)/%.bin: $(IMAGEODIR)/%.out
@@ -204,16 +208,32 @@ $(BINODIR)/%.bin: $(IMAGEODIR)/%.out
204208
# Should be done in top-level makefile only
205209
#
206210

207-
all: sdk_pruned pre_build .subdirs $(OBJS) $(OLIBS) $(OIMAGES) $(OBINS) $(SPECIAL_MKTARGETS)
211+
all: toolchain sdk_pruned pre_build .subdirs $(OBJS) $(OLIBS) $(OIMAGES) $(OBINS) $(SPECIAL_MKTARGETS)
208212

209213
.PHONY: sdk_extracted
210214
.PHONY: sdk_patched
211215
.PHONY: sdk_pruned
216+
.PHONY: toolchain
212217

213218
sdk_extracted: $(TOP_DIR)/sdk/.extracted-$(SDK_BASE_VER)
214219
sdk_patched: sdk_extracted $(TOP_DIR)/sdk/.patched-$(SDK_VER)
215220
sdk_pruned: $(SDK_DIR_DEPENDS) $(TOP_DIR)/sdk/.pruned-$(SDK_VER)
216221

222+
ifeq ($(OS),Windows_NT)
223+
toolchain:
224+
else
225+
toolchain: $(TOP_DIR)/tools/toolchains/esp8266-$(PLATFORM)-$(TOOLCHAIN_VERSION)/bin/xtensa-lx106-elf-gcc
226+
227+
$(TOP_DIR)/tools/toolchains/esp8266-$(PLATFORM)-$(TOOLCHAIN_VERSION)/bin/xtensa-lx106-elf-gcc: $(TOP_DIR)/cache/toolchain-esp8266-$(PLATFORM)-$(TOOLCHAIN_VERSION).tar.xz
228+
mkdir -p $(TOP_DIR)/tools/toolchains/
229+
tar -xJf $< -C $(TOP_DIR)/tools/toolchains/
230+
touch $@
231+
232+
$(TOP_DIR)/cache/toolchain-esp8266-$(PLATFORM)-$(TOOLCHAIN_VERSION).tar.xz:
233+
mkdir -p $(TOP_DIR)/cache
234+
wget --tries=10 --timeout=15 --waitretry=30 --read-timeout=20 --retry-connrefused https://github.com/jmattsson/esp-toolchains/releases/download/$(PLATFORM)-$(TOOLCHAIN_VERSION)/toolchain-esp8266-$(PLATFORM)-$(TOOLCHAIN_VERSION).tar.xz -O $@ || { rm -f "$@"; exit 1; }
235+
endif
236+
217237
$(TOP_DIR)/sdk/.extracted-$(SDK_BASE_VER): $(TOP_DIR)/cache/v$(SDK_FILE_VER).zip
218238
mkdir -p "$(dir $@)"
219239
(cd "$(dir $@)" && rm -fr esp_iot_sdk_v$(SDK_VER) ESP8266_NONOS_SDK-$(SDK_BASE_VER) && unzip $(TOP_DIR)/cache/v$(SDK_FILE_VER).zip ESP8266_NONOS_SDK-$(SDK_BASE_VER)/lib/* ESP8266_NONOS_SDK-$(SDK_BASE_VER)/ld/eagle.rom.addr.v6.ld ESP8266_NONOS_SDK-$(SDK_BASE_VER)/include/* ESP8266_NONOS_SDK-$(SDK_BASE_VER)/bin/esp_init_data_default_v05.bin)

tools/esp-open-sdk.tar.xz

-11 MB
Binary file not shown.

0 commit comments

Comments
 (0)