VS Code extension is enabled on WSL instead of local Windows

Piano1010
Posts: 3
Joined: Thu Dec 28, 2023 1:19 pm

VS Code extension is enabled on WSL instead of local Windows

Postby Piano1010 » Thu Dec 28, 2023 2:32 pm

I installed the VS Code Espressif IDF extension v1.6.5. It was automatically installed on my WSL2. After struggling with some issues, I realized, that the "normal" way of the Windows installation is local and not WSL. However, uninstalling and reinstalling it does not help, as the reinstallation is just a reactivation of the extension.

My main question is, how to install the VS Code Espressif IDF extension on local Windows, not on WSL.

What i tried with WSL2: I attached the USB port with usbipd which worked. I was able to flash over the linux (WSL2) terminal.
But with VSCode it does not work.
I have the ESP32-H2-DevKitM-1.
As target I selected "esp32h2" and "builtin USB-JTAG". Not sure if this is correct.
Building the blink example project works.
Flashing the project does not work and brings the output:

Code: Select all

Open On-Chip Debugger v0.12.0-esp32-20230921 (2023-09-21-13:41)
Licensed under GNU GPL v2

For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html

/home/lorenz/.espressif/tools/openocd-esp32/v0.12.0-esp32-20230921/openocd-esp32/bin/openocd

[OpenOCD]
Open On-Chip Debugger v0.12.0-esp32-20230921 (2023-09-21-13:41)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html

[OpenOCD]
debug_level: 2
Info : only one transport option; autoselecting 'jtag'
Info : esp_usb_jtag: VID set to 0x303a and PID to 0x1001
Info : esp_usb_jtag: capabilities descriptor set to 0x2000

[OpenOCD]
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections

[OpenOCD]
❌ Error: esp_usb_jtag: could not find or open device!

[OpenOCD]
❌ /home/lorenz/.espressif/tools/openocd-esp32/v0.12.0-esp32-20230921/openocd-esp32/share/openocd/scripts/target/esp_common.cfg:9: Error: 
at file "/home/lorenz/.espressif/tools/openocd-esp32/v0.12.0-esp32-20230921/openocd-esp32/share/openocd/scripts/target/esp_common.cfg", line 9

[OpenOCD]
[Stopped] : OpenOCD Server
[ Flash ]
Can't perform JTag flash, because OpenOCD server is not running!
So I checked the file esp_common.cfg", line 9, which references the esp_version.cfg, which is:

Code: Select all

# SPDX-License-Identifier: GPL-2.0-or-later

set EXPECTED_VER "v0.12.0-esp32-20230921"

The settings.json file is:

Code: Select all

{
  "C_Cpp.intelliSenseEngine": "default",
  "idf.adapterTargetName": "esp32h2",
  "idf.openOcdConfigs": [
    "board/esp32h2-builtin.cfg"
  ],
  "idf.flashType": "JTAG"
}
However the "esp32h2" is marked with a yellow wavy underline, so I guess that this might be an issue.

ESP_radurentea
Posts: 18
Joined: Thu Mar 09, 2023 8:30 am

Re: VS Code extension is enabled on WSL instead of local Windows

Postby ESP_radurentea » Thu Jan 04, 2024 9:28 am

I'm guessing you have the VS Code opened as a remote connection. To install on your local, make sure VS Code is opened locally.

You can check this in the bottom left corner of VS Code:
NO WSL:
Screenshot 2024-01-04 111534.png
Screenshot 2024-01-04 111534.png (5.23 KiB) Viewed 9664 times
WSL Ubuntu:
Screenshot 2024-01-04 111509.png
Screenshot 2024-01-04 111509.png (6.55 KiB) Viewed 9664 times
In order to fully uninstall the extension take a look over this part of the extension's documentation

And if you want to use the extension with WSL, I recommend you to take a look over the following
WSL documentation and if you get stuck at some point, let me know.

Also, in case of any errors please paste the output of Doctor's Command here. In VS Code, open command palette [View > Command Palette] and type "ESP-IDF: Doctor Command", this will copy the output in the clipboard or it will open a .txt file based on your OS and show you the output there.

Piano1010
Posts: 3
Joined: Thu Dec 28, 2023 1:19 pm

Re: VS Code extension is enabled on WSL instead of local Windows

Postby Piano1010 » Sat Jan 06, 2024 10:12 pm

Thank you for your answer!

I did not know that I can disable the WSL in the lower left corner.

However I was not able to install it locally (without WSL).

I uninstalled ESP-IDF extension.
I deleted the extension in WSL file system. It was located here:
~/.vscode-server/extensions/espressif.esp-idf-extension-1.6.5

I disabled the Remote Host, then VS Code looks like this:
WSL-Disabled.png
WSL-Disabled.png (10.05 KiB) Viewed 9598 times
I made a reboot. Then I installed the ESP-IDF extension again without Remote host.
However, it still installed with WSL Ubuntu:
Reinstalled.png
Reinstalled.png (81.37 KiB) Viewed 9598 times
Then I tried to disable all WSL and remote extensions in VS Code, rebooted and installed ESP-IDF again.
Now I get an error with the following log:
2024-01-06 23:00:29.781 [error] No remote extension installed to resolve wsl.: CodeExpectedError: No remote extension installed to resolve wsl.
at ee.rb (vscode-file://vscode-app/c:/Users/Lorenz/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:2718:21055)
at async ee.qb (vscode-file://vscode-app/c:/Users/Lorenz/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:2718:20332)
at async ee.Ob (vscode-file://vscode-app/c:/Users/Lorenz/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:2719:11484)
at async ee.jb (vscode-file://vscode-app/c:/Users/Lorenz/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:2718:17969)
Thank you for helping me.

Piano1010
Posts: 3
Joined: Thu Dec 28, 2023 1:19 pm

Re: VS Code extension is enabled on WSL instead of local Windows

Postby Piano1010 » Sun Jan 14, 2024 8:25 pm

I found the solution:

Left click on the VS Code Remote icon:
1_Left-click.png
1_Left-click.png (14.28 KiB) Viewed 8981 times

Select Close Remote Connection:
2_Close-Remote-Connection.png
2_Close-Remote-Connection.png (144.73 KiB) Viewed 8981 times

Then reinstall the ESP-IDF extension. The extension is now globally enabled:
3_extension-enabled-globally.png
3_extension-enabled-globally.png (78.54 KiB) Viewed 8981 times

Now I were able to flash and debug the ESP32-H2 (using OpenOCD and JTAG).

Who is online

Users browsing this forum: No registered users and 59 guests