Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

west debug under WSL2 #29414

Open
oxymoron87 opened this issue Oct 21, 2020 · 3 comments
Open

west debug under WSL2 #29414

oxymoron87 opened this issue Oct 21, 2020 · 3 comments
Labels
area: Debugging area: West West utility area: Windows Support Related to building Zephyr on Windows Enhancement Changes/Updates/Additions to existing features Needs review This PR needs attention from Zephyr's maintainers

Comments

@oxymoron87
Copy link

Hi,
I am trying to use west debug under WSL2 with jlink runner (JLink is installed under Windows because only under Windows JLink has access to the USB ports where debug probes are).
For this I had to make a symlink
/usr/local/bin/JLinkGDBServer -> '/mnt/c/Program Files (x86)/SEGGER/JLink/JLinkGDBServer.exe'
(Adding /mnt/c/Program Files (x86)/SEGGER/JLink/ to the $PATH didn't solve the problem because west tried to run JLinkGDBServer not the JLinkGDBServer.exe.)

After that I've realized that --tool-opt="-noLocalhostOnly" is needed for GDB server to listen to all interfaces (not only localhost) because it actually runs under Windows (localhost in Windows is different from localhost in WSL).

But still I ended up with

:2331: Connection timed out

To solve this I had to modify zephyr/scripts/west_commands/runners/jlink.py and change target remote command to include Windows instance's WSL interface IP address
client_cmd = (self.gdb_cmd + self.tui_arg + [self.elf_name] + ['-ex', 'target remote <Windows instance's WSL interface IP address>:{}'.format(self.gdb_port)])

Suggestion:
It would be great if west is able to identify that it runs under WSL and run GDB server automatically with option -noLocalhostOnly and GDB client with IP address of the Windows instance (this can be retrieved from /etc/resolv.conf file from nameserver variable).
Or at least have an option to specify IP address which gdb client should use, e.g. --gdb-ip (like we have --gdb-port now).

It could also solve the issue zephyrproject-rtos/west#228 by using debug directly.

@mbolivar-nordic mbolivar-nordic transferred this issue from zephyrproject-rtos/west Oct 21, 2020
@mbolivar-nordic
Copy link
Contributor

Transferred to a zpehyr issue since west debug is an extension defined in the zephyr repo.

In general we don't support WSL2 and would need to test various workflows to claim support for it, so I'm marking this as an enhancement.

@mbolivar-nordic mbolivar-nordic added the Enhancement Changes/Updates/Additions to existing features label Oct 21, 2020
@mmurty
Copy link

mmurty commented Sep 18, 2021

Hi @mbolivar ,
I am trying to do the same thing in WSL.
Any update on this issue?

@henrikbrixandersen henrikbrixandersen added area: Debugging west area: Windows Support Related to building Zephyr on Windows area: West West utility and removed west labels Nov 2, 2022
@zephyrbot zephyrbot added the Needs review This PR needs attention from Zephyr's maintainers label Feb 8, 2024
@matt-wood-ct
Copy link

IDK if you guys know this, but you can pass the whole USB device down into WSL as if it was natively connected to the linux environment, see this guide/doc from Microsoft: https://learn.microsoft.com/en-us/windows/wsl/connect-usb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Debugging area: West West utility area: Windows Support Related to building Zephyr on Windows Enhancement Changes/Updates/Additions to existing features Needs review This PR needs attention from Zephyr's maintainers
Projects
None yet
Development

No branches or pull requests

6 participants