Skip to content

Instantly share code, notes, and snippets.

@bwrrp
Last active February 5, 2024 12:29
Show Gist options
  • Save bwrrp/dc2fe8926dfe8860da21cb87ba91aeaa to your computer and use it in GitHub Desktop.
Save bwrrp/dc2fe8926dfe8860da21cb87ba91aeaa to your computer and use it in GitHub Desktop.
Visual Studio Code development container for the ESP-IDF

Visual Studio Code development container for the ESP-IDF

This config defines a development container for ESP32 development based on the official Espressif IDF docker image.

Note that the flash and monitor commands only work on Linux. Update the /dev/ttyUSB0 paths in devcontainer.json to whatever the ESP32 ends up as on your machine.

{
"name": "ESP-IDF",
"build": {
"dockerfile": "Dockerfile"
},
// Pre-configure ESP-IDF extension
"settings": {
"idf.showOnboardingOnInit": false,
"idf.toolsPath": "/opt/esp",
"idf.espIdfPath": "/opt/esp/idf",
"idf.pythonBinPath": "/opt/esp/python_env/idf4.2_py3.6_env/bin/python",
"idf.port": "/dev/ttyUSB0",
"terminal.integrated.shell.linux": "/bin/bash"
},
// Install relevant extensions in the dev container
"extensions": [
"espressif.esp-idf-extension",
"ms-vscode.cmake-tools",
"ms-vscode.cpptools"
],
"userEnvProbe": "loginInteractiveShell",
// Forward serial device to enable flash & monitor
"runArgs": [
"--device=/dev/ttyUSB0"
]
}
FROM espressif/idf:v4.2
RUN echo "source /opt/esp/idf/export.sh" >> /root/.bashrc
@psiphi75
Copy link

psiphi75 commented Sep 3, 2023

A couple of notes for those running this on Ubuntu.

Don't use the default docker-io package from the Ubuntu repositories, it's missing the buildx plugin. Use the Docker.com install instructions: https://docs.docker.com/engine/install/ubuntu/.

When starting the devcontainer make sure you have the device connected via /dev/ttyUSB0, or that /dev/ttyUSB0 exists.

@surendersampath
Copy link

Does it work on macos? Dev containers?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment