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


Step 1 — Install the ESP-IDF Extension

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

Step 2 — Configure the Extension

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

text
ESP-IDF: Configure ESP-IDF Extension

In the setup wizard:

  1. Select "Use existing installation"
  2. Point to your EIM-managed ESP-IDF path:
    • Windows: C:\Users\<you>\.espressif\esp-idf-v6.0
    • Ubuntu/macOS: ~/.espressif/esp-idf-v6.0
  3. Select the corresponding tools folder (~/.espressif/tools)
  4. Click "Save settings"

VS Code will validate the paths and show a green checkmark when configured correctly.


Step 3 — Open Your Project

text
File → Open Folder → select your hello_world project directory

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


Step 4 — Set the Target Chip

Open the Command Palette and run:

text
ESP-IDF: Set Espressif Device Target

Select your chip (e.g., esp32, esp32s3, esp32c6).

You can also see and change the target in the status bar at the bottom of VS Code.


Step 5 — Select the Serial Port

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

text
ESP-IDF: Select Port to Use

Choose your board's COM port (Windows) or /dev/ttyUSB0 (Linux) or /dev/cu.* (macOS).


Step 6 — Build, Flash, and Monitor

Use the buttons in the VS Code status bar or run these commands from the Command Palette:

ActionCommand PaletteStatus Bar
BuildESP-IDF: Build your Project⚙️ Build
FlashESP-IDF: Flash your Project⚡ Flash
MonitorESP-IDF: Monitor Device📟 Monitor
Build + Flash + MonitorESP-IDF: Build, Flash and Start a Monitor on your Device🔥

Keyboard Shortcuts

ActionWindows/LinuxmacOS
BuildCtrl+E BCmd+E B
FlashCtrl+E FCmd+E F
MonitorCtrl+E MCmd+E M
Build+Flash+MonitorCtrl+E DCmd+E D

Step 7 — IntelliSense and Code Navigation

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

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

First-time IntelliSense setup

IntelliSense may take a few minutes to index all ESP-IDF headers after opening a project. You'll see a spinning icon in the bottom right corner. Wait for it to finish before expecting full autocomplete.


Using the EIM Manager from VS Code

The ESP-IDF extension integrates with EIM directly. To manage your ESP-IDF versions:

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

This opens EIM's interface inside VS Code where you can:

  • Install additional ESP-IDF versions
  • Switch between versions for different projects
  • Update the active installation

Debugging with JTAG

Requires JTAG hardware

JTAG debugging requires either a 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).

  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, and step through code line by line.


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

Next Steps

Previous
Your First Project