Configure Your Project
Select an Espressif target (esp32, esp32s2, etc.) by going to View > Command Palette and entering ESP-IDF: Set Espressif Device Target command.
If you are using a connected ESP-IDF development board, the OpenOCD configuration will be automatically selected based on your connected board. Otherwise, you can manually select the OpenOCD configuration by going to View > Command Palette and entering ESP-IDF: Select OpenOCD Board Configuration.
Note
Please refer to Configuration of OpenOCD for Specific Target to select the appropriate OpenOCD configuration file based on your hardware.
Next, configure your project. Go to View > Command Palette and enter ESP-IDF: SDK Configuration Editor to adjust ESP-IDF project settings.
After making changes, click save and close the window.
Next, proceed to Build Your project.
Adding ESP-IDF Components
The ESP Component Registry is a collection of ESP-IDF components that can be easily added to your project. You can browse the registry, install components and create new ESP-IDF projects from component examples directly from Visual Studio Code.
In Visual Studio Code:
Navigate to
View>Command Palette.Type
ESP-IDF: Show ESP Component Registryand select the command to open the ESP Component Registry UI.
The ESP-IDF: Show ESP Component Registry command launches a UI showing the ESP Component Registry.
You can browse various ESP components and install them in your current ESP-IDF project using the Install button.
For more information, refer to ESP Component Registry Documentation.
Using other ESP solutions
If you are working with ESP solutions such as ESP-Matter or ESP-RainMaker, chances are you will find them in the ESP Component Registry and you can either create projects from their examples or install the component in your current ESP-IDF project.
In case you want to use the main branch of these ESP solutions, you just need to define the exported environment variables in your project’s .vscode/settings.json file using the idf.customExtraVars VS Code configuration setting.
For example, for ESP-Matter you need to define the ESP_MATTER_PATH variable with the path to your local ESP-Matter repository:
{
"idf.customExtraVars": {
"ESP_MATTER_PATH": "/path/to/esp-matter"
}
}
or you can do it from the Settings UI of Visual Studio Code:
Navigate to
View>Command Palette.Type
Preferences: Open Settings (UI)and select the command to open the Settings UI. Select theWorkspacetab to edit the settings for the current workspace (your ESP-IDF project) orUsertab to edit the settings for all VS Code instances.Search for
idf custom extra varsoridf.customExtraVars.Click on
Add Itemand add the variable name (e.g.,ESP_MATTER_PATH) and its value (e.g.,/path/to/esp-matter).