I found out that PlatformIO installs version 4.0.1 (from version.txt) or version 4.0.0 (from version.mk- 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?
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).
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.