Skip to content

Commit 6ee084a

Browse files
committed
Bump ESP8266 target to SDK v2.1.0
Until now, the ESP8266 target used a non-tagged git hash revision of the RTOS SDK (from Oct 2017). Moreover, the compiler was also a custom-built gcc. This commit sets the RTOS SDK version to v2.1.0, released Oct 2018, which is the latest old-style SDK for ESP. The commit also changes the used gcc to an Espressif-provided pre-built toolchain, which is tagged for the (latest) v3.0.1 SDK release. (The SDK bump is not to the latest SDK version because the new v3.x line of the SDK is "ESP-IDF style", which is incompatible with the current target code base. On the other hand, the toolchain comes from the latest SDK release because the v2.x line had no pre-built toolchain suggestions -- but it builds v2.x sources correctly.) JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
1 parent adb80c2 commit 6ee084a

File tree

4 files changed

+36
-71
lines changed

4 files changed

+36
-71
lines changed

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,11 @@ matrix:
122122
- '${HOME}/.sonar/cache'
123123

124124
- name: "ESP8266 Build Test"
125-
cache: ccache
126125
install: make -f ./targets/esp8266/Makefile.travis install-noapt
127126
script: make -f ./targets/esp8266/Makefile.travis script
128127
addons:
129128
apt:
130-
packages: [gperf, texinfo, wget]
129+
packages: [wget]
131130

132131
- name: "Mbed OS 5/K64F Build Test"
133132
addons:

targets/esp8266/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ LDDIR = $(SDK_PATH)/ld
5050
# so we use it instead of the original one from SDK.
5151
JERRY_LD_FILE = $(CURDIR)/ld/eagle.app.v6.ld
5252

53-
CCFLAGS += -Os
53+
CCFLAGS += -Os -std=c99
5454
#CCFLAGS += -O0
5555

5656
TARGET_LDFLAGS = \
@@ -91,7 +91,6 @@ LINKFLAGS_eagle.app.v6 = \
9191
-llwip \
9292
-ldriver \
9393
-lmain \
94-
-lmesh \
9594
-lmirom \
9695
-lnet80211 \
9796
-lnopoll \

targets/esp8266/Makefile.travis

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,16 @@ all:
2323

2424
# Install tools via apt.
2525
install-apt-get-deps:
26-
sudo apt-get install -q -y gperf texinfo wget
26+
sudo apt-get install -q -y wget
2727

2828
# Fetch and build crosstool-NG with support for Xtensa.
2929
install-xtensa-kx106-gcc:
30-
git clone https://github.com/jcmvbkbc/crosstool-NG.git ../crosstool-NG -b lx106-g++-1.21.0
31-
cd ../crosstool-NG && ./bootstrap
32-
cd ../crosstool-NG && ./configure --enable-local
33-
$(MAKE) -C ../crosstool-NG --no-print-directory -Rr # HACK: without the command line arguments, make bails out with recursion error
34-
cd ../crosstool-NG && ./ct-ng xtensa-lx106-elf
35-
cd ../crosstool-NG && ./ct-ng build
30+
wget https://dl.espressif.com/dl/xtensa-lx106-elf-linux64-1.22.0-88-gde0bdc1-4.8.5.tar.gz -O ../xtensa-lx106-elf-linux64-1.22.0-88-gde0bdc1-4.8.5.tar.gz
31+
cd .. && tar xvfz xtensa-lx106-elf-linux64-1.22.0-88-gde0bdc1-4.8.5.tar.gz
3632

3733
# Fetch Espressif SDK and Xtensa libraries.
3834
install-espressif-sdk:
39-
git clone https://github.com/espressif/ESP8266_RTOS_SDK.git ../ESP8266_SDK
40-
cd ../ESP8266_SDK && git checkout 2fab9e23d779cdd6e5900b8ba2b588e30d9b08c4
41-
wget https://github.com/esp8266/esp8266-wiki/raw/master/libs/libhal.a -O ../ESP8266_SDK/lib/libhal.a
35+
git clone https://github.com/espressif/ESP8266_RTOS_SDK.git ../ESP8266_RTOS_SDK -b v2.1.0
4236

4337
# Perform all the necessary (JerryScript-independent) installation steps.
4438
install-noapt: install-xtensa-kx106-gcc install-espressif-sdk
@@ -49,4 +43,4 @@ install: install-apt-get-deps install-noapt
4943

5044
# Build the firmware (ESP8266 with JerryScript).
5145
script:
52-
PATH=$(CURDIR)/../crosstool-NG/builds/xtensa-lx106-elf/bin:$$PATH $(MAKE) -f ./targets/esp8266/Makefile.esp8266 BIN_PATH=build/obj-esp8266 SDK_PATH=$(CURDIR)/../ESP8266_SDK
46+
PATH=$(CURDIR)/../xtensa-lx106-elf/bin:$$PATH $(MAKE) -f ./targets/esp8266/Makefile.esp8266 BIN_PATH=build/obj-esp8266 SDK_PATH=$(CURDIR)/../ESP8266_RTOS_SDK

targets/esp8266/docs/ESP-PREREQUISITES.md

Lines changed: 29 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -9,84 +9,57 @@ You need,
99
* 5V 2A adaptor
1010
* USB to RS-232 Serial + RS-232 Serial to Digital or USB-to-RS232 TTL converter
1111

12-
#### Toolchain
12+
#### Tools
1313

