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 installed via EIM (Windows / Ubuntu / macOS)
- Your board connected via USB
Step 1 — Install the ESP-IDF Extension
- Open VS Code
- Press
Ctrl+Shift+X(orCmd+Shift+Xon macOS) to open the Extensions panel - Search for "ESP-IDF"
- Install the extension by Espressif Systems
Step 2 — Configure the Extension
Open the Command Palette (Ctrl+Shift+P / Cmd+Shift+P) and run:
ESP-IDF: Configure ESP-IDF Extension
In the setup wizard:
- Select "Use existing installation"
- Point to your EIM-managed ESP-IDF path:
- Windows:
C:\Users\<you>\.espressif\esp-idf-v6.0 - Ubuntu/macOS:
~/.espressif/esp-idf-v6.0
- Windows:
- Select the corresponding tools folder (
~/.espressif/tools) - Click "Save settings"
VS Code will validate the paths and show a green checkmark when configured correctly.
Step 3 — Open Your Project
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:
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:
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:
| Action | Command Palette | Status Bar |
|---|---|---|
| Build | ESP-IDF: Build your Project | ⚙️ Build |
| Flash | ESP-IDF: Flash your Project | ⚡ Flash |
| Monitor | ESP-IDF: Monitor Device | 📟 Monitor |
| Build + Flash + Monitor | ESP-IDF: Build, Flash and Start a Monitor on your Device | 🔥 |
Keyboard Shortcuts
| Action | Windows/Linux | macOS |
|---|---|---|
| Build | Ctrl+E B | Cmd+E B |
| Flash | Ctrl+E F | Cmd+E F |
| Monitor | Ctrl+E M | Cmd+E M |
| Build+Flash+Monitor | Ctrl+E D | Cmd+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).
- Connect your JTAG probe to the board's JTAG pins
- Open the Run and Debug panel (
Ctrl+Shift+D) - Click "Create a launch.json file" → select "ESP-IDF Debug"
- Press
F5to start a debug session
You can set breakpoints, inspect variables, and step through code line by line.
Recommended VS Code Extensions (Install All)
| Extension | Publisher | Purpose |
|---|---|---|
| ESP-IDF | Espressif Systems | Core ESP32 development |
| C/C++ | Microsoft | IntelliSense, syntax highlighting |
| CMake Tools | Microsoft | CMake project support |
| Serial Monitor | Microsoft | Better serial terminal |
| GitLens | GitKraken | Git history and blame |

