Visual Studio Code is a great and simple IDE that can be used to build & develop with for Matter.
Matter supports the docker / remote container workflow in Visual Studio Code, and has a container environment setup automatically. You can read more about this workflow here.
Tested on:
- Windows 11 Pro + WSL 2 + Ubuntu 22.04 LTS
- Ubuntu 22.04 LTS
Follow these steps to set up Visual Studio Code for Matter development.
For Espressif esp32 devices:
-
Connect your device to the system before running the container.
-
Add
"--device=/dev/ttyUSB0",
inside runArgs in devcontainer.json. Confirm the port of the device and change the parameter accordingly. -
On opening connectedhomeip in Visual Studio code, At the bottom right of your window you should have a new box prompting you to re-open the window as a container. Hit yes.
-
The container will be built.
-
Install esp-idf :
cd /opt/espressif/esp-idf && ./install.sh
-
Source esp-idf :
source /opt/espressif/esp-idf/export.sh
-
Activate matter :
cd /workspaces/connectedhomeip && source scripts/bootstrap.sh && source scripts/activate.sh
-
Confirm that the device is accessible :
ls -l /dev/ttyUSB*
-
Go to lighting_example :
cd examples/lighting-app/esp32
-
Set-target:
idf.py set-target esp32c3
-
Build the project:
idf.py build
-
Flash:
idf.py -p /dev/ttyUSB0 flash
-
Monitor:
idf.py -p /dev/ttyUSB0 monitor
-
Connect to WSL Distro from VS Code.
-
Git clone inside WSL from Matter repository here: https://github.com/project-chip/connectedhomeip
-
Follow these steps on Windows and these steps in WSL to have serial port access inside WSL.
-
Confirm that the device is accessible inside WSL :
ls -l /dev/ttyUSB*
. -
Open connectedhomeip within WSL on Visual Studio Code.
-
Perform step 2 onwards from Linux guide.