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 Respberry PI2. Once you have your working Linux environment, setting up the toolchain is easy.
git clone --recursive https://github.com/pfalcon/esp-open-sdk
README.md
and edit line 3 of the Makefile
to 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/bin
in your PATH to use the tools. The simplest way of doing this is to include the following in the .bashrc
in your login directory.export PATH="$HOME/esp-open-sdk/xtensa-lx106-elf/bin/:$PATH"
xtensa-lx106-elf-gcc -v
to 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 .bashrc
to save on typing, for example:alias xgcc="xtensa-lx106-elf-gcc"
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 VirtalBox, but largely applies to setting up VM on most platforms.
ssh
command 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 virtualbox
on 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.
nodeMCU
, but you are free to choose whatever name your wish) (the bold options are non-default):mini.iso
to this.* You don't need any other virtual hardware or features, many some find the sheared folders feature worth installing. I don't bother nowadays and just use ''rsync'' / ''scp'' / ''sftp''.
127.0.0.1:2222
to 10.0.2.15:22
so that doing an SSH to localhost:2222
connects 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 ifconfig
after 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 just stops you shooting yourself in the foot.Download Installer Components
and 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 ipconfig
to check the IP details and sudo poweroff
to shutdown the machine.vboxmanage
commands and just like a real server, you will only want to have the server console available for exceptions system maintenance. I use a set of aliases in my .bashrc
on my laptop (Windows users can use doskey
macros to achieve the same effect):
alias nodemcustart='vboxmanage startvm nodemcu –type headless' alias nodemcusave='vboxmanage controlvm nodemcu savestate' alias nodemcu='ssh -p 2222 localhost'
~/.ssh/authorizedkeys and
chown 600 ~/.ssh/authorizedkeys
. You should now be able to log off and log on from your host without needing to enter a password.
* Edit /etc/ssh/sshd_config
and append the line AllowUsers @10.0.2.
to limit logon to access from the host PC. (You will neeed to use sudo nano
or sudo vi
to do this). And similarly do a sudo visudo
to add NOPASSWD
to the %admin
and %sudo
groups 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
* And lastly mangle your password so that only key-based access can work (replace terry
by your user account):
pwd=$(date|md5sum); echo -e “$pwd\n$pwd”|sudo passwd terry
* Now install all of the other core packages that allow you to build the toolchain, nodeMCU and luac.cross
:
sudo apt-get install \
build-essential zip gdb git vim make unrar autoconf automake \
bison texinfo libtool gcc g++ gperf libc-dbg ncurses-dev \
lua5.1 lua5.1-doc luarocks lua-bitop lua-filesystem lua-md5 lua-posix lua-socket
# libexpat-dev flex bison texinfo libgmp3-dev libmpfr-dev libncurses5-dev