ESP32 toolchain setup

IMPORTANT
Please note that this ESP32 toolchain setup article is now obsolete. We highly recommend that you consult our Getting Started with ESP32 tutorial articles for complete information on how to setup the toolchain and compile example programs for the ESP32:

Getting Started with ESP32 ESP-IDF – Part I
Getting Started with ESP32 ESP-IDF – Part II
Getting Started with ESP32 ESP-IDF – Part III

 

Download Ubuntu 14.04 ISO image

The ESP32 development environment can be configured and built on Ubuntu 14.04 LTS. The reason for this being demonstrated on Ubuntu is that the OS is extremely popular among electronics enthusiasts and therefore it is familiar to many developers who are used to embedded design and development. Read on to find a step-by-step approach to ESP32 toolchain setup and installation.

esp32-toolchain-setup-ubuntu-linux-tutorial

Download Ubuntu 14.04 from http://releases.ubuntu.com/14.04/

Once downloaded, setup Ubuntu to run on VirtualBox in any host machine of your choice. In this article, the demo was run on a Windows 10 host machine.
The steps for setting up the Virtual Machine is not covered, however, you may find that online elsewhere.

Note that if possible, allocate the following resources (minimum) to the Ubuntu OS:
RAM: 4GB
Cores: 2
Graphics acceleration: Enabled
Disk space: 50GB

You may install Ubuntu with minimum system resources but that is not recommended, otherwise ESP32 toolchain setup and build process may take hours to finish.

ESP32 toolchain setup

Open the Ubuntu terminal (ctrl + alt + T) Update the system using sudo apt-get update To install the packages required to build the toolchain, download and install the requisite packages using the following commands. Note that if the installation asks you for confirmation to continue, press Y and hit enter to continue with the installation. You may also have to enter the password if asked.
sudo apt-get install git
sudo apt-get install autoconf
sudo apt-get install build-essential
sudo apt-get install gperf
sudo apt-get install bison
sudo apt-get install flex
sudo apt-get install texinfo
sudo apt-get install libtool
sudo apt-get install libncurses5-dev
sudo apt-get install wget
sudo apt-get install gawk
sudo apt-get install libc6
sudo apt-get install python-serial
sudo apt-get install libexpat-dev
Make sure that all of the above packages are installed without errors or exceptions. The packages were last verified to download and install in August, 2016. Create a directory to store the toolchain (we highly recommend not changing the directory names mentioned in the installation steps here as it may lead to build failure later):
sudo mkdir /opt/Espressif 
Change ownership:
sudo chown $USER /opt/Espressif/ 
 

Download toolchain

Download the toolchain files to build the toolchain into the directory created before:
cd /opt/Espressif/
git clone -b esp108-1.21.0 https://github.com/jcmvbkbc/crosstool-NG.git 
The download should complete without errors.  

Build the toolchain

Go to the crosstool folder:

cd crosstool-NG/ 

You are now about to install (build) the toolchain. Note that this will take a very long time (sometimes even an hour!), so make sure you have time to let it run uninterrupted. Make the toolchain using the following commands:

./bootstrap
./configure
make
make install
./ct-ng xtensa-esp108-elf
./ct-ng build 

ESP32 toolchain setup is completed!

The toolchain installation (download + build) is now complete and you should be ready to compile and generate BIN files for the ESP32.