From 466137988b615ca819391ec73d49aed56e044bcf Mon Sep 17 00:00:00 2001 From: SAYON DEEP Date: Wed, 23 Aug 2023 14:11:37 +0530 Subject: [PATCH] [ESP32] doc:added doc for vs code development (#28690) * [ESP32] doc:added doc for vs code development * [ReadHandler] Unification of serial "now" timestamp (#28657) * Removed multiple calls to GetCurrentMonotonicTimestamp in series to ensure that the NOW value used remains the same along each checks * removed mNow, using stack now timestamps instead * Added missing @param description * Removed un-necessary comments * [TI] Resolve build issues in Example Applications (#28508) * Update TI Example applications to correctly pull in requirements.txt - Fix application build failures * Adjust return value to properly exit post-commissioning * Resolve run-time failure when using MTD configuration * Update OT TI Configuration * Disable Progress logging on lighting app for size constraints * Restyled by clang-format * Restyled by gn --------- Co-authored-by: Restyled.io * [ESP32] doc:added doc for vs code development * [ESP32] doc:added doc for vs code development --------- Co-authored-by: lpbeliveau-silabs <112982107+lpbeliveau-silabs@users.noreply.github.com> Co-authored-by: adabreuti <76965454+adabreuti@users.noreply.github.com> Co-authored-by: Restyled.io --- .github/.wordlist.txt | 2 + docs/guides/esp32/vs_code_development.md | 71 ++++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 docs/guides/esp32/vs_code_development.md diff --git a/.github/.wordlist.txt b/.github/.wordlist.txt index 41e37196757c41..e572827bac80d2 100644 --- a/.github/.wordlist.txt +++ b/.github/.wordlist.txt @@ -960,6 +960,7 @@ OnOff OnOffClusterTest OnOffSwitchConfiguration OnPlatformEvent +onwards OO openiotsdk openjdk @@ -1176,6 +1177,7 @@ rtld RTOS RTT RTX +runArgs RUNAS RunMain runtime diff --git a/docs/guides/esp32/vs_code_development.md b/docs/guides/esp32/vs_code_development.md new file mode 100644 index 00000000000000..82852e1ce071e6 --- /dev/null +++ b/docs/guides/esp32/vs_code_development.md @@ -0,0 +1,71 @@ +# Visual Studio Code Development + +[Visual Studio Code](https://code.visualstudio.com/) 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](https://code.visualstudio.com/docs/remote/containers). + +Tested on: + +- Windows 11 Pro + WSL 2 + Ubuntu 22.04 LTS +- Ubuntu 22.04 LTS + +## Setup Steps + +Follow +[these](https://github.com/project-chip/connectedhomeip/edit/master/docs/VSCODE_DEVELOPMENT.md) +steps to set up Visual Studio Code for Matter development. + +### Linux + +For Espressif esp32 devices: + +1. Connect your device to the system before running the container. + +1. Add `"--device=/dev/ttyUSB0",` inside runArgs in + [devcontainer.json](../../../.devcontainer/devcontainer.json). Confirm the + port of the device and change the parameter accordingly. + +1. 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. + +1. The container will be built. + +1. Install esp-idf : `cd /opt/espressif/esp-idf && ./install.sh` + +1. Source esp-idf : `source /opt/espressif/esp-idf/export.sh` + +1. Activate matter : + `cd /workspaces/connectedhomeip && source scripts/bootstrap.sh && source scripts/activate.sh` + +1. Confirm that the device is accessible : `ls -l /dev/ttyUSB*` + +1. Go to lighting_example : `cd examples/lighting-app/esp32` + +1. Set-target: `idf.py set-target esp32c3` + +1. Build the project: `idf.py build` + +1. Flash: `idf.py -p /dev/ttyUSB0 flash` + +1. Monitor: `idf.py -p /dev/ttyUSB0 monitor` + +### Windows + +1. Connect to WSL Distro from VS Code. + +1. Git clone inside WSL from Matter repository here: + + +1. Follow [these](https://github.com/dorssel/usbipd-win) steps on Windows and + [these](https://github.com/espressif/vscode-esp-idf-extension/blob/master/docs/WSL.md#usbipd) + steps in WSL to have serial port access inside WSL. + +1. Confirm that the device is accessible inside WSL : `ls -l /dev/ttyUSB*`. + +1. Open connectedhomeip within WSL on Visual Studio Code. + +1. Perform step 2 onwards from [Linux](#linux) guide.