Skip to content

Added definition of openOCDIP when gdb run in WSL but openOCD in host - #1256

Closed
adampaul012 wants to merge 1 commit into
Marus:masterfrom
adampaul012:master
Closed

Added definition of openOCDIP when gdb run in WSL but openOCD in host#1256
adampaul012 wants to merge 1 commit into
Marus:masterfrom
adampaul012:master

Conversation

@adampaul012

@adampaul012 adampaul012 commented Sep 9, 2026

Copy link
Copy Markdown

I develop in WSL but proxing the USB of the debugger to WSL does not work so openOCD runs in Windows. The IP then needs to be set not to localhost but to the address of WSL host. This is when using servertype: openocd. The argument openOCDIP sets the ip for gdb and also binds openOCD to that IP so it listens on it. Tested with vscode 1.116.0.

@haneefdm

haneefdm commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Thank you for the submission. There is more involved than just the gdb target host:ip. There is also free port detection, ports for rtt/swo, multi-core debug, etc.

Sorry, we are not adding features to this extension. There is a rewrite of this extension (currently in alpha), where WSL, Docker, and SSH are supported in an automated way. It figures out most of it automatically with VSCode's help.

https://github.com/mcu-debug/mcu-debug
https://github.com/mcu-debug/mcu-debug/releases

If you don't want to use that, try using uspipd. See https://learn.microsoft.com/en-us/windows/wsl/connect-usb

With usbip, you can use the Linux version of openocd (runs inside WSL) instead of Windows. It has its (minor) issues, but this is much better, and everything will work. Perhaps you weren't aware, but may I ask why you didn't use it? Many cortex-debug users use it.

Btw, the new extension doesn't rely on usbip and it also supports serial ports natively in launch.json.

@adampaul012

Copy link
Copy Markdown
Author

Hi Thank you for your response. The reason I didn't use usbpid is that it didn't function correctly with my raspberrypi pico debugger probe. I will test the alpha version.

@adampaul012 adampaul012 closed this Sep 9, 2026
@haneefdm

haneefdm commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

@haneefdm

haneefdm commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

With mcu-debug, you have to make sure that your serverpath is the Windows version of openocd. As my proxy server + openocd runs on Windows natively where the probe is attached. The same goes for any openocd config files (you are fine if you are using config files that came with openocd since you can use relative paths)

Depending on the WSL networking mode you are using, you may need this info.

https://mcu-debug.github.io/mcu-debug/docs/remote#wsl-nat-security-warning

If you have the time, please read that entire page

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants