Setup ESP32 development environment under Linux

Brief intro

As for me, comfortable and convenient development environment plays a great role in code quality, that a developer can produce. That is why my acquaintance with ESP32 began with a little research on this topic.

The bases

Official development framework for Esp32 is esp-idf. That means all other frameworks will be based on this library.

Esp-idf is a c language framework. So if you are ready to use low abstraction level in your program, this is enough for you. As for me, the use of classes is preferable. I was looked for a library with a higher level of abstraction for common things such as work with Serial or Bluetooth. So my choice is actively developed c++ library  Arduino-esp32. Esp-idf library supports the use of mixed c/c++ code and includes Arduino-esp32 library as a component of your project.

Next thing is a text editor for your code or maybe a whole IDE. It depends on… My choice was between Arduino IDE, PlatformIO project, Eclipse, and CLion. The last one would be ideal for me, but it supports only CMake build system. Of course, it is possible to tune it in some way, but in practice, it seems it is impossible to maintain it due to the fact, that both libraries are actively developed. Arduino IDE is for small programs and too simple in functions, and I have in plans quite a big project. PlatformIO quite interesting project and may be used, but my choice is Eclipse.

Next thing is a terminal, that supports connect through serial, for e.g. minicom or PuTTy. Up to your choice. I select PuTTy.

And the last thing is debugging. Debugging requires some additional hardware and software. I think it is topic for a separate article. I hope I’ll write it. Or you may read the official debugging guide.


Tool-chain and esp-idf

I assume that all installation will be inside directory ~/Esp32

First of all, we must install the Toolchain. Follow this guide to complete setup. The next step is to get esp-idf framework and setup path to it. Follow this guide to complete this two steps.

If you are looking for a detailed understanding of setup esp-idf framework please read this full guide.

Base project

As a template for your future application, I recommend taking esp-idf-template. You may use clone command of git.

cd ~/Esp32

git clone myproject
cd myproject

Using Arduino framework

How to add Arduino-esp32 as a component to your project you can find here. Don’t forget to change the extension of the main file to cpp if you want it to be treated by the system as c++ file and run c++ compiler.


As you remember, we create our project under ~/Esp32 directory. But as a concept of Eclipse directory structure, it must be located in the workspace directory.

So, first of all, start Eclipse and create the new workspace in ~/Esp32 directory. Then move your newly created project to workspace directory. Try to create the new project with the same name. Eclipse will find an existing project and import it.

Create additional environment variables for your project. Properties->C/C++Build->Environment. Add IDF_PATH variable and add the path to toolchain into PATH variable.

In Properties->C/C++Build uncheck “Use default build command” so the build command must be simple “make”.

Next thing is to add additional directories for includes. So go to Properties->C/C++ General->Paths and Symbols and the following directories in CNU C tab:

/yourapp/build/include as a workspace path

Last thing to do – create Build Targets. We need to targets, one for all as simple “make” command and another one for flash as the “make flash” command. That’s all.