March 12, 2017

The ESP8266 -- Working with the SDK

So, you have taken my advice and decided to work with the SDK. You are going to need at least 3 things (along with your favorite editor and various standard linux tools, including "make".


I have been using an old version (and still do since it is simple and works). This is a single python file that I place in a directory on my search path. You do need to load the python "PySerial" module before it will work. Apparently a lot of development has gone on since I grabbed this thing years ago, and perhaps you want to grab the latest copy. Here are the links, you can choose for yourself. Note that I have renamed this from "" to just "esptool".

A C compiler

There are probably other choices here also for you to consider, but I am going with what I know and what works. Sometime long ago, I found something called Crosstool-NG for the ESP8266 and went through the process of running it. It downloaded all kinds of things, built the C compiler from scratch, and performed who knows what undocumented things. You may be able to hunt this down and repeat the process to get newer copies of things, but I found the black box nature of it all not at all to my liking. This ended up giving me gcc 4.8.2 for the Xtensa lx106. One thing I will say for it -- it works just fine.

I keep the compiler and the SDK itself in /opt/esp-open-sdk on my machine. This is where the Crosstool-NG gadget placed everthing, or where I told it to place everything. I add /opt/esp-open-sdk/xtensa-lx106-elf/bin to my path (by adding the following to my .bashrc file):

export PATH=/opt/esp-open-sdk/xtensa-lx106-elf/bin:$PATH
So, the compiler and related files need to go into /opt/esp-open-sdk/xtensa-lx106-elf Here is the contents of that directory. This all runs just fine on my Fedora 25 system (and has since well before Fedora 24), but no telling if it will work for you or not without trying it.

The SDK itself

Again, there is almost certainly a newer version you can and perhaps should fetch, but this is what I am using and it works just fine for me. This goes into /opt/esp_iot_sdk_v1.5.0 and I make a link /opt/sdk to it.

A sample Makefile

Here is a Makefile grabbed from a recent project. I could polish it up a bit and remove some bloat, but it works and should show you what you need to do to use the above stuff when placed where I recommend. The critical thing in this makefile is the following line:
SDK_BASE        = /opt/esp-open-sdk
A decent repertoire of linux skills are needed to set all this up, but this should provide all of the basic pieces, as well as some suggestions of where to go to get more recent things.

If you have trouble, drop me a line.