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.