MCPcopy Index your code
hub / github.com/espressif/vscode-esp-idf-extension

github.com/espressif/vscode-esp-idf-extension @v2.1.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2.1.0 ↗ · + Follow
1,833 symbols 4,856 edges 285 files 55 documented · 3%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

espressif logo

ESP-IDF Extension for VS Code

中文

Espressif Documentation Troubleshooting Version Releases Forum

Develop, build, flash, monitor, debug and more with Espressif chips using Espressif IoT Development Framework (ESP-IDF).

Latest master installer for Visual Studio Code. You can use this VSIX to test the current github master of the extension by pressing F1 or click menu View -> Command Palette..., type Install from VSIX and then select the previously downloaded .vsix file to install the extension.

Make sure to review our Espressif documentation first to properly use the extension.

How to use

Install

  1. Download and install Visual Studio Code.

  2. Install ESP-IDF system prerequisites for your operating system:

  3. Prerequisites for MacOS and Linux.

  4. For Windows there is no additional prerequisites.

  5. In Visual Studio Code, Open the Extensions view by clicking on the Extension icon in the Activity Bar on the side of Visual Studio Code or the View: Show Extensions command (shortcut: X or Ctrl+Shift+X).

  6. Search for ESP-IDF Extension.

  7. Install the extension. After you install the extension, the Espressif icon should appear in the VS Code Activity bar (left side set of icons). When you click the Espressif icon, you can see a list of basic commands provided by this extension.

Commands list

  1. From the command list, select ESP-IDF: Open ESP-IDF Installation Manager or press F1 and type Open ESP-IDF Installation Manager. After, choose the ESP-IDF: ESP-IDF: Open ESP-IDF Installation Manager option.

    NOTE: For versions of ESP-IDF < 5.0, spaces are not supported inside configured paths.

  2. Alternatively, you can download the ESP-IDF Installation Manager from the following link ESP-IDF Installation Manager among the following options::

  3. Espressif: Faster speed in China using Espressif download servers links.

  4. Github: Using github releases links.

  5. Use the ESP-IDF Installation Manager to install the ESP-IDF and tools. If necessary, here is the ESP-IDF Installation Manager Documentation.

  6. In Visual Studio Code, navigate to View > Command Palette and type select current esp-idf version and select ESP-IDF: Select Current ESP-IDF Version from the list. The list of available ESP-IDF setups will be shown, select which one you want to use for the current ESP-IDF project. The selected setup will save a idf.currentSetup with selected ESP-IDF path and the extension will configure environment variables for the current project saved as workspace folder state. You can review the setup by running the ESP-IDF: Doctor Command by navigate to View > Command Palette and type doctor command and select ESP-IDF: ESP-IDF: Doctor Command from the list.

  7. If everything is installed correctly, you will see a message that all settings have been configured. You can start using the extension.

Check the Troubleshooting section if you have any issues.

Using the ESP-IDF Extension for VS Code

This extension provides a list of icons in the status bar (blue bar in the bottom of VS Code window) for ESP-IDF commands. You can see the command to be executed when you hover the icon.

Status bar

These icons will be used in the steps below showing common ESP-IDF use cases:

  1. Press F1 and type ESP-IDF: New Project to create a new project from ESP-IDF examples. Select ESP-IDF and choose an example to create a new project from.

  2. Once the project is created and opened in VS Code, set the serial port of your device by clicking status bar icon serial port. Alternatively, press F1, type ESP-IDF: Select Port to Use, and choose the serial port to which your device is connected.

  3. Select an Espressif target (esp32, esp32s2, etc.) by clicking status bar icon IDF Target. Alternatively, press F1 and type ESP-IDF: Set Espressif Device Target command.

  4. Next, configure your ESP-IDF project by clicking status bar icon sdkconfig editor or press F1 and typing ESP-IDF: SDK Configuration Editor command (CTRL E G keyboard shortcut) where you can modify the ESP-IDF project settings. After all changes are made, click Save and close this window. You can see the output in the menu View -> Output and choose ESP-IDF from the dropdown list.

  5. (OPTIONAL) Run ESP-IDF: Run idf.py reconfigure Task to generate the compile_commands.json file so language support works. Additionally you can configure the .vscode/c_cpp_properties.json as explained in C/C++ Configuration documentation.

  6. At this point, you can modify the code. When the project is completed, build your project by clicking status bar icon build or pressing F1 and typing ESP-IDF: Build your Project.

  7. Flash to your device by clicking status bar icon flash, or pressing F1 and typing ESP-IDF: Flash Your Project. From there, select UART, DFU or JTAG depending on your serial connection, and start flashing the application to your device.

  8. Change the flash method by clicking status bar icon flash method, or pressing F1 and typing ESP-IDF: Select Flash Method to select from UART, DFU or JTAG. You can alternatively use one of the commands ESP-IDF: Flash (UART) Your Project, ESP-IDF: Flash (with JTAG) or ESP-IDF: Flash (DFU) Your Project.

  9. Start a monitor by clicking status bar icon monitor, or pressing F1 and typing ESP-IDF: Monitor Device, which will log the device activity in a Visual Studio Code terminal.

  10. Make sure to configure your drivers as mentioned in ESP-IDF Configure JTAG Interface documentation.

  11. Before debugging your device, if you are using a connected ESP-IDF development board, the OpenOCD configuration will be automatically selected based on your connected board, including the USB location if available (requires OpenOCD version v0.12.0-esp32-20240821 or higher). Otherwise, you can manually select the device OpenOCD board configuration files by pressing F1 and typing ESP-IDF: Select OpenOCD Board Configuration. You can test the connection by clicking status bar icon openocd or pressing F1 and typing ESP-IDF: OpenOCD Manager. The output is shown in the menu View -> Output and choose ESP-IDF from the dropdown list.

    NOTE: You can start or stop the OpenOCD in Visual Studio Code using the ESP-IDF: OpenOCD Manager command or by clicking the OpenOCD Server (Running | Stopped) button in the status bar.

  12. If you want to start a debug session, just press F5 (ensure the project is built, flashed, and OpenOCD is properly connected for the debugger to function correctly). The debug session output can be seen in the menu View -> Debug Console.

