• Stars
    star
    944
  • Rank 46,631 (Top 1.0 %)
  • Language
    TypeScript
  • License
    Apache License 2.0
  • Created over 5 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Visual Studio Code extension for ESP-IDF projects
espressif logo

ESP-IDF Visual Studio Code Extension

Tutorials Documentation Troubleshooting ESP32 Version Releases Forum

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

Nightly builds for Visual Studio Code or OpenVSX. You can use this VSIX to test the current github master of the extension by pressing F1 and type Install from VSIX and then select the downloaded .vsix file to install.

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

Tutorials

  1. Install and setup the extension.
  2. Create a project from ESP-IDF examples, Build, flash and monitor.
  3. Debugging with steps to configure OpenOCD and debug adapter.
  4. Heap tracing
  5. Code coverage
  6. Developing on Docker Container
  7. Developing on WSL

Check all the tutorials here.

Table of content

  1. How to use
  2. Available commands
  3. Commands for tasks.json and launch.json
  4. Available Tasks in tasks.json
  5. Troubleshooting
  6. Code of Conduct
  7. License

Check all the documentation.

How to use

  • Download and install Visual Studio Code.
  • Then
    • Either open Visual Studio Code and create a workspace folder.
    • Run code ${YOUR_PROJECT_DIR} from a command line terminal.
  • Install this extension in your Visual Studio Code.

There are few dependencies required in your system and available in environment variable PATH before installing this extension. Please review the following documentation.

Installation of ESP-IDF and ESP-IDF Tools is being done from this extension itself (existing ESP-IDF installation may also be reused) using the ESP-IDF: Configure ESP-IDF extension setup wizard or following the steps in the setup documentation or following the install tutorial.

NOTE: Please note that this extension only supports the release versions of ESP-IDF, you can still use the extension on master branch or some other branch, but certain feature might not properly work.

NOTE: If you are using Windows Subsystem for Linux (WSL) 2, please take a look at the WSL tutorial for an step by step instruction or check the requirements in WSL Documentation needed in the WSL distribution.

  • (OPTIONAL) Press F1 and type ESP-IDF: Select where to save configuration settings, which can be User settings, Workspace settings or workspace folder settings.

    NOTE: Please take a look at Working with multiple projects for more information. Default is User settings.

  • On the first time using the extension, press F1 to show the Visual Studio Code Command Palette and type ESP-IDF: Configure ESP-IDF extension to open the extension configuration wizard. This will install ESP-IDF, ESP-IDF tools, create a virtual python environment with ESP-IDF and this extension python packages and configure the extension settings with these values. NOTE: Make sure that there is no spaces in any configured path since ESP-IDF build system doesn't support spaces yet..

    NOTE: Please take a look at Install tutorial documentation or the Setup documentation for details about extension setup and configuration.

  • Press F1 and type ESP-IDF: Show Examples Projects to create a new project from ESP-IDF examples.

  • Configure the .vscode/c_cpp_properties.json as explained in C/C++ Configuration. There is a default configuration that should work when you create a new project with the extension commands but you might want to modify it to your needs.

    Note: If you want to get code navigation and ESP-IDF function references, the Microsoft C/C++ Extension can be used to resolve header/source links. By default, projects created with ESP-IDF: Create project from extension template or ESP-IDF: Show Examples Projects tries to resolve headers by manually recursing ESP-IDF directory sources with the Tag Parser engine. This can be optimized by building the project first and configure your project to use build/compile_commands.json as explained in C/C++ Configuration.

    NOTE: You should set "C_Cpp.intelliSenseEngine": "Tag Parser" in your settings.json if you are not using the compile_commands.json approach.

  • Do some coding!

  • Check you set the correct port of your device by pressing F1, typing ESP-IDF: Select port to use: and choosing the serial port your device is connected.

  • Select an Espressif target (esp32, esp32s2, etc.) with the ESP-IDF: Set Espressif device target command.

  • Use the ESP-IDF: Select OpenOCD Board Configuration to choose the openOCD configuration files for the extension openOCD server.

  • When you are ready, build your project by pressing F1 and typing ESP-IDF: Build your project.

  • Flash to your device by pressing F1 and typing ESP-IDF: Select Flash Method and Flash to select either UART or JTAG. You can also use the ESP-IDF: Flash (UART) your project or ESP-IDF: Flash (with JTag) directly.

    NOTE: When using the ESP-IDF: Select Flash Method and Flash command, your choice will be saved in the idf.flashType configuration setting in the current workspace folder's settings.json.

  • You can later start a monitor by pressing F1 and typing ESP-IDF: Monitor your device which will log the device activity in a Visual Studio Code terminal.

  • To make sure you can debug your device, select the your board by pressing F1 and typing ESP-IDF: Select OpenOCD Board Configuration or manually define the openOCD configuration files with idf.openOcdConfigs configuration in your settings.json.

  • If you want to start a debug session, just press F5 (make sure you had at least build and flash once before so the debugger works correctly). Check the Troubleshooting section if you have any issues.

