ESP32 (2) – The development environment

luca 12/12/2016 12

After having introduced, in the previous post, the ESP32 chip and the official development board by Espressif, today I’m going to show you how to install and use the official development environment.

I’ll explain how to install the IDE under Windows because of it is the most complex procedure. The development environment its how-to-install guides are available also for Linux and MacOS.

The official development framework for the ESP32 chip is published by Expressif on Github, with an opensource license (Apache 2.0) and named Espressif IoT Development Framework (shortly idf).

To be able to use it under Windows, you need some GNU commands and toolchains (make, bash…). Espressif chose to offer a pre-configured version of MSYS2 that includes everything is required.

Download the ZIP archive from the Espressif website and unzip it in the root of your C drive; MSYS2 will be installed in the C:\msys32 subfolder:

Make sure you’re using the latest version of the toolchain; the link to download it is available in the official documentation


Double-click on minigw32.exe to run a bash shell:


We can now clone the idf Github repository to have a local copy of it. First we must choose a folder where it will be copied; to keep it simple let’s use the user’s home folder.

Move into that folder and run the clone command:

$ cd
$ git clone --recursive


During the git clone command execution, you may get some error messages like: not a valid identifier; those errors are caused by a known bug and can be therefore ignored.

After the process is completed, the development framework is available in the esp32-idf subfolder:


To use if when compiling your projects, you have to export the path as an environment variable (IDF-PATH):

$ export IDF_PATH=~/esp-idf

Let’s connect the board!

You’re now ready to connect the development board to your computer.

If you already have the correct drivers, once connected it will appear as a new serial port:


On the contrary, the needed drivers are available on the Silicon Labs official website.

Hello World

As usual when learning a new language or framework, let’s start with a simple program that displays (using the serial-usb connection) the sentence Hello world.

The framework is distributed with some examples, among them you can find the 01_hello_world program. To compile it, move to its folder and run the make command:

$ cd
$ cd esp-idf/examples/01_hello_world/
$ make

A configuration menu will be displayed: we’ll talk more about it in a next post. Now you only need to tell the flasher which is the serial port your board is connected to.

Choose Serial flasher config, then /dev/ttyUSB0 (the default port):


Type the name of your serial port (as identified above), then confirm with OkSave and Exit:


When the compile process is complete, you can upload the program on the board with the following command:

make flash


If you now use a terminal emulator to connect to the serial port with the correct speed (115200 baud) you should see the program output:


(the program prints the sentence “Hello world!”, counts 10 seconds and then restart the chip…)


  1. Other Paul 10/05/2017 at 11:13 - Reply

    Presumably the Espressif ZIP archive you mentioned will occasionally get updated. As I can find no quick and obvious path to this zip from either github or espressif (I’ve spent the past half-hour looking), could you provide a URL on espressif’s site that points you to their latest zip – on the grounds that such a URL might change less frequently than that to which it refers :)

    • luca 10/05/2017 at 14:48 - Reply

      Hi Paul, you’re right… the best way to find the link is the official documentation. I’ll update the article accordingly

      • Other Paul 10/05/2017 at 16:46 - Reply

        Thanks. But unhappily there is more. Not that it matters to me, but I cannot find any trace of 01_hello_world in the esp-idf gittery (gittage?).

        More seriously, I’m looking to make one of their wifi examples but the make – after several rumblings – just ends up saying that

        … yada yada yada …
        CC flash_qio_mode.o
        CC bootloader_start.o
        AR libmain.a
        LD bootloader.elf
        /bin/sh: python: command not found

        And indeed the distribution shows an absence of python in /usr/bin. Thing is I already have python (both 2.7 and 3) installed under a separate cygwin environment but MSYS2 isn’t in the same universe (its / is not the same as my cygwin’s) and cannot see it. I have so many different IDEs (MPLAB, Atmel, Xilinx, not to mention GNU) living on this machine it’s hard to keep track of which one’s being used for what piece of hardware. :). I suppose I’ll have to install yet another python just for MSYS2. Gaah!

        Just thought I’d mention a first-world problem!

        • luca 10/05/2017 at 21:18 - Reply

          Hi Paul! Try running the “minigw32.exe” executable instead of “msys2.exe”… it should solve your issue

      • Other Paul 10/05/2017 at 23:32 - Reply

        mingw32.exe works – python appears to be known on that route, so thanks! But – although I get a bootloader.bin out of it, it just won’t go via (in my case) /dev/ttyS20 onto the board, Boot buttion has no effect. All I get is

        serial.serialutil.SerialException: could not open port ‘/??/COM21′: WindowsError(123, ‘The filename, directory name, or volume label syntax is incorrect.’)

        As it happens I have a prior prog flashed onto it (via the arduino ide) and I can see its output coming in with a ‘cat < /dev/ttyS20' so I'm pretty confident the mingw config is correct.

        • luca 11/05/2017 at 09:32 - Reply

          Paul if you are under Windows, in menuconfig enter “COM21″ (without quotes) as serial port for the flasher

  2. Abhay 29/05/2017 at 06:06 - Reply

    $ git clone –recursive
    Cloning into ‘esp-idf’…
    Username for ‘':
    Password for ‘':
    remote: Repository not found.
    fatal: repository ‘’ not found

    Why is it asking for a username and password?

    • luca 29/05/2017 at 08:12 - Reply

      did you configure git with your account? Are you using Github also for your projects?

  3. Tobo 06/06/2017 at 23:11 - Reply

    thanks, works perfect
    Next ESP32 (3)

  4. ashu 05/12/2018 at 17:23 - Reply

    MINGW32 ~/esp-idf/examples/get-started/hello_world
    $ make flash
    Toolchain path: /opt/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
    WARNING: Toolchain version is not supported: crosstool-ng-1.22.0-61-gab8375a
    Expected to see version: crosstool-ng-1.22.0-80-g6c4433a
    Please check ESP-IDF setup instructions and update the toolchain, or proceed at your own risk.
    Compiler version: 5.2.0
    WARNING: Toolchain version is not supported: crosstool-ng-1.22.0-61-gab8375a
    Expected to see version: crosstool-ng-1.22.0-80-g6c4433a
    Please check ESP-IDF setup instructions and update the toolchain, or proceed at your own risk.
    Please run the following command to install MSYS2’s MINGW Python cryptography package:
    pacman -Sy mingw-w64-i686-python2-cryptography
    make: *** [/home/ashenafi/esp-idf/make/ check_python_dependencies] Error 1

Leave A Response »

This website uses cookies to ensure you get the best experience on our website maggiori informazioni

Questo sito utilizza i cookie per fonire la migliore esperienza di navigazione possibile. Continuando a utilizzare questo sito senza modificare le impostazioni dei cookie o clicchi su "Accetta" permetti al loro utilizzo.