How to convert an ESP-IDF example project to run under Platformio

I found a solution to converting an ESP-IDF example project to run on Platformio. This works for Windows 11, using Visual Studio Code and the Platformio extension. I used the hello_world example as a test.

Create the example project from the EP-IDF examples. from the Expressif extension in Visual Studio Code. Build the project, Will create the build folder.

Rename the main folder to src, this is the folder that contains your hello_world_main.c file.

Add a platformio.ini file to your project.

Select the Gear icon (visual Studio Code, lower left of IDE) and select the Setting link.
Search for “C_Cpp.default.includePath

Add the path to your esp-idf components folder :i.e

C:\Users <user name>\esp\v5.2.1\esp-idf\components
(or wherever you installed your esp-idf)

Save the project and restart Visual Studio Code.

Any ESP-IDF #include issues are now resolved.

You can build, upload, run and even debug the esp-idf project using either a built in jtag debugger or an esp-prog jtag debugger, directly from Platformio, using the PIO Debug option.