Available commands

Click F1 to show Visual studio code actions, then type ESP-IDF to see possible actions.

Command Description Keyboard Shortcuts (Mac) Keyboard Shortcuts (Windows/ Linux)
Add Arduino ESP32 as ESP-IDF Component
Add docker container configuration
Add Editor coverage
Add OpenOCD rules file (For Linux users)
Add vscode configuration folder
Build, Flash and start a monitor on your device I D Ctrl E D
Build your project I B Ctrl E B
Clear saved IDF setups
Configure ESP-IDF extension
Configure Paths
Configure project sdkconfig for coverage
Create project from extension template I C Ctrl E C
Create new ESP-IDF Component
Device configuration
Dispose current SDK Configuration editor server process
Doctor command
Encrypt and flash your project
Erase flash memory from device I R Ctrl E R
Execute custom task I J Ctrl E J
Flash your project I F Ctrl E F
Flash (DFU) your project
Flash (UART) your project
Flash (with JTag)
Full clean project I X Ctrl E X
Get HTML Coverage Report for project
Import ESP-IDF Project
Install ESP-ADF
Install ESP-IDF Python Packages
Install ESP-MDF
Install ESP-Matter
Install ESP-Rainmaker
Launch IDF Monitor for CoreDump / GDB-Stub Mode
Launch QEMU server
Launch QEMU debug session
Monitor your device I M Ctrl E M
Monitor QEMU device
New Project I N Ctrl E N
Open ESP-IDF Terminal I T Ctrl E T
Open NVS Partition Editor
Pick a workspace folder
SDK Configuration editor I G Ctrl E G
Search in documentation... I Q Ctrl E Q
Select Flash Method
Select port to use I P Ctrl E P
Select OpenOCD Board Configuration
Select where to save configuration settings
Set default sdkconfig file in project
Set Espressif device target
Set ESP-MATTER Device Path (ESP_MATTER_DEVICE_PATH)
Show Examples Projects
Show ninja build summary
Size analysis of the binaries I S Ctrl E S
Remove Editor coverage

About commands

  1. The Add Arduino-ESP32 as ESP-IDF Component command will add Arduino-ESP32 as a ESP-IDF component in your current directory (${CURRENT_DIRECTORY}/components/arduino).

    NOTE: Not all versions of ESP-IDF are supported. Make sure to check Arduino-ESP32 to see if your ESP-IDF version is compatible.

  2. You can also use the ESP-IDF: Create project from extension template command with arduino-as-component template to create a new project directory that includes Arduino-ESP32 as an ESP-IDF component.

  3. The Install ESP-ADF will clone ESP-ADF inside the selected directory and set idf.espAdfPath (idf.espAdfPathWin in Windows) configuration setting.

  4. The Install ESP-Matter will clone ESP-Matter inside the selected directory and set idf.espMatterPath (idf.espMatterPathWin in Windows) configuration setting. The Set ESP-MATTER Device Path (ESP_MATTER_DEVICE_PATH) is used to define the device path for ESP-Matter.

  5. The Install ESP-MDF will clone ESP-MDF inside the selected directory and set idf.espMdfPath (idf.espMdfPathWin in Windows) configuration setting.

  6. The Show Examples Projects command allows you create a new project using one of the examples in ESP-IDF, ESP-ADF, ESP-Matter or ESP-MDF directory if related configuration settings are correctly defined.

Commands for tasks.json and launch.json

We have implemented some utilities commands that can be used in tasks.json and launch.json that can be used like:

