ComputingInternet Of ThingsProgramming

Esp32 Development Environment

I’ve tried:

  • Arduino IDE : good. Heaps of support and tutorials. Some key limitations for ESP32, such as sleep modes.
  • ESP-IDF with Eclipse: messy to setup. Works okay. However, my PC is a bit slow for Eclipse. I switched to Arduino IDE.

Now I need more detailed functions (available via menuconfig) in Esp32. Two more options:

  • PlatformIO : no expereince but is well respected. Apparently it doesn’t use menuconfig / CMake. I want to be closed to the hardware.
  • ESP-IDF with CMake and VSCode.

Trying this now. CMake will soon (2019) become the “default build system” and I’m somewhat familiar with it. Therefore I’ll use the preview release of ESP-IDF.

Exciting new: latest branch worked standalone but failed on adding Arduino Libraries (see below). Restarted with “stable” versions (toolchain and ESP-IDF with -v3.2.2), this is ok.

Step on install ESP-IDF and VSC on Linux Ubuntu x64:

# Install .deb from
# Install prerequisites:
# Install ESP-IDF (stable is -b v3.2.2)
# Install toolchain (stable)

At that point, before setting up VSCode, I check ESP-IDF runs okay with hello world. Use “make -j8” to speed things up!

  • Works OK for a TTGO ESP32
  • Fail for Firebeetle: make monitor has no output. Known problem. Firebeetle a no go.

Okay, back to VSCode. Only Windows notes, but adapt a boilerplate solution. I managed to adapt this to linux, except:

  • Some intellisense doesn’t work (perhaps just the #defines). Fine.
  • make monitor doesn’t work. Fine: use command line or in-built terminal

Great! This works really nicely. Some further work could improve the tasks and integrate the monitor, but it’s fast and easy. Intellisense is great.

Adding Arduino Libraries to ESP-IDF

Heaps of code, including vital stuff like ArduinoJSON, is written for Arduino. Hence I need to add Arduino Esp32 as a “component”. Using the latest git branches (July 2019) resulted in compile errors. Using the stable version worked okay with these changes:

  • Adjust this setting to prevent compiler error
  • Set flash size to 4MB
  • Ensure files are “.cpp” not “.c”
  • Add extern “C” {} around app_main()

For additional libraries, I generally did this (good docs here on the ESP system):

cd ~/esp/myproject/components/arduino/libaries/
git clone http://blah
cd ~/esp/myproject/
# reset - *important* to get new libraries to work
make clean menuconfig
make -j8

According to the docs, we can put components at ESP-IDF or Project Level. For third-party, unchanging Arduino libaries, probably ESP-IDF Level makes sense. Project level makes everything in one place. You can there use either

$IDF_PATH/components/          # eg. ~/esp/esp-idf/components
# or 
$(PROJECT_PATH)/components     # eg. ~/esp/myproject/components

Some libraries just work, others need some massaging. These work fine:

  • ArduinoJSON
  • ezTime


Add a CMakeLists.txt to explicitly define “ESP32” is required to compile and for VSCode to understand includes

# ~/esp/components/ardiuno/libaries/RemoteDebug
cmake_minimum_required(VERSION 3.0)


Compiles okay, but seems to not play nice with ESP32 Wifi:

*WM: Connecting as wifi client…
*WM: Using last saved values, should be faster
E (374) wifi: esp_wifi_disconnect 975 wifi is not init
W (374) wifi: wifi osi_nvs_open fail ret=4353

Since I want to control WiFi carefully (for battery mode), I’ll change to another method without Arduino. Maybe try\


After git clone, had to move files to root directory, instead of wifi_manager/wifi_manager. Many other changes were required to get it to build. It run okay, but crashed (fixed), crashed again (couldn’t fix) on destroy. Looks promising but not a goer.

Leave a Reply

Your email address will not be published. Required fields are marked *