How to give the framework option to the "pio init" command?

I want to know how to set the option of the pio init.

In an existing created project,
It used “pio init -besp32dev --ide=vscode”.
The “c_cpp_properties.json” file in the “.vscode” folder has the includePath as “/.platformio/packages/framework-arduinoespressif32/”.

I want to replace “includePath” with “/.platformio/packages/framework-espidf/”.

Does anyone know which option I should use?

See documentation.

pio init -b esp32dev -O "framework = espidf" --ide=vscode

generates the platformio.ini

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = espidf

with the appropriate .vscode/c_cpp_properties.json

Also, you don’t need to really customize the pio init command to be ‘perfect’. You can really generate any platformio.ini and then just generate that file afterwards and re-initialize the VSCode files with just pio init --ide=vscode. (VSCode will also auto-refresh the IntelliSense when it detects changes to the platformio.ini). You’re supposed to be able to edit the platformio.ini on the fly and PlatformIO will respect the changes and rebuild accordingly.

So really one can do a pio init -b uno for an Arduino Uno board + Arduino, edit the file to an ESP32 board and platform and ESP-IDF, and VSCode will pickup the change and reload files accordingly…

1 Like

Thank you.
I’ve followed your guide, and I’ve got some progress. I will read the document again and proceed.