Check the Troubleshooting section if you have any issues.

Further reading

Check the ESP-IDF Extension for VS Code Documentation for tutorials, commands and features provided.

All Available Commands

Press F1 or click menu View -> Command Palette... to show Visual Studio code commands, then type ESP-IDF to see all available extension commands.

Category Command Description Keyboard Shortcuts (Mac) Keyboard Shortcuts (Windows/Linux)
Settings Add Docker Container Configuration Add the .devcontainer files to the currently opened project directory, necessary to use a ESP-IDF project in a Docker container with Visual Studio Code Dev Containers extension.
Add VS Code Configuration Folder Add .vscode files to the currently opened project directory. This includes launch.json (for debugging), settings.json and c_cpp_properties.json (for syntax highlight).
Open ESP-IDF Installation Manager Open ESP-IDF Installation Manager (EIM) to install ESP-IDF, IDF Tools and Python virtual environment.
Select Output and Notification Mode This extension shows many notifications and output in the Output window ESP-IDF. This command allows you to set if to show notifications only, output only, both notifications and output, or neither.
Select Where to Save Configuration Settings In Visual Studio Code, settings can be saved in 3 places: User Settings (global settings), workspace ( .code-workspace file) or workspace folder (.vscode/settings.json). More information in working with multiple projects.
Pick a Workspace Folder When using a Visual Studio Code workspace with multiple folders, this command allows you to choose which workspace folder to apply this extension's commands to. More information in working with multiple projects.
Basic Set Espressif Device Target This will set the target for the current project (IDF_TARGET). Similar to idf.py set-target. For example, if you want to use ESP32 or ESP32-C3, you need to execute this command.
SDK Configuration Editor Launch a UI to configure your ESP-IDF project settings. This is equivalent to idf.py menuconfig. I G Ctrl E G
Build Your Project Build your project using `CMake` and `Ninja-build` as explained in ESP-IDF Build System Using Cmake Directly. You could modify the behavior of the build task with idf.cmakeCompilerArgs for Cmake configure step and idf.ninjaArgs for Ninja step. For example, using [-j N] where N is the number of jobs run in parallel. I B Ctrl E B
Size Analysis of the Binaries Launch UI with the ESP-IDF project binaries size information. I S Ctrl E S
Select Port to Use Select which serial port to use for ESP-IDF t

Extension points exported contracts — how you extend this code

MIBreakInsertResponseInternal (Interface)
* The generic MI Parser (see MIParser.handleAsyncData) cannot differentiate * properly between an array or single resul
src/cdtDebugAdapter/adapter/mi/breakpoint.ts
IFileInfo (Interface)
(no doc)
src/IPackage.ts
ISpawnOptions (Interface)
(no doc)
src/utils.ts
IProjectDescription (Interface)
(no doc)
src/workspaceConfig.ts
IEspIdfTool (Interface)
(no doc)
src/idfToolsManager.ts
IdfTaskDefinition (Interface)
(no doc)
src/taskManager.ts
ProjectConfElement (Interface)
(no doc)
src/project-conf/projectConfiguration.ts
IKconfigSettings (Interface)
(no doc)
src/kconfig/server.ts

Core symbols most depended-on inside this repo

errorNotify
called by 155
src/logger/logger.ts
readParameter
called by 121
src/idfConfiguration.ts
registerIDFCommand
called by 107
src/extension.ts
error
called by 103
src/logger/logger.ts
get
called by 101
src/common/store.ts
appendLine
called by 97
src/logger/outputChannel.ts
info
called by 91
src/logger/logger.ts
on
called by 68
src/espIdf/openOcd/tcl/tclClient.ts

Shape

Method 824
Function 563
Class 253
Interface 165
Enum 28

Languages

TypeScript99%
Python1%
C1%
C++1%

Modules by API surface

src/cdtDebugAdapter/adapter/GDBDebugSession.ts77 symbols
src/utils.ts70 symbols
src/cdtDebugAdapter/imageViewPanel.ts41 symbols
src/espIdf/debugAdapter/peripheralTreeView.ts31 symbols
src/cdtDebugAdapter/adapter/GDBBackend.ts31 symbols
src/views/tracing/store.ts28 symbols
src/extension.ts27 symbols
src/espIdf/menuconfig/confServerProcess.ts27 symbols
src/taskManager/customExecution.ts26 symbols
src/espIdf/hints/index.ts26 symbols
src/espIdf/debugAdapter/nodes/register.ts26 symbols
src/espIdf/debugAdapter/nodes/peripheral.ts24 symbols

For agents

$ claude mcp add vscode-esp-idf-extension \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page