"miDebuggerPath": "${command:espIdf.getXtensaGdb}"
  • espIdf.getExtensionPath: Get the installed location absolute path.
  • espIdf.getOpenOcdScriptValue: Return the value of OPENOCD_SCRIPTS from idf.customExtraVars or from system 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.getXtensaGcc: Return the absolute path of the xtensa toolchain gcc for the ESP-IDF target given by idf.adapterTargetName configuration setting and idf.customExtraPaths.
  • espIdf.getXtensaGdb: Return the absolute path of the xtensa toolchain gdb for the ESP-IDF target given by idf.adapterTargetName configuration setting and idf.customExtraPaths.

See an example in the debugging documentation.

Available Tasks in tasks.json

A template Tasks.json is included when creating a project using ESP-IDF: Create project from extension template. These tasks can be executed by running F1, writing Tasks: Run task and selecting one of the following:

  1. Build - Build Project
  2. Set Target to esp32
  3. Set Target to esp32s2
  4. Clean - Clean the project
  5. Flash - Flash the device
  6. Monitor - Start a monitor terminal
  7. OpenOCD - Start the openOCD server
  8. BuildFlash - Execute a build followed by a flash command.

Note that for OpenOCD tasks you need to define OPENOCD_SCRIPTS in your system environment variables with openocd scripts folder path.

Troubleshooting

If something is not working please check for any error on one of these:

NOTE: Use idf.openOcdDebugLevel configuration setting to 3 or more to show debug logging in OpenOCD server output.

NOTE: Use logLevel in your /.vscode/launch.json to 3 or more to show more debug adapter output.

  1. In Visual Studio Code select menu "View" -> Output -> ESP-IDF, ESP-IDF Debug Adapter, Heap Trace, OpenOCD and SDK Configuration Editor. This output information is useful to know what is happening in each tool.
  2. Use the ESP-IDF: Doctor command to generate a report of your configuration and it will be copied in your clipboard to paste anywhere.
  3. Check log file which can be obtained from:
  • Windows: %USERPROFILE%\.vscode\extensions\espressif.esp-idf-extension-VERSION\esp_idf_vsc_ext.log
  • Linux & MacOSX: $HOME/.vscode/extensions/espressif.esp-idf-extension-VERSION/esp_idf_vsc_ext.log
  1. In Visual Studio Code, select menu "Help" -> Toggle Developer Tools and copy any error in the Console tab related to this extension.

  2. Make sure that your extension is properly configured as described in JSON Manual Configuration. Visual Studio Code allows the user 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.

  3. Review the OpenOCD troubleshooting FAQ related to the OpenOCD output, for application tracing, debug or any OpenOCD related issues.

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. Please consider that this extension install ESP-IDF, this extension's and ESP-IDF Debug Adapter python packages when running the ESP-IDF: Configure ESP-IDF extension setup wizard.

If the user can't resolve the error, please search in the github repository issues for existing errors or open a new issue here.

Code of Conduct

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 [email protected].

License

This extension is licensed under the Apache License 2.0. Please see the LICENSE file for additional copyright notices and terms.

More Repositories

1

esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
C
12,517
star
2

arduino-esp32

Arduino core for the ESP32
C++
12,308
star
3

esptool

Espressif SoC serial bootloader utility
Python
5,311
star
4

ESP8266_RTOS_SDK

Latest ESP8266 SDK based on FreeRTOS, esp-idf style.
C
3,232
star
5

esp-iot-solution

Espressif IoT Library. IoT Device Drivers, Documentations And Solutions.
C
1,751
star
6

esp-who

Face detection and recognition framework
C
1,594
star
7

esp-adf

Espressif Audio Development Framework
C
1,395
star
8

esp32-camera

C
1,259
star
9

ESP8266_NONOS_SDK

ESP8266 nonOS SDK
C
911
star
10

esp-at

AT application for ESP32/ESP32-C2/ESP32-C3/ESP32-C6/ESP8266
C
769
star
11

esp-mdf

Espressif Mesh Development Framework, limited maintain, recommend to use https://github.com/espressif/esp-mesh-lite
C
757
star
12

ESP8266_MP3_DECODER

A demo that should be run with ESP8266 Non-OS SDK
C
739
star
13

