How to use ESPIDF 4.1 or greater?

I try to get an project working, which needs at least ESP-IDF 4.1. When searching for information, I find an announcement from Espressif, that PIO supports it (PlatformIO Support for ESP-IDF v4.1 | Espressif Systems), I see several informations in the online documentation (e.g. Espressif IoT Development Framework — PlatformIO latest documentation), but I get only offered Espressif 32 v3.2.0

I work with PIO 5.1.1 under VSCode (Win10). When trying to install a newer version under “embedded” I only see ESP-IDF Versions up to 3.2.

When I put the following line in my projects platform.ini:

platform = espressif32@>4.1.0

and enter: ‘pio run -t menuconfig’ I receive the error message:

Could not find the package with ‘espressif32 @ >4.1.0’ requirements for your system ‘windows_amd64’

Any hints, what needs to be done to get at least a version 4.1 from ESPIDF working under PIO?

The Platform Espressif32 versions are distinct from the ESP-IDF version. In PlatformIO terms, the platform (e.g. platform-espressif32) is the general base hosting all board definitions and builder code), the actual framework code is a package, e.g. framework-espidf or framework-arduinoespressif32.

Available platform versions are listed at Releases · platformio/platform-espressif32 · GitHub and are default-tied to a ESP-IDF version. E.g., the latest 3.2.0 version uses ESP-IDF v4.2, which already satisfies your requirements.

So, if you declare platform = espressif32@>=3.2.0 you will always get at least ESP-IDF v4.2. You can also use just platform = espressif32 and make sure that your locally installed platform is up-to-date, either via the PIO Home → Platforms → Updates GUI or via the CLI and pio platform update.

Lastly, PlatformIO has the feature of platform_packages, letting you select a source or a version for each package. In conjunction with listed versions of e.g. framework-espidf, you can then say

; use ESP-IDF 4.2.0
platform_packages = 
    framework-espidf@~3.40200.0

in the platformio.ini to control it very fine-grained. But, in this case, just selecting the platform version will suite you just fine.

Thanks for the answer, it helped me a little bit further. I have not realized, that espidf-v4.2 works under the hood of the v3.2 pio-extension.
Perhaps it would be helpful, if pio platform list could also list the version numbers of the tool-chains.

One reason, that I have not understood, which espidf-toolchain works under the hood is, that the configuration dialog is missing several entries. I will open another thread with questions regarding this.

How could you tell which version of esp-idf is the default for each platform-espressif32? Isn’t this something that should be obviously displayed somewhere.

  1. At the start of a compilation log, the version of each package is clearly displayed. (look for framework-espidf)
  2. The release pages state each update. https://github.com/platformio/platform-espressif32/releases, by which the version used in that version up to the version that again does an update can be inferred
  3. The platform.json file states each version per update, e.g.,

Meaning 5.0.2 nominally, 4.4.4 when used in Arduino+ESP-IDF projects, refer here.

1 Like