GCC For The ESP8266 WiFi Module

When we first heard about it a few weeks ago, we knew the ESP8266 UART to WiFi module was a special beast. It was cheap, gave every microcontroller the ability to connect to a WiFi network, and could – possibly – be programmed itself, turning this little module into a complete Internet of Things solution. The only thing preventing the last feature from being realized was the lack of compiler support. This has now changed. The officially unofficial ESP8266 community forums now has a working GCC for the ESP8266.

The ESP8266 most people are getting from China features a Tensilica Xtensa LX3 32-bit SOC clocked at 80 MHz. There’s an SPI flash on the board, containing a few dozen kilobytes of data. Most of this, of course, is the code to run the TCP/IP stack and manage the radio. There are a few k left over – and a few pins – for anyone to add some code and some extended functionality to this module. With the work on GCC for this module, it’ll be just a few days until someone manages to get the most basic project running on this module. By next week, someone will have a video of this module connected to a battery, with a web-enabled blinking LED.

Of course that’s not the only thing this module can do; at less than $5, it will only be a matter of time until sensors are wired in, code written, and a truly affordable IoT sensor platform is created.

If you have a few of these modules sitting around and you’d like to give the new compiler a go, the git is right here.

69 thoughts on “GCC For The ESP8266 WiFi Module

    1. How far-reaching is an FCC certification? If one design gets certified does it cover all boards that use the same layout and components? I ask because I always wonder if modules like this are all coming from the same factory of if there is a slew of knockoffs mixed in.

        1. FCC Certification is tied to a specific product. FCC is only authorized for ITU region 2. Other regions, governments, and countries have their own compliance testing rules and regulations

  1. Sounds good but I’ll still waiting for mine, ordered more than a month ago …
    I guess I’m not the only one, seeing how few project are posted related to this piece of kit.

  2. it’s a greate module. Mine is already there…
    You can create a socket connection with the java program SocketTest on my computer running. It works simple as this:

    Connect to wifi network: AT+CWJAP=”SSID”,”PASS”
    Check if connection: AT+CWJAP?
    Check ip adress: AT+CIFSR

    Connect to socket AT+CIPSTART=”TCP”,”185.31.192.132″,8001

    Send data
    AT+CIPSEND=

    1. The point of GCC being able to build images for the esp8266 is that you don’t need to connect to it in AT mode, you can write stuff to run directly on the chip – it would only need power

  3. Reading a little bit about the chip, it appears to have a bunch of dsp capabilities and also an i2s output. This tiny form factor and low price just demands that I turn it into some kind of wifi-controlled synth :D

  4. “and a truly affordable IoT sensor platform is created.” I don’t think this module was the missing piece. Any other simpler radio module (nrf24L01, RFM12, RFM69 etc) coupled with a gateway makes more sense for sensor platform. This things burns a lot more power when you just want to post some simple data somewhere, it’s not good for coincell powered temperature sensor that works for years. On the other hand, plenty of stuff with permanent power to use it for.

      1. If you upload some data to the server, you will have to wait some 50-200ms for a reply, assuming a decent internet connection to the server, during which time you are looking at close to 100mA consumed. Not to mention the transmission.
        Compare this to a small module based on a NRF24L01 which consumes 5-6X less in receive and 10X less in TX and gets a confirmation from a gateway in <1ms.
        In both cases I exclude any form of unreliable data delivery(UPD or broadcast).
        This is why you can make a coin cell powered temperature sensor that has a decent life with one of these modules but not with the ESP8266.
        I am not saying other things don't make sense, whatever you do you will require a much larger battery for the same life.

          1. There are ways, indeed. It may be that a smaller micro is enough as well. I started with the ’88 because you can go down to a 44 or higher with megas in the same board area. at the moment the project does not have to be perfectly optimized for cost, but it is just a proof of concept that even making 10 of them they still cost about 3 each.

        1. I think there are reasonable workarounds… it all depends on the application. If you set up a system that waits for the sensor to decide it’s time to call home, and have a return message queue waiting for it, this can be implemented to work on a pair of coin cells that will last a very long time. You use the power saving modes of the SoC and you don’t ever have it listen for incoming data; you only wake it up when it has sensor data to push up to the network.

          1. The problem is that you increase the distance and thus the resopnse time. If it is a server, it takes a long time to send a message to it across the country/globe and then have it confirm reception. I would not trust UDP and send the message out there and hope it reaches, I would like something reliable. If we are talking about a local server I don’t see the reason for wifi instead of simpler modules.

            I think a CR2032 cell might be able to handle the 200mA current for some ms, but the usage has to be something really occasional. Garage door checker that reports a few times a day – sure. Temperature sensor that reports every 5 minutes, not so much.

            What i want from the IoT devices is years of battery life, like a clock for example. Putting tens of modules in your house and expecting to randomly change the battery of each every 3-6 months is too much of a hassle.

    1. The big deal about this chip is that it’s 802.11, fits into an existing network infrastructure, completely self-contained, less than $5 and has range 5x that of an nrf24l01

      1. I agree it’s an impressive chip. Wifi just takes too much power for operation on a coin cell. Even at its lowest power setting the the esp draws about 60ma, while a decent cr2032 can only do 25mA. Cheap no name cr2032s can only sustain around 10mA, so even an nrf module needs a ~30uF cap for brief transmissions at 0dB.
        There’s still lots of potential for the esp modules; they’ll just need a larger power source like a couple AA cells or a single LiFePO4.

  5. screw gpio, it has SPI that most likely can be reused after it boots
    spi = at least couple of megabytes/s bus = usable beyond wanky led blinky
    you could probably even turn one into a network camera :), or thermo vision security camera using flir LEPTON

  6. Now, here’s a security problem: say you have your encrypted wifi and a bunch of these devices around, simple things like wifi light switches, no display, nothing. But you want to change your home’s wifi password periodically(because of reasons), without using WPS.
    What would be a good way to do that to all the devices?

    1. Personally, I would run a separate wifi network. Once you have a large number of these types of things deployed security breaches will be inevitable. By isolating them behind a 2nd firewall gives the best of both worlds.

      1. This is what I do now, using extra router since it does not want to connect to my main one. But this does not solve the problem, if that wifi is compromised… what can you do? For now I have MAC based DHCP and bandwidth limiting, but that is not worth it…

        1. Well, you probably have to reprogram them again. It is like changing batteries and is the reason why I do not think that this would be an ideal solution for most of the home automation problems.

      2. i find it curious that you trust these devices LESS than you trust any other devices on your network.

        “Once you have a large number of these types of things deployed security breaches will be inevitable”

        apparently they will develop some sort of spontaneous group intelligence and rebel against their master

    2. You don’t. The effort to have effective security would defeat all the benefits brought by connected devices on the Internet. Just think how cellphones would become unusable if manufacturers forced people to implement at least a decent level of security and behave accordingly.
      All mobile OSes are complete crap security-wise because otherwise nobody but a few techies would want to use them, certainly not the average teen constituting their biggest market.
      The next logical step in the whole IoT craze is the development of a level of security that does not hinder devices functionality and ease of use. It will likely involve the use of VPNs and possibly the separation between networks for devices and networks for people.

    1. There’s a lot of work to be done.
      Right now, as I see there’s only the compiler and blobs. libc is a blob, lwIP is a blob, wireless part is a blob. The first two are quite easy to compile from open source, the last one may get pretty difficult.
      lwIP has a _shitload_ of configuration compile-time parameters worth tuning, including ipv6.

      1. Nevertheless, we will see “everything with WiFi” from China, soon.
        Retrofit LED lamps with WiFi, RGB LED chains with WiFi, wall outlets with WiFi, toy helicopters with WiFi, (cyber)sex toys with WiFi. Everything that now has an infrared or rf remote control, will soon be controlled by your smartphone.

      1. As I said: I dig the u.FL Connector. My Spark Core had u.FL as well.
        My main resource is ebay (because of the free shipping and the paypal payment option).
        But thanks for the link. I like to know more pages for this kind of stuff.

    1. I bought a couple ESP-05 modules but you can’t update the firmware as the pin to put the chip into firmware update mode isn’t broken out on the module.. Also the firmware they came with was old and it doesn’t support cloud update either. DOH!

    1. I would assume that by early 1015 there will be already a superior version of this device.
      you are right that you can then pick up two for the price of one, but I think my money would be then out for a bit more advanced edition of this device (More Capacity, integrated RTC circuit, integrated SD Element for basic webserver functionality, selectable antenna – u.FL as I mentioned above, better dial in functionality – currently it is very basic stuff that was deciphert by someone from a chinese spec PDF)… so yeah, they will get cheaper, of course, but I would love to pay 10$ for a module that is more mature.

  7. This is getting cheap enough for me to consider a longterm idea. I want to attach a garage keyfob to the home network (I’m in a rental and can’t access the control box) so that I can operate it by phone.

  8. We’ve already got a mini webserver and IRC server running on this from BASIC using a Micromite at forums.propellerpowered.com. These things are silly easy to use once you wrap your head around how to format outgoing data.

    1. How did you turn it into a server? I can connect from the module to a server on my machine, but not the other way around..

      I issue this command: AT+CIPSERVER=1,9999 and then try to connect to it using telnet, but it’s connection refused for me..

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.