esp-drone

Mini Drone/Quadcopter Firmware for ESP32 and ESP32-S Series SoCs.
C
658
star
14

esp-box

The ESP-BOX is a new generation AIoT development platform released by Espressif Systems.
HTML
612
star
15

esp-apple-homekit-adk

This is a port for Apple's Open Source HomeKit ADK
C
598
star
16

esp-csi

Applications based on Wi-Fi CSI (Channel state information), such as indoor positioning, human detection
C
592
star
17

kicad-libraries

KiCad libraries for Espressif chips and modules
Python
580
star
18

esp-mqtt

ESP32 mqtt component
C
577
star
19

esp-matter

Espressif's SDK for Matter
C++
546
star
20

esp-hosted

Hosted Solution (Linux/MCU) with ESP32 (Wi-Fi + BT + BLE)
C
539
star
21

esp-homekit-sdk

C
518
star
22

esp-skainet

Espressif intelligent voice assistant
C
500
star
23

ESP8266_AT

This project is not maintained, please use https://github.com/espressif/esp-at.
C
472
star
24

esp32-nesemu

Proof-of-concept NES emulator for the ESP32
C
471
star
25

esp-sr

Speech recognition
C
462
star
26

rust-esp32-example

Example of Rust integration into an ESP-IDF project, for ESP32 series of chips
Rust
421
star
27

esp-rainmaker

ESP RainMaker Agent for firmware development
C
415
star
28

esp-now

A connectionless Wi-Fi communication protocol
C
402
star
29

esp-dsp

DSP library for ESP-IDF
C
401
star
30

esp-dl

Espressif deep-learning library for AIoT applications
C++
369
star
31

openocd-esp32

OpenOCD branch with ESP32 JTAG support
C
334
star
32

esp-aliyun

Aliyun Iotkit-embedded, support esp32 & esp8266.
C
333
star
33

esp-idf-template

Template application for https://github.com/espressif/esp-idf
Makefile
323
star
34

esp-serial-flasher

Library for flashing Espressif SoCs from other MCUs.
C++
321
star
35

idf-eclipse-plugin

Espressif-IDE (based on Eclipse CDT) for ESP-IDF CMake based projects 4.x and above
Java
289
star
36

esp-dev-kits

Docs, Schematics, Factory Firmwares for ESP Development Kits
C
287
star
37

esp-va-sdk

Espressif's Voice Assistant SDK: Alexa, Google Voice Assistant, Google DialogFlow
C
273
star
38

esp-tflite-micro

TensorFlow Lite Micro for Espressif Chipsets
C++
271
star
39

esp-usb-bridge

USB to UART&JTAG bridge, implemented on ESP32-S2 or ESP32-S3
C
271
star
40

esp-aws-iot

AWS IoT SDK for ESP32 based chipsets
C
247
star
41

esptool-js

Javascript implementation of flasher tool for Espressif chips, running in web browser using WebSerial.
TypeScript
241
star
42

ESP31_RTOS_SDK

ESP31B SDK based on FreeRTOS. For ESP32 please see http://github.com/espressif/esp-idf
HTML
189
star
43

esp-idf-provisioning-android

Android Provisioning application for ESP-IDF Unified provisioning
Java
184
star
44

esp-azure

SDK to connect ESP8266 and ESP32 to Microsoft Azure IoT services
C
174
star
45

esp-jumpstart

Jumpstart from concept to production
C
167
star
46

esp-gdbstub

C
157
star
47

esp-protocols

Collection of ESP-IDF components related to networking protocols
C
156
star
48

esp32-wifi-lib

ESP32 WiFi stack precompiled libraries
Shell
153
star
49

esp32-doom

A proof-of-concept port of PrBoom to the ESP32. Needs psram hardware.
C++
151
star
50

esp-google-iot

Google Cloud IoT SDK as an ESP-IDF Component
C
144
star
51

esp-bsp

Board support components for Espressif development boards
C
141
star
52

esp8266-rtos-sample-code

C
131
star
53

esp-iot-bridge

A smart bridge to make both ESP and the other MCU or smart device can access the Internet.
C
129
star
54

esp-idf-provisioning-ios

Swift
125
star
55

idf-extra-components

Additional components for ESP-IDF, maintained by Espressif
C
122
star
56

