Wednesday, November 9, 2016

ESP32 Linux development environment

To setup the development environment for ESP32 is more simple like it was for the ESP8266.

There are few easy steps ( you can found them also here).

1. Download lubuntu-16.04.1-desktop-amd64.iso file and the 
After you installed you lubuntu VM ( 64 bits) and the VBoxGuestAdditions_5.1.6.iso ( for full screen, shared directories between the windows and Linux, shared clipboard)

2.Install the Lubuntu iso image using the Virtual Box

3.Open a terminal and issue sudo apt install build-essential

4.Mount the VBoxGuestAdditions_5.1.6.iso and run the as root from /media/your_username/VBOXADDITIONS_5.1.6_110634 directory

Now you are ready to install the ESP32 environment.
You can follow the steps from 5 to 10 or get the right scripts from and run it. It will do the steps from 5 to 10 for you.

5. Install the applications:
sudo apt-get install gawk gperf grep gettext ncurses python python-dev automake bison flex texinfo help2man libtool

6.Create a directory:
 make ~/esp32
This will create a directory in the /home/<your_username>/

7.Download the binary toolchain
cd ~/esp32
Untar the archive using 

tar xvf xtensa-esp32-elf-linux64-1.22.0-59.tar.gz

This will create a directory named xtensa-esp32-elf/ int the /home/<your_user>/esp32/

7.Update the PATH variable with the xtensa toolchain

export PATH=$PATH:$HOME/esp32/xtensa-esp32-elf/bin
Attention: This command will set the PATH just for the current terminal and for the current session. To make this permanent update the .bashrc file in the /home/<your_name>/ directory.

To check this open a new terminal and issue the command 

echo $PATH 

and you should see the esp32/xtensa-esp32-elf/bin in the output.

8. Get ESP-IDF from github

cd ~/esp32
git clone --recursive
cd ~/esp32/esp-idf
git submodule update --init
9.Download a template application
cd ~/esp32
git clone myapp
You will have now in the /home/<your_username>/esp32 a directory named myapp.

Update again the .bashrc file if you are not planning to move the IDF directory and add the following line at the end of /home/<your_username>/.bashrc

export IDF_PATH=$(pwd)/esp32/esp-idf

10. Configure and run your firs application

Go to /home/<your_username>/esp32/myapp and issue command

make menuconfig

that will adapt the sdkconfig according to your project and then compile it with


To flash it to the ESP32 use the 

make flash 


Job done !

ESP32 increase the maximum number of sockets

Still didn't found an ESP32 with a decent delivery price so today I've tested the environment provided by EspressIf looking on the maximum number of sockets. On ESP8266 I've managed to have more then 20 sockets opened and carrying MQTT packets ( see

I've noticed that the maximum number of sockets that you can setup from make menuconfig is 16. 

All the values that you are setting from make menuconfig are ending in a file named sdkconfig in the root of you app directory. This sdkconfig file will be converted to sdkconfig.h located in app/build/include/sdkconfig.h.

Even you are modifying a value direct in the sdkconfig on the compile time you will be invited to enter a value 1..16 for maximum number of sockets.

Solution #1. (Safest one)

Change the sdkconfig.h file overwrite the desired value and recompile


Solution #2. (not recommended but possible )

Modify directly the file:


If you modified values in make menuconfig and you don't know what was before don't worry just do a diff between the app/sdkconfig and app/sdkconfig.old file.