ESP32 integrates Wi-Fi (2.4 GHz band) and Bluetooth 4.2 solutions on a single chip, along with dual high-performance cores, Ultra Low Power co-processor and several peripherals. Powered by 40 nm technology, ESP32 provides a robust, highly integrated platform to meet the continuous demands for efficient power usage, compact design, security, high performance, and reliability.
Espressif provides the basic hardware and software resources that help application developers to build their ideas around the ESP32 series hardware. The software development framework by Espressif is intended for rapidly developing Internet-of-Things (IoT) applications, with Wi-Fi, Bluetooth, power management and several other system features.

To develop applications for ESP32 you need:

  • PC loaded with either Windows, Linux or Mac operating system
  • Toolchain to build the Application for ESP32
  • ESP-IDF that essentially contains API for ESP32 and scripts to operate the Toolchain
  • A text editor to write programs (Projects) in C, e.g. Eclipse
  • The ESP32 board itself and a USB cable to connect it to the PC

Preparation of development environment consists of three steps:

  1. Setup of Toolchain
  2. Getting of ESP-IDF from GitHub
  3. Installation and configuration of Eclipse

Set up of Toolchain for Windows

The quickest way to start development with ESP32 is by installing a prebuilt Toolchain. Windows don’t have a built-in “make” environment, so as well as installing the toolchain you will need a GNU-compatible environment. We use the MSYS2 environment to provide.
The quick setup is to download the Windows all-in-one toolchain & MSYS zip file from:
Unzip the zip file to C: and it will create a “msys32” directory with a pre-prepared environment.

Note: Usage of a toolchain
Use cd to change to the project directory (not the ESP-IDF directory.) Type make menuconfig to configure your project, then make to build it, make clean to remove built files, and make flash to flash (use the menuconfig to set the serial port for flashing.)


Besides the toolchain (that contains programs to compile and build the application), you also need ESP32 specific API / libraries. They are provided by Espressif in ESP-IDF repository. To get it, open an MSYS2 terminal window with administrative permissions by running.C:\msys32\msys2_shell.cmd The environment in this window is a bash shell., navigate to the directory you want to put ESP-IDF, and clone it using git clone command:

ESP-IDF will be downloaded into.$IDF_PATH/esp-idf


  • Do not miss the --recursive option. If you have already cloned ESP-IDF without this option, run another command to get all the submodules:

  • While cloning submodules, the git clone command may print some output starts': not a valid identifier.... This is a known issue but the git clone still succeeds without any problems.

Setup Path to ESP-IDF

The user profile scripts are contained in C:/msys32/etc/profile.d/ directory. They are executed every time you open an MSYS2 window.

  1. Create a new script file in C:/msys32/etc/profile.d/ directory. Name
  2. Identify the path to ESP-IDF directory. It is specific to your system configuration and may look something like C:\msys32\home\user-name\esp\esp-idf
  3. Add the export command to the script file, e.g.:

Remember to replace back-slashes with forward-slashes in the original Windows path.

  1. Save the script file.
  2. Close MSYS2 window and open it again. Check if IDF_PATH is set, by typing:

The path previously entered in the script file should be printed out.

Start a Project

Now you are ready to prepare your application for ESP32. To start off quickly, we will use the get-started/hello_world project from examples directory in the downloaded esp-idf file.

You can also find a range of example projects under the examples directory in ESP-IDF.


Being in a terminal window, go to the directory of the applicationhello_world by $IDF_PATH/examples/get-started/hello_world Then start project configuration utility menuconfig:

If previous steps have been done correctly, the following menu will be displayed:

steps to install esp-idf in IoT platform
In the menu, navigate toSerial flasher config > Default serial port configure the serial port, where the project will be loaded to. Confirm the selection by pressing enter, save configuration by selecting < Save > and then exit application by selecting.< Exit >

Note: On Windows, serial ports have names like COM1. On MacOS, they start with /dev/ cu… On Linux, they start with /dev/tty.

Build and Flash

Now you can build and flash the application. Run:

This will compile the application and all the ESP-IDF components, generate bootloader, partition table, and application binaries, and flash these binaries to your ESP32 board.
If there are no issues, at the end of the build process, you should see messages describing the progress of the loading process. Finally, the end module will be reset and “hello_world” application will start.


To see if “hello_world” application is indeed running, type.make monitor This command is launching IDF Monitor application:

Several lines below, after startup and diagnostic log, you should see “Hello world!” printed out by the application.

To exit the monitor use shortcut.Ctrl+]

If instead of the messages above, you see a random garbage similar to:

or monitor fails shortly after upload, your board is likely using 26MHz crystal, while the ESP-IDF assumes a default of 40MHz. Exit the monitor, go back to the menuconfig, change ESP32_XTAL_FREQ_SEL to 26MHz, then build and flash the application again.
To execute make flash and make monitor in one go, type.make flash monitor

