I'm going try to try to put the steps together here, mainly for my own benefit since I'll probably forgot otherwise. :-)
To get the toolchain up and running, follow the instructions given here:
$ git clone -b lx106 git://github.com/jcmvbkbc/crosstool-NG.gitThis will compile the toolchain targeted at xtensa lx106 into the builds/ directory and will take a while. You may be required to install some missing dependencies. Meanwhile, we need to download the SDK and few other odds and ends.
$ cd crosstool-NG
$ ./bootstrap && ./configure --prefix=`pwd` && make && make install
$ ./ct-ng xtensa-lx106-elf
$ ./ct-ng build
From this post, download the esptool-0.0.2.zip file which contains the "esptool" package which will parse the elf generated by gcc compiler above, extract the relevant sections, and repack it into a binary format ready to be flashed. While you're there, also download the Makefiles which we'll modify to work with the toolchain above.
From this post, download the esp8266 sdk package. Extract the SDK package, extract the esptool-0.0.2.zip inside the SDK (as the Makefile looks for SDK_DIR/esptool/esptool executable) and build the esptool executable
$ unzip esp8266_sdk_v0.9.1.zipTo build the "AT" firmware, I had to copy the new updated makefile from Makefile_AT_0.9.1 into the SDK_DIR/examples/at directory and make couple of changes to the Makefile by setting the SDK_BASE, setting EXTRA_INCDIR to add include/ and /usr/include/ fields, and pointing to the toolchain built above for CC/AR/LD calls.
$ cp esptool-0.0.2.zip esp8266_sdk_v0.9.1
$ cd esp8266_sdk_v0.9.1
$ unzip esptool-0.0.2.zip
$ cd esptool
$ vim Makefile # edit target from WINDOWS to LINUX
$ cp Makefile_AT_0.9.1.zip esp8266_sdk_v0.9.1/examples/atIt would've been lovely if it all had just worked... but some more tweaks and missing dependencies are required. First, we need to put the libc.a and libhal.a from extra_libs.tgz from this post and put it in the SDK_DIR/lib directory. I also had to comment out int32_t in SDK_DIR/include/c_types.h. After that, though, simple "$ make" and we get the two firmware files, 0x00000.bin and 0x40000.bin!
$ cd esp8266_sdk_v0.9.1/examples/at
$ unzip Makefile_AT_0.9.1.zip
$ vim Makefile # Update SDK_BASE, EXTRA_INCDIR, CC, AR, LD
To download the firmware to the ESP8266, you need to boot the board with GPIO0 tied to ground to have it come up in programming mode. Once in programming mode, I was able to use the esp8266.py download script to program the new code
python esptool.py --port COM3 write_flash 0x00000 0x00000.binI got some error messages after erasing and programming had completed, but everything seems to work OK even with the error message.
python esptool.py --port COM3 write_flash 0x40000 0x40000.bin
COM3> AT+RSTWhat I'm interested in doing doing, though, is mode where the device wakes up by itself, automatically connects to a known Wifi station, and either automatically starts sending data or starts up a server so that data can be pulled out. This seems closer to the SDK's "IoT_demo" code base. I'm able to build and flash the resulting image, but I'm not quite sure what it is that the demo does yet. I suppose if I can't figure it out, I can just write something from scratch instead. :-)
COM3> AT+CIFSR # Get IP address
# Server mode enabled, test with nc IP_ADDRESS 5000
# Client mode, test with nc -l 6000