This document will allow you to develop native C/C++ firmware applications for the ESP8266 using Windows. You can setup your development environment using Microsoft Visual Studio IDE. Using the accompanying serial terminal and flash writer application, you will be able to edit compile, link, flash and run without ever needing to leave the IDE. You can download Microsoft Visual Studio Comunity for free. If you want to setup environment manually (more control) please refer to Toolset installation section. Otherwise you can use ESP8266 Wizard.
You can also use a third-party plugin to setup building and debugging automatically.
The following lists all the software components I have gathered in order to create and upload firmware for the ESP8266. Most of these components have been supplied by other hobbyists and are subject to change or move. Even the official SDKs supplied by Espressif seem to evolve rather quickly.
This particular version of the toolset is designed to work under Windows 7 or 8, 32 or 64bit. You can download a pre-built ESP8266 toolchain that contains Python and the ESP8266 SDK. Alternatively you can gather the necessary components manually:
%comspec% /k E:\ESP8266\VARS.cmd. When I click this I get a command prompt with the proper path already set.
This project is designed using xPL, a protocol for Home Automation devices and systems. I used the FreeRTOS based SDK, as I believe it will be more flexible for most users. The program uses UDP to send and receive xPL messages. I used an ESP-01 variant, since it has two available GPIOs, GPIO0 and GPIO2. Although these GPIOs are used during the boot process, with some care, they can be used by applications. The application currently does two things:
You cannot use most of the standard 'C' libraries, as they are not compatible with the runtime. The sdk does provide many common functions, like 'printf', 'memcpy', and similar, but I had to scrounge the Internets to get source code to some missing functions, like 'sscanf', 'strlcpy'.
Since every task created with FreeRTOS has it's own stack, the size of these needs to be managed carefully. Although the ESP8266 has plenty of RAM when compared to most microcontrollers, it is easy to run out of stack, or free memory. For this reason, I have used
malloc() for many larger structures that would be otherwise declared on the stack in other environments.
By default, all code goes into iram, which is only 32k, so it is easy to overflow that segment by linking in a bunch of stuff from the libraries or from your own code.
Use ICACHE_FLASH_ATTR on your functions to make sure they go into irom instead. Irom resides off-chip on a 4M flash ROM, thus leaving about 240-440kB for applications. Although the final compiled program appears huge (about 180k in irom, and 28k in iram), most of this is library code that runs the Wifi and IP stacks. The actual user application is something like 8k.
The hardware design shown above also assumes that the switch will remain open at bootup, as GPIO2 needs to be high for the chip to boot normally.
Looks like this is the best lead for that at this moment: Eclipse IDE for ESP8266
Go to Arduino site and download the IDE Unzip it wherever Go to the ESP8266 libraries and follow the easy install Lots of programms for you to try