SDK – ESP8266 – Xtensa architecture toolchain
Informatie (ENG)
The Xtensa processor architecture is a configurable, extensible, and synthesizable 32-bit RISC processor core. Processor and SOC vendors can select from various processor options and even create customized instructions in addition to a base ISA to tailor the processor for a particular application.
esp-open-sdk
This repository provides the integration scripts to build a complete standalone SDK (with toolchain) for software development with the Espressif ESP8266 and ESP8266EX chips.
The complete SDK consists of:
- Xtensa lx106 architecture toolchain (100% OpenSource), based on following projects:
The source code above originates from work done directly by Tensilica Inc., Cadence Design Systems, Inc, and/or their contractors.
- ESP8266 IoT SDK from Espressif Systems. This component is only partially open source, (some libraries are provided as binary blobs).
OpenSource components of the SDK are based on:
- lwIP, http://savannah.nongnu.org/projects/lwip/
- Contiki, http://www.contiki-os.org/
- axTLS, http://axtls.sourceforge.net/
- wpa_supplicant, http://w1.fi/wpa_supplicant/ (source withheld by Espressif)
- net80211/ieee80211 (FreeBSD WiFi stack), http://www.unix.com/man-page/freebsd/9/NET80211 (source withheld by Espressif)
Requirements and Dependencies
To build the standalone SDK and toolchain, you need a GNU/POSIX system (Linux, BSD, MacOSX, Windows with Cygwin) with the standard GNU development tools installed: gcc, binutils, flex, bison, etc.
Please make sure that the machine you use to build the toolchain has at least 1G free RAM+swap (or more, which will speed up the build).
Debian/Ubuntu
Ubuntu 14.04:
1 2 3 4 |
$ sudo apt-get install make unrar autoconf automake libtool gcc g++ gperf \ flex bison texinfo gawk ncurses-dev libexpat-dev python python-serial sed \ git |
Later Debian/Ubuntu versions may require:
1 2 |
$ sudo apt-get install libtool-bin |
MacOS:
1 2 3 |
$ brew tap homebrew/dupes $ brew install binutils coreutils automake wget gawk libtool gperf gnu-sed --with-default-names grep $ <span class="pl-k">export</span> PATH=<span class="pl-s"><span class="pl-pds">"</span>/usr/local/opt/gnu-sed/libexec/gnubin:<span class="pl-smi">$PATH</span><span class="pl-pds">"</span></span> |
In addition to the development tools MacOS needs a case-sensitive filesystem. You might need to create a virtual disk and build esp-open-sdk on it:
1 2 3 |
$ sudo hdiutil create <span class="pl-k">~</span>/Documents/case-sensitive.dmg -volname <span class="pl-s"><span class="pl-pds">"</span>case-sensitive<span class="pl-pds">"</span></span> -size 10g -fs <span class="pl-s"><span class="pl-pds">"</span>Case-sensitive HFS+<span class="pl-pds">"</span></span> $ sudo hdiutil mount <span class="pl-k">~</span>/Documents/case-sensitive.dmg $ <span class="pl-c1">cd</span> /Volumes/case-sensitive |
Building
Be sure to clone recursively:
1 2 |
$ git clone --recursive https://github.com/pfalcon/esp-open-sdk.git |
The project can be built in two modes:
- Where the toolchain and tools are kept separate from the vendor IoT SDK which contains binary blobs. This makes licensing more clear, and helps facilitate upgrades to vendor SDK releases.
- A completely standalone ESP8266 SDK with the vendor SDK files merged into the toolchain. This mode makes it easier to build software (no additinal
-I
and-L
flags are needed), but redistributability of this build is unclear and upgrades to newer vendor IoT SDK releases are complicated. This mode is default for local builds. Note that if you want to redistribute the binary toolchain built with this mode, you should:- Make it clear to your users that the release is bound to a particular vendor IoT SDK and provide instructions how to upgrade to a newer vendor IoT SDK releases.
- Abide by licensing terms of the vendor IoT SDK.
To build the separated SDK:
1 2 |
$ make STANDALONE=n |
To build the standalone SDK:
1 2 |
$ make STANDALONE=y |
This will download all necessary components and compile them. Once done, the toolchain (with the Xtensa HAL library) will be available in the xtensa-lx106-elf/
directory. Add its bin/
subdirectory to your $PATH
to execute xtensa-lx106-elf-gcc
and other tools.
ESP8266 SDK will be installed in sdk/
. If you chose the non-standalone SDK, run the compiler with the corresponding include and lib dir flags:
1 2 |
$ xtensa-lx106-elf-gcc -I$(THISDIR)/sdk/include -L$(THISDIR)/sdk/lib |
The extra -I and -L flags are not needed when using the standalone SDK.
Pulling updates
The project is updated from time to time, to get updates and prepare to build a new SDK, run:
1 2 3 4 5 |
$ make clean $ git pull $ git submodule sync $ git submodule update |
If you don’t issue make clean
(which causes toolchain and SDK to be rebuilt from scratch on next make
), you risk getting broken/inconsistent results.
Additional configuration
You can build a statically linked toolchain by uncommenting CT_STATIC_TOOLCHAIN=y
in the file crosstool-config-overrides
. More fine-tunable options may be available in that file and/or Makefile.
Download esp-open-sdk @ github.com
Download xtensa-lx106-elf toolchain @ drive.google.com
Download xtensa-lx106-elf toolchain @ drive.google.com
[#/esp/software/toolchain/xtensa-lx106″ ]