Platform-esp32 - How to update esp-idf

My project uses the espidf and the arduino platform:

platform = espressif32
framework = arduino, espidf

I found out that PlatformIO installs version 4.0.1 (from version.txt) or version 4.0.0 (from but I think this is an error, because the tag in the GitHub repo also contains the wrong version number.
I want to upgrade it to 4.0.4. What is the correct way to change it? Which files do I have to modify?

There is special code in platform-espressif32 to use the espidf package of, what PlatformIO calls, 4.0.1.

Per PlatformIO Registry PlatformIO does not the 4.0.1 version in store.

The only viable way I see is to either ask the developers to upgrade it (though that’s unlikely because they’re still stuck in Arduino core issues), or fork platform-espressif32 and modify the above shown code plus the platform.json in regards to the package source for ESP-IDF.

Using a git URL as version will make PlatformIO use that repo. You should create a repo (or fork ESP-IDF) and put a package.json akin to what’s locally in C:\Users\<user>\.platformio\packages\framework-espidf\pacakge.jsoon in the repro (while declaring 4.0.4 as the version).

Hi @maxgerhardt

thanks for the response. Please let me summarize the steps:

  • I fork platform-espressif32
  • I modify of the fork to support all versions below 4.1 as an example
  • I modify package.json with a github link for espidf 4.0.4. How does the link has to look like? Can I use GitHub - espressif/esp-idf at v4.0.4?
  • I will use the fork as platform in my platformio.ini

You don’t need to support all versions, in your fork you can also ‘destroy’ support for all other ESP-IDF versions, if you onyl use your custom platform for your project and that one ESP-IDF version. All
other projects can still use the mainline platform = espressif32. You also have to modify platform.json in regards to the version field for framework-espidf to point at your ESP-IDF fork + branch for v4.0.4.

As base yes, but you have to add the package.json in there too. The easiest is always a fork and the upload of the package.json via the web interface, that’s how I did it in GitHub - maxgerhardt/esp-idf at release/v4.4.

The rest seems all correct.