Updating Arduino_esp32 and esp-idf

I’m hoping to get a little lesson on the layout of things when using Platformio to develop for ESP32.

I currently am successfully building using VSCode and Platformio, using mostly Arduino ESP32, but here and there I use the esp-idf.

In my platformio.ini file, I specify versions for some of the libraries I use. However, I see no indication of what version of Arduino_esp32 or esp_idf are used.

In my ESP32 program, if I call ESP.getSdkVersion() I get 4.4.5. If I am not mistaken, that framework is up to 5.1.1. How do I upgrade to the latest, or am I gated on Platformio to incorporate it into their updates?

How can I learn about:

  • the relationship between these building blocks; I know the arduino_esp32 uses esp_idf; platformio build both of those into something else?
  • where do these frameworks live on my drive? I had a hell of a time trying to duplicate my desktop environment onto a laptop because it was not finding esp_idf. I resorted to blindly installing everything, and I never learned where these pieces were installed.
  • how do I upgrade, or specify not to upgrade, these frameworks as new ones are released? I expected that to be part of the platformio.ini file.

Here’s my setup:
PLATFORM: Espressif 32 (6.4.0) > Espressif ESP32-C3-DevKitM-1
HARDWARE: ESP32C3 160MHz, 320KB RAM, 4MB Flash
PACKAGES:

  • framework-arduinoespressif32 @ 3.20011.230801 (2.0.11)
  • tool-esptoolpy @ 1.40501.0 (4.5.1)
  • toolchain-riscv32-esp @ 8.4.0+2021r2-patch5

Thank you for any help and pointers.

That is correct for your current shown Arduino-ESP32 version of

Since per https://github.com/espressif/arduino-esp32/releases

When using framework = arduino in an ESP32 project, PlatformIO builds the project exactly as in the Arduino IDE: It compiles Arduino-ESP32, and that links in a statically precompiled version of ESP-IDF in the version that is indicated in the releases. These precompiled files live inside the Arduino-ESP32 package, see e.g. here.

As thus, neither the Arduino IDE nor PlatformIO build ESP-IDF from source in a regular Arduino project.

However, PlatformIO does have the special capability to create an ESP-IDF base project, on which the Arduino-ESP32 core is added on top (Arduino-ESP32 as an ESP-IDF component). That’s what happening in the reference project with framework = arduino, espidf.

All PlatformIO packages are stored in C:\Users\<user>\.platformio\packages unless specified otherwise in the platformio.ini. For example, in the most basic framework = arduino project, the package for Arduino-ESP32 will be inside there as framework-arduinoespressif32. Similiarly for framework-espidf.

PlatformIO does not update your platform (“Espressif32” e.g.) by default. Usually, when using only official resources, you can affect the used framework versions (such as Arduino-ESP32 version x.y.z) by chosing a platform version that uses the wanted version. See https://github.com/platformio/platform-espressif32/releases for available platform versions and which framework versions they used / were upgraded. See docs on how to specify a wanted version.

Of course, PlatformIO also has the capability to source packages (such as framework-arduinoespressif32) from other sources. Manually post-adjusting these packages (i.e. chosing a different version than what the platform would have dictated) is done in platform_packages. For regular projects, you should stick with official versions via platform though.

1 Like