ESP32 — ESP-IDF v6

VS Code Integration — ESP-IDF

Visual Studio Code with the ESP-IDF extension gives you a complete IDE experience — IntelliSense, one-click build/flash, an integrated serial monitor, and JTAG debugging.


Prerequisites

  • VS Code installed (code.visualstudio.com)
  • ESP-IDF v6.0.1 installed via EIM — Windows Setup →
  • Your board connected via USB with drivers installed
  • COM port identified from Device Manager (e.g., COM3)

Install ESP-IDF via EIM first

The VS Code extension does not install ESP-IDF on its own. Complete the Windows Setup guide before continuing here.


Step 1 — Install VS Code

Download from code.visualstudio.com.

On Windows — choose the System Installer, not the User Installer. This avoids permission issues with ESP-IDF build tools.


Step 2 — Install the ESP-IDF Extension

  1. Open VS Code
  2. Press Ctrl+Shift+X to open the Extensions panel
  3. Search for "ESP-IDF" VS Code Extension
  4. Install the extension by Espressif Systems

Install the correct extension

Make sure the publisher is Espressif Systems — extension ID espressif.esp-idf-extension. There are similar-looking extensions from other publishers — install the official one only.

VS Code Extension


Step 3 — Point the Extension to Your ESP-IDF Installation (Optional)[This Set's Automatically in v6.0.1]

Since ESP-IDF v6.0.1 is already installed via EIM, you just need to select it:

Open the Command Palette (Ctrl+Shift+P) and run:

text
ESP-IDF: Select Current ESP-IDF Version

VS Code Extension

A dropdown appears showing all ESP-IDF versions detected on your machine. Select ESP-IDF v6.0.1.

VS Code Extension

The extension saves this as the active setup for your current workspace.

Verify the setup

Run ESP-IDF: Doctor Command from the Command Palette to confirm everything is configured correctly. You should see green OK status for ESP-IDF, Python, CMake, Ninja, and OpenOCD.

Multiple versions

If you have multiple ESP-IDF versions installed via EIM, you can switch between them anytime using ESP-IDF: Select Current ESP-IDF Version. Each workspace can use a different version independently.


Step 4 — Open Your Project [Optional - you can create a new project using the extension also - See below]

text
File → Open Folder → select your project directory

The extension automatically detects CMakeLists.txt and configures IntelliSense for all ESP-IDF headers.

To create a new project instead of opening an existing one:

  1. Press Ctrl+Shift+P
  2. Type ESP-IDF: New Project
  3. Select a template — use get-started/hello_world for a basic test
  4. Set project name, location (no spaces in path), and target chip
  5. Click Create ProjectOpen Project

Step 4 — Create a New Project Using VSCode ESP-IDF Extension

Other way you can just use the VSCode ESP-IDF Extension to create the project also . Follow the below steps

  1. Click on the ESP-IDF Icon in the VS Code sidebar

VS Code Extension

  1. Click on New Project

VS Code Extension

  1. Select a template — use get-started/hello_world for a basic test

VS Code Extension 4. Set project name, location (no spaces in path), and target chip

VS Code Extension

  1. Click Create ProjectOpen Project

VS Code Extension


Step 5 — Set the Target Chip

Open the Command Palette and run:

text
ESP-IDF: Set Espressif Device Target

Select your chip — esp32, esp32s3, esp32c3, or esp32c6.

You can also click the target chip name in the VS Code status bar at the bottom to change it quickly.


Step 6 — Select the Serial Port

Click the serial port icon in the VS Code status bar, or run:

text
ESP-IDF: Select Port to Use

Choose your board's COM port from the list — e.g., COM3.


Step 7 — Build, Flash and Monitor

Use the status bar buttons or the Command Palette:

ActionCommand PaletteStatus Bar
BuildESP-IDF: Build your Project🔨 Build
FlashESP-IDF: Flash your Project⚡ Flash
MonitorESP-IDF: Monitor your Device🖥 Monitor
Build + Flash + MonitorESP-IDF: Build, Flash and Monitor🔥

Use UART for flashing

When prompted to select a flash method — always choose UART for standard ESP32 boards. JTAG is for advanced debugging only.

Keyboard Shortcuts

ActionWindows/Linux
BuildCtrl+E B
FlashCtrl+E F
MonitorCtrl+E M
Build + Flash + MonitorCtrl+E D
Exit MonitorCtrl+]

Step 8 — IntelliSense and Code Navigation

After building once, VS Code has full IntelliSense for all ESP-IDF APIs:

  • Auto-complete for all IDF functions — gpio_set_level, esp_wifi_init, xTaskCreate, etc.
  • Go to definition (F12) — jump directly to ESP-IDF source
  • Hover documentation — see function signatures and descriptions inline
  • Error highlighting — build errors shown in the editor before you compile

IntelliSense takes a moment

After opening a project for the first time, IntelliSense needs a few minutes to index all ESP-IDF headers. A spinning icon appears in the bottom right corner — wait for it to finish before expecting full autocomplete.

If IntelliSense is not working after building, regenerate the configuration:

  1. Press Ctrl+Shift+P
  2. Type ESP-IDF: Add .vscode Configuration Folder
  3. Run the command — this recreates c_cpp_properties.json with correct include paths

Step 9 — Menuconfig (Project Configuration)

To configure project-specific settings — WiFi credentials, FreeRTOS tick rate, log levels, partition tables:

  1. Press Ctrl+Shift+P
  2. Type ESP-IDF: SDK Configuration Editor
  3. Run the command

A graphical menuconfig interface opens inside VS Code. This is easier to use than the terminal version.


Manage ESP-IDF Versions from VS Code

The extension integrates with EIM directly. To manage your installations:

Open Command Palette → ESP-IDF: Open ESP-IDF Installation Manager

This launches EIM inside VS Code where you can:

  • Install additional ESP-IDF versions
  • Switch between versions for different projects
  • Update or repair an existing installation

Debugging with JTAG (Advanced)

Requires JTAG hardware

JTAG debugging requires either a dedicated JTAG probe (e.g., ESP-Prog, J-Link) or an ESP32 board with built-in USB-JTAG (e.g., ESP32-S3 DevKitC, ESP32-C6 DevKitC). Standard ESP32 DevKit boards do not have built-in JTAG — skip this section if you are using a standard board.

  1. Connect your JTAG probe to the board's JTAG pins
  2. Open the Run and Debug panel — Ctrl+Shift+D
  3. Click "Create a launch.json file" → select "ESP-IDF Debug"
  4. Press F5 to start a debug session

You can set breakpoints, inspect variables, watch memory regions, and step through code line by line.


Install all of these for the best ESP-IDF development experience in VS Code:

ExtensionPublisherPurpose
ESP-IDFEspressif SystemsCore ESP32 development
C/C++MicrosoftIntelliSense, syntax highlighting
CMake ToolsMicrosoftCMake project support
Serial MonitorMicrosoftBetter serial terminal
GitLensGitKrakenGit history and blame

Troubleshooting

Extension not detecting ESP-IDF

Run ESP-IDF: Doctor Command. Then run ESP-IDF: Select Current ESP-IDF Version and manually select your v6.0.1 installation.

COM port not visible

Make sure USB drivers are installed (CP210x or CH340), board is connected, and no other application is using the port. Unplug and replug the board.

IntelliSense errors but build works fine

Run ESP-IDF: Add .vscode Configuration Folder to regenerate include path configuration.

Flash fails — port access denied

Close Arduino IDE, PuTTY, or any serial monitor using the same COM port.


Next Steps

Previous
Your First Project