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.
Download and install Visual Studio Code.
Install ESP-IDF system prerequisites for your operating system:
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).
Search for ESP-IDF Extension.
Install the extension. After you install the extension, the 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.
Configure ESP-IDF Extension
. After, choose the ESP-IDF: Configure ESP-IDF Extension option.
NOTE: For versions of ESP-IDF < 5.0, spaces are not supported inside configured paths.
Pick an ESP-IDF version to download or the Find ESP-IDF in your system
option to search for existing ESP-IDF directory.
Choose the location for ESP-IDF Tools (also known as IDF_TOOLS_PATH
) which is $HOME\.espressif
on MacOS/Linux and %USERPROFILE%\.espressif
on Windows by default.
If your operating system is MacOS/Linux, choose the system Python executable to create ESP-IDF virtual environment inside ESP-IDF Tools and install ESP-IDF Python package there.
NOTE: Windows users don't need to select a Python executable since it is going to be installed by this setup.
Make sure that IDF_TOOLS_PATH
doesn't have any spaces to avoid any build issues. Also make sure that IDF_TOOLS_PATH
is not the same directory as IDF_PATH
.
You will see a page showing the setup progress status, including ESP-IDF download progress, ESP-IDF Tools download and install progress as well as the creation of a Python virtual environment.
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 CodeThis 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.
These icons will be used in the steps below showing common ESP-IDF use cases:
Press F1 and type ESP-IDF: Show Example Projects to create a new project from ESP-IDF examples. Select ESP-IDF and choose an example to create a new project from.
Once the project is created and opened in VS Code, set the serial port of your device by clicking status bar icon . Alternatively, press F1, type ESP-IDF: Select Port to Use, and choose the serial port to which your device is connected.
Select an Espressif target (esp32, esp32s2, etc.) by clicking status bar icon . Alternatively, press F1 and type ESP-IDF: Set Espressif Device Target command.
Next, configure your ESP-IDF project by clicking status bar icon 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.
(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.
At this point, you can modify the code. When the project is completed, build your project by clicking status bar icon or pressing F1 and typing ESP-IDF: Build your Project.
Flash to your device by clicking status bar icon , 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.
Change the flash method by clicking status bar icon , 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.
Start a monitor by clicking status bar icon , or pressing F1 and typing ESP-IDF: Monitor Device, which will log the device activity in a Visual Studio Code terminal.
Make sure to configure your drivers as mentioned in ESP-IDF Configure JTAG Interface documentation.
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 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.
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.
Check the ESP-IDF Extension for VS Code Documentation for tutorials, commands and features provided.
Press F1 or click menu View
-> Command Palette...
to show Visual Studio code commands, then type ESP-IDF to see all available extension commands.
tasks.json
and launch.json
We have implemented some utilities commands that can be used in tasks.json
and launch.json
like:
"miDebuggerPath": "${command:espIdf.getToolchainGdb}"
espIdf.getExtensionPath
: Get the installed location absolute path.espIdf.getOpenOcdScriptValue
: Return the value of OPENOCD_SCRIPTS computed from ESP-IDF Tools path, idf.customExtraVars
, or the system's OPENOCD_SCRIPTS environment variable.espIdf.getOpenOcdConfig
: Return the openOCD configuration files as string. Example -f interface/ftdi/esp32_devkitj_v1.cfg -f board/esp32-wrover.cfg
.espIdf.getProjectName
: Return the project name from current workspace folder build/project_description.json
.espIdf.getToolchainGcc
: Return the absolute path of the toolchain GCC for the ESP-IDF target given by current IDF_TARGET in sdkconfig or idf.customExtraVars
["IDF_TARGET"] configuration setting.espIdf.getToolchainGdb
: Return the absolute path of the toolchain gdb for the ESP-IDF target given by current IDF_TARGET in sdkconfig or idf.customExtraVars
["IDF_TARGET"] configuration setting.espIdf.getIDFTarget
: Return the current IDF_TARGET from sdkconfig or idf.customExtraVars
["IDF_TARGET"] configuration setting.See an example in the debugging documentation.
Available Tasks intasks.json
A template tasks.json
is included when creating a project using ESP-IDF: New Project. These tasks can be executed by pressing F1, writing Tasks: Run task
and selecting one of the following:
Build
- Build ProjectSet Target to esp32
Set Target to esp32s2
Clean
- Clean the projectFlash
- Flash the deviceMonitor
- Start a monitor terminalOpenOCD
- Start the OpenOCD serverBuildFlash
- Execute a build followed by a flash commandNote that for OpenOCD tasks, you need to define OpenOCD_SCRIPTS
in your system environment variables with OpenOCD scripts folder path.
If something is not working, please check for any error on one of these:
NOTE: Set
idf.OpenOCDDebugLevel
configuration setting to 3 or more in your /.vscode/settings.json to show debug level logs of OpenOCD server inESP-IDF
output.
NOTE: Set
verbose: true
in your /.vscode/launch.json for more detailed debug adapter output.
ESP-IDF: Doctor Command
to generate a report of your environment configuration and it will be copied in your clipboard to paste anywhere.%USERPROFILE%\.vscode\extensions\espressif.esp-idf-extension-VERSION\esp_idf_vsc_ext.log
$HOME/.vscode/extensions/espressif.esp-idf-extension-VERSION/esp_idf_vsc_ext.log
In Visual Studio Code, select menu Help > Toggle Developer Tools and copy any error in the Console tab related to this extension.
In Visual Studio Code select menu View > Output > Extension Host. This output information is useful to know what is happening during the extensions activation. If no extension command work, you could share the output here to see the error stack.
Visual Studio Code allows you to configure settings at different levels: Global (User Settings), Workspace and Workspace Folder, so make sure your project has the right settings. The ESP-IDF: Doctor command
result might give the values from user settings instead of the workspace folder settings.
${workspaceFolder}/.vscode/settings.json
<name>.code-workspace
filesettings.json
%APPDATA%\Code\User\settings.json
$HOME/Library/Application Support/Code/User/settings.json
$HOME/.config/Code/User/settings.json
This extension uses the idf.saveScope
configuration setting (which can only be defined in User Settings) to specify where to save settings for features such as the Setup Wizard. You can modify this using the ESP-IDF: Select where to Save Configuration Settings
command.
Refer to the OpenOCD troubleshooting FAQ for help with application tracing, debugging, or other OpenOCD-related issues that may appear in the OpenOCD output.
In some cases, the default shell (Powershell, zsh, sh, .etc) configured in VS Code could affect the behavior of the extension. Make sure that MSYS/MinGW is not set in the environment and the variables don't conflict with terminal behavior. The ESP-IDF: Doctor Command
shows which shell is detected by the extension when running tasks like building, flashing and monitoring. More information in here.
If there is any Python package error, please try to reinstall the required Python packages with the ESP-IDF: Install ESP-IDF Python Packages command or running the setup again with the ESP-IDF: Configure ESP-IDF Extension command.
NOTE: When downloading ESP-IDF using git cloning in Windows, if you receive errors like "unable to create symlink", enabling
Developer Mode
while cloning ESP-IDF could help resolve the issue.
If you can't resolve the error, please search in the github repository issues for existing errors or open a new issue here.
This project and everyone participating in it is governed by the Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to vscode@espressif.com.
This extension is licensed under the Apache License 2.0. Please see the LICENSE file for additional copyright notices and terms.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4