14-
Reference [Toolchain](https://github.com/esp8266/esp8266-wiki/wiki/Toolchain) page.
14+
The rest of this document will assume that you download all necessary tools into
15+
a common directory structure. For the sake of simplicity, `$HOME/Espressif` will
16+
be used as the root of this structure. Feel free to deviate from this but then
17+
adapt all the paths accordingly.
1518

16-
I've slightly changed the step to use SDK from Espressif official SDK
17-
(https://github.com/espressif/esp_iot_rtos_sdk)
18-
19-
##### Toolchain:
20-
21-
dependencies
2219
```
23-
sudo apt-get install git autoconf build-essential gperf \
24-
bison flex texinfo libtool libtool-bin libncurses5-dev wget \
25-
gawk python-serial libexpat-dev
26-
sudo mkdir /opt/Espressif
27-
sudo chown $USER /opt/Espressif/
28-
20+
mkdir $HOME/Espressif
2921
```
3022

31-
dependency specific to x86:
32-
```
33-
sudo apt-get install libc6-dev-i386
34-
```
23+
##### Toolchain
3524

36-
dependency specific to x64:
37-
```
38-
sudo apt-get install libc6-dev-amd64
39-
```
25+
Download the [toolchain](https://github.com/espressif/ESP8266_RTOS_SDK/tree/v3.0.1#get-toolchain)
26+
pre-built for your development platform to `$HOME/Espressif` and untar it. E.g.,
27+
on Linux/x86-64:
4028

41-
crosstool-NG
42-
```
43-
cd /opt/Espressif
44-
git clone -b lx106-g++-1.21.0 git://github.com/jcmvbkbc/crosstool-NG.git
45-
cd crosstool-NG
46-
./bootstrap && ./configure --prefix=`pwd` && make && make install
47-
./ct-ng xtensa-lx106-elf
48-
./ct-ng build
49-
```
50-
add path to environment file such as `.profile`
5129
```
52-
PATH=$PWD/builds/xtensa-lx106-elf/bin:$PATH
30+
cd $HOME/Espressif
31+
tar xvfz xtensa-lx106-elf-linux64-1.22.0-88-gde0bdc1-4.8.5.tar.gz
5332
```
5433

5534
##### Espressif SDK: use Espressif official
5635

5736
```
58-
cd /opt/Esprissif
59-
git clone https://github.com/espressif/ESP8266_RTOS_SDK.git ESP8266_RTOS_SDK.git
60-
ln -s ESP8266_RTOS_SDK.git ESP8266_SDK
61-
git checkout -b jerry 2fab9e23d779cdd6e5900b8ba2b588e30d9b08c4
37+
cd $HOME/Esprissif
38+
git clone https://github.com/espressif/ESP8266_RTOS_SDK.git -b v2.1.0
6239
```
6340

64-
This verison is tested and works properly.
65-
66-
set two environment variables such as in .profile
67-
```
68-
export SDK_PATH=/opt/Espressif/ESP8266_SDK
69-
export BIN_PATH=(to output folder path)
70-
```
71-
72-
##### Xtensa libraries and headers:
73-
```
74-
cd /opt/Espressif/ESP8266_SDK
75-
wget -O lib/libhal.a https://github.com/esp8266/esp8266-wiki/raw/master/libs/libhal.a
76-
```
41+
This version is tested and works properly.
7742

7843
##### ESP image tool
7944
```
80-
cd /opt/Espressif
45+
cd $HOME/Espressif
8146
wget -O esptool_0.0.2-1_i386.deb https://github.com/esp8266/esp8266-wiki/raw/master/deb/esptool_0.0.2-1_i386.deb
8247
sudo dpkg -i esptool_0.0.2-1_i386.deb
8348
```
8449

8550
##### ESP upload tool
8651
```
87-
cd /opt/Espressif
88-
git clone https://github.com/themadinventor/esptool esptool-py
89-
sudo ln -s $PWD/esptool-py/esptool.py crosstool-NG/builds/xtensa-lx106-elf/bin/esptool.py
52+
cd $HOME/Espressif
53+
git clone https://github.com/themadinventor/esptool
54+
```
55+
56+
##### Set environment variables
57+
58+
Set environment variables, might also go in your `.profile`:
59+
```
60+
export PATH=$HOME/Espressif/xtensa-lx106-elf/bin:$PATH
61+
export SDK_PATH=$HOME/Espressif/ESP8266_RTOS_SDK
62+
export BIN_PATH=(to output folder path)
9063
```
9164

9265
#### Test writing with Blinky example
@@ -122,7 +95,7 @@ make BOOT=new APP=0 SPI_SPEED=80 SPI_MODE=QIO SPI_SIZE_MAP=2
12295
* write
12396

12497
```
125-
sudo /opt/Espressif/esptool-py/esptool.py \
98+
sudo $HOME/Espressif/esptool/esptool.py \
12699
--port /dev/ttyUSB0 write_flash \
127100
0x00000 $SDK_PATH/bin/"boot_v1.7.bin" \
128101
0x01000 $BIN_PATH/upgrade/user1.2048.new.5.bin \
@@ -135,7 +108,7 @@ _change `/dev/ttyUSB1` to whatever you have._
135108
or the old way...this works not sure this is ok.
136109
```
137110
cd $BIN_PATH
138-
sudo /opt/Espressif/esptool-py/esptool.py \
111+
sudo $HOME/Espressif/esptool/esptool.py \
139112
--port /dev/ttyUSB0 write_flash \
140113
0x00000 eagle.flash.bin 0x40000 eagle.irom0text.bin
141114
```

0 commit comments

Comments
 (0)