Issues Observed on Windows

  • If you are using the supported Windows environment and receive the error “winpty: command not found” then run pacman -S winpty to fix.
  • Arrow keys and some other special keys in gdb don’t work, due to Windows Console limitations.
  • Occasionally when “make” exits, it may stall for up to 30 seconds before idf_monitor resumes.
  • Occasionally when “gdb” is run, it may stall for a short time before it begins communicating with the gdbstub.

Eclipse IDE on Windows

Configuring Eclipse on Windows requires some different steps. The full configuration steps for Windows are shown below.
(For OS X and Linux instructions, see the Eclipse IDE page.)

Installing Eclipse IDE

  • Download the Eclipse Installer for your platform from
  • When running the Eclipse Installer, choose “Eclipse for C/C++ Development” (in other places you’ll see this referred to as CDT.)

Setting up Eclipse on Windows

Once your new Eclipse installation launches, follow these steps:

Import New Project

  • Eclipse makes use of the Makefile support in ESP-IDF. This means you need to start by creating an ESP-IDF project. You can use the idf-template project from Github, or open one of the examples in the esp-idf examples subdirectory.
  • Once Eclipse is running, choose File -> Import…
  • In the dialog that pops up, choose “C/C++” -> “Existing Code as Makefile Project” and click Next.
  • On the next page, enter “Existing Code Location” to be the directory of your IDF project. Don’t specify the path to the ESP-IDF directory itself (that comes later). The directory you specify should contain a file named “Makefile” (the project Makefile).
  • On the same page, under “Toolchain for Indexer Settings” uncheck “Show only available toolchains that support this platform”.
  • On the extended list that appears, choose “Cygwin GCC”. Then click Finish.

Note: you may see warnings in the UI that Cygwin GCC Toolchain could not be found. This is OK, we’re going to reconfigure Eclipse to find our toolchain.

Project Properties

  • The new project will appear under Project Explorer. Right-click the project and choose Properties from the context menu.
  • Click on the “C/C++ Build” properties page (top-level):
    • Uncheck “Use default build command” and enter this for the custom build command:python ${IDF_PATH}/tools/windows/
  • Click on the “Environment” properties page under “C/C++ Build”:
    • Click “Add…” and enter name BATCH_BUILD and value.1
    • Click “Add…” again, and enter a name.IDF_PATH The value should be the full path where ESP-IDF is installed. The IDF_PATH directory should be specified using forward slashes not backslashes, ie C:/Users/MyUser/Development/esp-idf.
    • Edit the PATH environment variable. Delete the existing value and replace it with C:\msys32\usr\bin;C:\msys32\mingw32\bin;C:\msys32\opt\xtensa-esp32-elf\bin (If you installed msys32 to a different directory then you’ll need to change these paths to match).
  • Click on “C/C++ General” -> “Preprocessor Include Paths, Macros,etc.” property page:
    • Click the “Providers” tab
      • In the list of providers, click “CDT GCC Built-in Compiler Settings Cygwin”. Under “Command to get compiler specs”, replace the text at${COMMAND} the beginning of the line with.xtensa-esp32-elf-gcc This means the full “Command to get compiler specs” should be xtensa-esp32-elf-gcc ${FLAGS} -E -P -v -dD "${INPUTS}".
      • In the list of providers, click “CDT GCC Build Output Parser” and type atxtensa-esp32-elf- the beginning of the Compiler command pattern. This means the full Compiler command pattern should be xtensa-esp32-elf-(g?cc)|([gc]\+\+)|(clang)

Building in Eclipse

Before your project is first built, Eclipse may show a lot of errors and warnings about undefined values. This is because some source files are automatically generated as part of the esp-idf build process. These errors and warnings will go away after you build the project.

  • Click OK to close the Properties dialog in Eclipse.
  • Outside of Eclipse, open a command line prompt. Navigate to your project directory, and run make menuconfig to configure your project’s esp-idf settings. This step currently has to be run outside Eclipse.

If you try to build without running a configuration step first, esp-idf will prompt for configuration on the command line – but Eclipse is not able to deal with this, so the build will hang or fail.

  • Back in Eclipse, choose Project -> Build to build your project.

TIP: If your project had already been built outside Eclipse, you may need to do a Project -> Clean before choosing Project -> Build. This is so Eclipse can see the compiler arguments for all source files. It uses these to determine the header include paths.

Flash from Eclipse

You can integrate the “make flash” target into your Eclipse project to flash using from the Eclipse UI:

  • Right-click your project in Project Explorer (important to make sure you select the project, not a directory in the project, or Eclipse may find the wrong Makefile.)
  • Select Build Targets -> Create… from the context menu.
  • Type “flash” as the target name. Leave the other options as their defaults.
  • Now you can use Project -> Build Target -> Build (Shift+F9) to build the custom flash target, which will compile and flash the project.

Note that you will need to use “make menuconfig” to set the serial port and other config options for flashing. “make menuconfig” still requires a command line terminal (see the instructions for your platform.)

Spread the love, share this