Skip to content

Building firmware for ESP8266

faa edited this page Apr 28, 2016 · 5 revisions

###Parts

  • ESP8266
  • FTDI Breakout Board
  • Mini USB cable
  • Jumper Wires
  • BreadBoard

###Hardware Setup

  1. Set the VCC on the FTDI Breakout Board to 3.3V

  2. Attach the Mini USB cable to the FTDI Breakout Board

  3. Connect the ESP8266 and FTDI Breakout Board as shown below:

ESP8266 ---- FTDI Breakout Board
VCC          +3.3V
CH_PD        +3.3V
TX           RX
RX           TX
GPIO 0       GND
GND          GND

###Software Installation

####Linux

Follow the instructions here: https://github.com/pfalcon/esp-open-sdk

Run it as make STANDALONE=y

####OS X

Follow the Linux instructions above, but when you get this error:

[ERROR]    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:1827:38: error: use of undeclared identifier 'ptrdiff_t'
[ERROR]    fatal error: too many errors emitted, stopping now [-ferror-limit=]
[ERROR]    make[4]: *** [graphite-blocking.o] Error 1
[ERROR]    make[4]: *** [graphite.o] Error 1
[ERROR]    make[4]: *** [graphite-clast-to-gimple.o] Error 1
[ERROR]    make[3]: *** [all-gcc] Error 2
[ERROR]
[ERROR]  >>
[ERROR]  >>  Build failed in step 'Installing pass-2 core C compiler'
[ERROR]  >>        called in step '(top-level)'

Run the following:

$ sed -i '/__need_size_t/d' ./crosstool-NG/.build/src/gmp-5.1.3/gmp-h.in

Retry make:

$ make STANDALONE=y

After a successful installation, set the toolchain to your path:

$ export PATH=/Volumes/case-sensitive/esp-open-sdk/xtensa-lx106-elf/bin:$PATH

###Building Blinky - A Community Example

Before we build the example, set the environment path by opening a new Terminal window and typing in the following commands:

export PATH=/Volumes/case-sensitive/esp-open-sdk/xtensa-lx106-elf/bin:$PATH
export XTENSA_TOOLS_ROOT=/Volumes/case-sensitive/esp-open-sdk/xtensa-lx106-elf/bin
export SDK_BASE=/Volumes/case-sensitive/esp-open-sdk/esp_iot_sdk_v1.5.2

Clone and build the example using the following commands:

git clone https://github.com/esp8266/source-code-examples/blinky.git
cd blinky
make

####Flashing

Connect the USB cable to your USB port, and find out which port it's connected to:

ls /dev/tty.*

Type in the following command to upload the example onto the esp8266:

  • Make sure ESPPORT is equal to the port found using the previous command. If you see more than one, disconnect the USB cable and then type the command again to find out which port it was connected to.
make ESPPORT=/dev/tty flash

Nice Work! You can now flash code onto the esp8266.

Clone this wiki locally