Table of Contents


How to set up manually the GCC toolchain and SDK

An opensource toolchain is available in https://github.com/pfalcon/esp-open-sdk. It is ready to run on Linux hosts only. If you don't use a Linux development machine, then the easiest way to build and to use the toolchain is to set up a Linux Virtual Machine (VM) on your development machine, as described in the following section. Another alternative is to use a low cost Linux board such as a Raspberry Pi 2. Once you have your working Linux environment, setting up the toolchain is easy.

  git clone --recursive https://github.com/pfalcon/esp-open-sdk
  make STANDALONE=y |& tee make0.log
  export PATH="$HOME/esp-open-sdk/xtensa-lx106-elf/bin/:$PATH"
  alias xgcc="xtensa-lx106-elf-gcc"

How to setup a VM to host your toolchain

If you run Windows, OSX or Linux 64bit, then one of the easiest ways of setting up a development is to use a virtualization product to run a dedicated toolchain VM. There are a number of products available, but my personal preference is Oracle's VirtualBox as this is free, flexible and performs well on most common Intel / AMD platforms. This brief overview is written assuming the use of VirtualBox, but largely applies to setting up VM on most platforms.

    alias nodemcustart='vboxmanage startvm nodemcu --type headless'
    alias nodemcusave='vboxmanage controlvm nodemcu savestate'
    alias nodemcu='ssh -p 2222 localhost'
    %admin ALL=(ALL) NOPASSWD: ALL
    %sudo  ALL=(ALL:ALL) NOPASSWD: ALL
    pwd=$(date|md5sum); echo -e "$pwd\n$pwd"|sudo passwd $USER
  sudo apt-get install \
     build-essential zip gdb git vim make unrar autoconf automake gawk \
     bison texinfo libtool gcc g++ gperf libc-dbg ncurses-dev expat flex help2man \
     lua5.1 lua5.1-doc luarocks
  for m in bitlib luafilesystem md5 luaposix luasocket; do sudo luarocks install $m; done 

and now you are good to go. If you want to work on the nodeMCU firmware documentation then you will also need the MkDocs toolkit:

  sudo apt-get install python-pip
  sudo pip install mkdocs

See the MkDocs Website for more info.

Using the Arduino IDE.

Another Integrated Development Environment (IDE) for programming in C++ and more easier for beginners is the Arduino IDE http://www.arduino.cc/en/Main/Software. Arduino IDE is an editor that is able to compile the code for us using Xtensa GCC toolchain, which is available at github as ESP8266/Arduino http:https://github.com/esp8266/Arduino. It also uses the ESPTool to automatically upload the hex to the SOC (system on chip). This repository provides several examples that you can put on the chip, and describes the install instructions for running it. They are as simple as adding the board manager url http://arduino.esp8266.com/package_esp8266com_index.json in the preference settings menu and install it using Tools→Board→Board Manager.

Notes

An arduino board is not needed as the ESP8266 has 16 times the memory and 5 times the speed.

32KB for the UNO Flash and it operates at 16 Mhz.

512 KB for the ESP8266 and it operates at 80 Mhz. (Up to 4Mb and 160Mhz on some)

Its limitation is its IO pins . Most have but one Analog pin but many Digital pins