esp32-arduino-lib-builder

C
120
star
57

esp-nn

Optimised Neural Network functions for Espressif chipsets
Assembly
103
star
58

esp-zigbee-sdk

Espressif Zigbee SDK
C
99
star
59

idf-installer

ESP IDF Windows Installer
Inno Setup
92
star
60

esp-insights

ESP Insights: A remote diagnostics/observability framework for connected devices
C
91
star
61

esp-rainmaker-android

ESP RainMaker Android app sources
Java
85
star
62

esp-thread-br

Espressif Thread Border Router SDK
C
82
star
63

esp-mesh-lite

A lite version Wi-Fi Mesh, each node can access the network over the IP layer.
C
79
star
64

book-esp32c3-iot-projects

《ESP32-C3 物联网工程开发实战》配套代码
Swift
77
star
65

esp-lwip

Fork of lwIP (https://savannah.nongnu.org/projects/lwip/) with ESP-IDF specific patches
C
77
star
66

esp-ali-smartliving

阿里云生活物联网平台 & 天猫精灵 IoT 开放平台
C
75
star
67

usb-pids

Customer-allocated USB PIDs under the Espressif VID
Shell
75
star
68

pytest-embedded

A pytest plugin that designed for embedded testing
Python
74
star
69

esp32-bt-lib

ESP32 Bluetooth stack (below HCI layer) precompiled libraries
67
star
70

esp-modbus

ESP-Modbus - the officially suppported library for Modbus protocol (serial RS485 + TCP over WiFi or Ethernet).
C
67
star
71

esp8266-nonos-sample-code

C
65
star
72

esp-qcloud

基于 ESP-IDF 原生开发接入腾讯 IoT Explorer,支持 ESP32/ESP32S2,快速实现腾讯连连控制。
C
65
star
73

esp32c3-direct-boot-example

Example of ESP32-C3 (rev. 3 and later) "direct boot" feature.
CMake
64
star
74

esp-idf-cxx

C++ wrapper classes for ESP-IDF components.
C++
63
star
75

esp-wasmachine

The Machine which can run WASM applications.
C
50
star
76

freertos-gdb

Python module for operating with freeRTOS kernel objects in GDB
Python
48
star
77

svd

SVD files for Espressif devices
47
star
78

binutils-esp32ulp

Binutils fork with support for the ESP32 ULP co-processor
C
46
star
79

esp-moonlight

C
44
star
80

xtensa-isa-doc

TeX
42
star
81

esp-privilege-separation

Espressif Privilege Separation Framework
C
41
star
82

esp-rainmaker-ios

ESP RainMaker iOS app sources
Swift
41
star
83

openocd-on-esp32

OpenOCD port running on ESP32-S3 microcontrollers
C
40
star
84

esp-adf-libs

C
38
star
85

idf-component-manager

Tool for installing ESP-IDF components
Python
37
star
86

ESP8266_RTOS_ALINK_DEMO

Alink 1.0 早期版本
Assembly
36
star
87

esp-wolfssl

WolfSSL port for ESP-IDF & ESP8266_RTOS_SDK
C
35
star
88

esp-joylink

Demo project for JD joylink, support esp32 & esp8266.
C
34
star
89

esp31-smsemu

C
34
star
90

esp8266-alink-v1.0

alink v1.0
C
32
star
91

esp-faq

Python
31
star
92

esp-launchpad

Configurable Browser-based Image Flasher
CSS
31
star
93

esp32-alink-demo

Demo project for alink, include embed and SDS
C
30
star
94

esp32-iotivity

Guide you to make your ESP32 support OCF/OIC.
C
29
star
95

newlib-esp32

Version of newlib used in ESP32 ROM and ESP-IDF
C
29
star
96

esp8266-alink-sds

Demo project for alink SDS
C
27
star
97

esp-wdf

Espressif WASM Development Framework.
C
27
star
98

idf-env

idf-env tool helps set up and manage ESP-IDF installations
Rust
25
star
99

esp-cryptoauthlib

Release only fork of https://github.com/MicrochipTech/cryptoauthlib
C
23
star
100

esp-wireless-drivers-3rdparty

Wi-Fi and BT drivers packaged for integration into 3rd party repositories. Work in progress.
C
22
star