Skip to content

Setting up the ESP8266 Open SDK

It seems that a large part of the ESP8266 community has moved to the esp-open-sdk toolchain. And for a reason: the esp-open-sdk is much easier to install and update. Besides that, the esp-open-sdk replaes many of the proprietary libraries with open source versions.

Just as an exercise, I decided to give this toolchain a try as well, starting with a bare Ubuntu 14.04 (server) installation as its foundation again. It was my goal to make the same blinky run, but this time through the use of the esp-open-sdk toolchain.

Setup

Please find the steps to get the toolchain installed below:

The installation of the toolchain is much easier and has less steps, but be warned that it still takes a long time to install.

Updating

Updating is simple:

Making the toolchain directory clean is important. 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.

Run Blinky

To install the blinky demo firmware, the esp8266 can be pulled. However, it assumes that the Espressif SDK is installed in the Espressif directory, as described in my previous esp8266 blog post. However, the sample should be using the open SDK instead. That’s why a few additional sed statements should be issued, changing the Espressif paths to the open SDK paths.

Before you can upload anything, you need to have access to the serial port to do so. The serial port device (/dev/ttyUSB0) has the group of dialout. All you need to do grant yourself access to the serial port is to add yourself to the dialout group:

Development board esp8266After getting access to the serial port, the sketch that has just been built can be uploaded to the ESP8266 chip. To get the board in “upload mode”, the board should be booted while GPIO0 is grounded. On the development board (right, click for larger view) this can be very easily achieved by keeping the GPIO0 pushbutton (top-leftmost button pressed, while pressing the reset-button (bottom-left-most button). Shortly after the reset-button has been released, the GPIO0 button can also be released again. The sketch can then be uploaded using:

After the upload had completed, the ESP8266 should be toggling GPIO2 again, getting the led to blink slowly.

Published inTechnoblog

26 Comments

  1. Philippe Philippe

    I created two new clean Ubuntu 14.04.2 LTS virtual machines using vmware workstation 11. One is a 32-bit and the other one is a 64-bit. Both have 2GB RAM and 2 cores assigned.
    They both succeed to build the esp-open-sdk chain. I followed your instructions.
    Did nothing else except apt-get update/upgrade before building the toolchain.

    However when building the Blinky sample I get:

    philippe@ubuntu:/opt/esp-open-sdk/source-code-examples/blinky$ make clean
    philippe@ubuntu:/opt/esp-open-sdk/source-code-examples/blinky$ make
    CC user/user_main.c
    AR build/app_app.a
    LD build/app.out
    FW firmware/0x00000.bin
    make: /usr/bin/esptool: Command not found
    make: *** [firmware/0x00000.bin] Error 127

    I found that the makefile (https://github.com/esp8266/source-code- … y/Makefile) references to /usr/bin for the esptool (@line 65). Changed that to /opt/esp-open-sdk/esptool but now I get a permission denied error

    philippe@ubuntu:/opt/esp-open-sdk/source-code-examples/blinky$ make clean
    philippe@ubuntu:/opt/esp-open-sdk/source-code-examples/blinky$ make
    CC user/user_main.c
    AR build/app_app.a
    LD build/app.out
    FW firmware/0x00000.bin
    make: execvp: /opt/esp-open-sdk/esptool: Permission denied
    make: *** [firmware/0x00000.bin] Error 127

    • Hi Philippe,

      I’m afraid I forgot to include the part that installs the esptool. If you run the 4 lines under “# Installing the ESP image tool”, everything should work as described.

      Good luck!

      Cheers,
      Jan

      • Philippe Philippe

        Looks like that did the trick :-)! blinky and basic_example build fine.
        Jeroen’s (sprite_tm) esphttpd also builds fine after adding some heatshrink lib/include files. Thanks!

        • Great to hear that it’s working for you and that you got a webserver running on your ESP8266. I think I’ll be going to MQTT way myself, or maybe combine that with sprite_tm’s great work. I’ll blog about that later.

      • Foad Foad

        Hi Jan,
        I have exactly the same problem as Philippe:
        foad@foad-VGN-BZ21VN:~$ git clone https://github.com/esp8266/source-code-examples.git
        Cloning into ‘source-code-examples’…
        remote: Counting objects: 107, done.
        remote: Total 107 (delta 0), reused 0 (delta 0), pack-reused 107
        Receiving objects: 100% (107/107), 18.90 KiB | 7.00 KiB/s, done.
        Resolving deltas: 100% (29/29), done.
        Checking connectivity… done.
        foad@foad-VGN-BZ21VN:~$ cd source-code-examples/blinky
        foad@foad-VGN-BZ21VN:~/source-code-examples/blinky$ sed -i ‘s/Espressif\/crosstool-NG\/builds\/xtensa-lx106-elf\/bin/esp-open-sdk\/xtensa-lx106-elf\/bin/g’ Makefile
        foad@foad-VGN-BZ21VN:~/source-code-examples/blinky$ sed -i ‘s/Espressif\/ESP8266_SDK/esp-open-sdk\/sdk/g’ Makefile
        foad@foad-VGN-BZ21VN:~/source-code-examples/blinky$ sed -i ‘s/Espressif/esp-open-sdk/g’ Makefile
        foad@foad-VGN-BZ21VN:~/source-code-examples/blinky$ make
        CC user/user_main.c
        AR build/app_app.a
        LD build/app.out
        FW firmware/
        make: esptool.py: Command not found
        make: *** [firmware/0x00000.bin] Error 127
        foad@foad-VGN-BZ21VN:~/source-code-examples/blinky$

        • Gryffoon Gryffoon

          Try this
          erase all of esp-open-rtos with a “su rm -R esp-open-rtos”
          Then remake all the installation described above BUT WITHOUT THE UPDATING STEP !

          The updating step (make clean step) removes your xtensa compiler from your PC

  2. Pierce Primm, Sr. Pierce Primm, Sr.

    Had a lot of trouble installing esp-open-sdk before I ran across your blog. Thanks a million!

  3. Don Don

    In the article you mention pushbuttons in a picture (circuit schematic?) but I can’t see any picture – what am I missing?

    • You’re right Don. Previously, there was just one blog about SDKs, but I have split them. Unfortunately I forgot to copy the image of my development board into this blog about Open SDK. I have just added a picture of the development board I’m using. Hope it helps?

  4. Ashish Ashish

    Thank you for the nice post. I definitely work for me.

    I have a more basic question here.

    Is open-sdk is just a toolchain ? Can i compile samples from esp_iot_sdk against this toolchain and use it without any issues.

    Or my understanding is incorrect and both open-sdk and iot_sdk have some other differences also ?

    Regards,
    Ashish

    • Hi Ashish,

      OpenSDK is not a tool chain, but only an SDK. The blog post I have written is actually about installing the toolchain, including the SDK. The examples by Espressif Systems need a tiny bit of tweaking before they compile using OpenSDK.

      Best regards,
      Jan

  5. Gary Gary

    Hi Jan,

    I really like this article – it was quite easy to setup the development-environment following your advices…. meanwhile I did a fresh setup of my virtual machine based on Ubunto 15.04.
    Executing
    make STANDALONE=y
    …. stopped with the error ….. error: could not find GNU libtool >= 1.5.26
    just in case for others … this can be solved by:
    sudo apt-get install libtool-bin

    cheers,
    Gary

  6. Chris Chris

    Hi Jan

    Appreciate all the great info — one question – have you figured out how to use esp-open-sdk within platformio?

    Thanks,

    Chris

  7. Andreas Andreas

    Thanks for this blog post. Helped me figure out what to do after installing the eps-open-sdk.
    Just pull the example and edit a few lines in the make file 🙂

    I decided to use the esptool.py instead of “esptool_0.0.2-1_i386.deb”, so image tool install step were just “pip install esptool”

    I installed the toolchain directly on my mac, but I think using a virtual machine is a great idea.

  8. Gryffoon Gryffoon

    Updating:

    after updating trough the sugested four commands the make clean delete all of xtensa directory and so the gcc compiler. I’ve lost 2 hours due to this bug.

    Can you correct those commands please, since the make clean delete all of xtensa directory with its gcc compiler.
    /opt/esp-open-sdk
    make clean
    git pull
    git submodule update

    I reinstalled all of xperia toolchain to make it work againe

  9. Gryffoon Gryffoon

    I REPOST THIS SINCE THERE IS A DISPLAY PROBLEM IN THE WEBSITE IT SEEMS.

    I had some issues with the “make flash” command:
    FIRST ONE:
    After the make command it creates two files in a new driectory named firmware, thes two files are named ‘0x00000.bin’ and ‘0x10000.bin’, and nothing else !
    However, while doing “make flash” command it says :

    esptool.py –port /dev/ttyUSB0 /firmware/0x00000.bin 0x00000.bin /firmware/0x40000.bin 0x40000.bin
    (…)
    esp_tool write_flas : error: argument : [Errno 2] No such file or directory: ‘firmware/0x40000.bin’

    I don’t really know why it asks for a 0x40000.bin, this is a real bug.

    I palliated this bug by typing manually the command :
    esptool.py –port /dev/ttyUSB0 /firmware/0x00000.bin 0x00000.bin /firmware/0x10000.bin 0x10000.bin

    and then the flashing worked with correctly an ESP-12E. But I think this solution is not perfect.

    SECOND ONE:
    I had a lasteissue maybe due to an ubuntu bug (Ubuntu 16 LTS), while trying to flash
    Cannot open /dev/ttyUSB0: Permission denied

    https://bugs.launchpad.net/ubuntu/+source/gtkterm/+bug/949597

    I palliated to this problem with the command ” sudo chmod -R 777 /dev/ttyUSB0 ” each time I wanted to flash.

    Do you know more about these bugs ?

  10. Gryffoon Gryffoon

    I used ubuntu 16 to do this installation, it is possible than an additionnal package is needed. apt-get suggested me to add it with the command “apt-get install -f” to resolve the dependancies and it worked.

    Please be careful while using apt-get install the error messages are important.

  11. Gryffoon Gryffoon

    I found that this blinky has been let abandonned and is now obsolete, since its makefile (at least) is no more working since eagle.app has evolved and changed, so the compatiblity is lost.
    see this two topics:
    https://github.com/pfalcon/esp-open-sdk/issues/226#issuecomment-316730076
    https://github.com/esp8266/source-code-examples/issues/25
    You should replace this blinky programm by another.. Maybe this one should fit:
    https://github.com/pfalcon/esp-open-sdk/tree/master/examples/blinky

  12. Taher Taher

    im getting this error.
    Error calling xtensa-lx106-elf-readelf, do you have Xtensa toolchain in PATH?
    Makefile:7: recipe for target ‘blinky-0x00000.bin’ failed

    • Gryffoon Gryffoon

      It seems that you forget to do these commands

      echo ‘PATH=$PATH:/opt/esp-open-sdk/xtensa-lx106-elf/bin’ >> ~/.profile
      echo ‘PATH=$PATH:/opt/esp-open-sdk/esptool’ >> ~/.profile
      PATH=$PATH:/opt/esp-open-sdk/xtensa-lx106-elf/bin
      PATH=$PATH:/opt/esp-open-sdk/esptool

  13. Gnanaguru Gnanaguru

    Hi fellows,

    I’m getting follownig error while make in example/blinky file

    “fatal error: ets_sys.h: No such file or directory
    #include “ets_sys.h” “

Leave a Reply

Your email address will not be published. Required fields are marked *

10 − nine =