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
README.mdand edit line 3 of the
Makefileto select which the Espressif SDK Version that you wish to install if it is not the (default) latest version, e.g.
VENDOR_SDK = 1.3.0
make STANDALONE=y |& tee make0.log
xtensa-lx106-elf/binin your PATH to use the tools. The simplest way of doing this is to include the following in the
.bashrcin your login directory.
xtensa-lx106-elf-gcc -vto validate the install. Note that if you type in toolchain commands at the command prompt, then you might wish to add frequent aliases for the toolchain gcc, ar, objdump etc. in your
.bashrcto save on typing, for example:
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.
sshcommand on Linux or OSX and a product such as puTTY on Windows. If you decided to go this route then you don't need to learn the a Linux windows environment since you can access and manipulate both files and console sessions through your familiar Windows environment.
sudo apt-get install virtualboxon Debian and derived Linux systems such as Ubuntu. In the case of Windows and OSX, follow the instructions on the product's Downloads page or follow one of the many step-by-step guides on Youtube and elsewhere.
toolsfolder and unpacking this toolchain is a lot simpler and takes up about 2½Gb less disk space than building it yourself.
nodemcu, but you are free to choose whatever name your wish) (the bold options are non-default):
10.0.2.15:22so that doing an SSH to
localhost:2222connects to the VM's default SSH port. Host and off-machine process can only access the VM through a mapped port when the VM is running. (You will need to do an
ifconfigafter you've built the machine to validate the guest's actual IP address.) Note that if you have multiple VMs, then you should use a unique port for each SSH eg. 2222 for VM1; 2322 for VM2, etc. This stops you shooting yourself in the foot.
Download Installer Componentsand continue as you don't need any of these. The installer occasionally goes silent for 30-60secs, but then downloads all of the core components over network from the mirror. How long this takes depends on your internet bandwidth and how heavily the mirror is being hit, but 10-15 mins is typical. Time for a coffee
sudo ipconfigto check the IP details and
sudo poweroffto shutdown the machine.
vboxmanagecommands and just like a real server, you will only need to have the server console available for exceptional system maintenance. (I never bother with it and do everything over SSH.) I use a set of aliases in my
.bashrcon my laptop. (Windows users can use
doskeymacros to achieve the same effect.) (Replace
nodemcuby whatever you've called your VM.
alias nodemcustart='vboxmanage startvm nodemcu --type headless' alias nodemcusave='vboxmanage controlvm nodemcu savestate' alias nodemcu='ssh -p 2222 localhost'
authorized_keys” and read up on how public key based SSH access works and is configured). Now copy your public key to
chmod 600 ~/.ssh/authorized_keys. You should now be able to log off and log on from your host without needing to enter a password.
/etc/ssh/sshd_configand append the line
AllowUsers *@10.0.2.*to limit logon to access from the host PC. (You will neeed to use
sudo vito do this). And similarly do a
sudo visudoto add
%sudogroups as follows; this enables you to access root privileges without having to enter a password (and log off and on again to check that these are working OK.)
%admin ALL=(ALL) NOPASSWD: ALL %sudo ALL=(ALL:ALL) NOPASSWD: ALL
pwd=$(date|md5sum); echo -e "$pwd\n$pwd"|sudo passwd $USER
luac.cross. Note that Ubuntu 12.04 doesn't include pre-packaged versions of some of the Lua libraries, so you need to do a
luarocks installto build these:
sudo apt-get install \ build-essential zip gdb git vim make unrar autoconf automake \ bison texinfo libtool gcc g++ gperf libc-dbg ncurses-dev expat \ lua5.1 lua5.1-doc luarocks for m in lua-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.
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.
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