STM32 Device Mapping for hyperv

Hi Folks,

I’m running Docker Desktop on Window11. It’s running on a Dell (Intel) laptop and I am trying to do some development on an STM32 microcontroller.

Because I want to build for an ARM architecture, I’m using hyperv, not WSL2.

The catch is, I now want to map my STLink device (COM10) into the Ubuntu container so that I can flash it from there.

I’ve searched high and low but cant find much about how to do this. If it were WSL2 I could use usbipd but if I use WSL2 I wasn’t able to cross-compile for ARM, this is why I chose to use the hypervisor.

Based on documentation here:

I have tried:
docker run -it --rm --device=class/4d36e978-e325-11ce-bfc1-08002be10318 -v … rust:dev /bin/bash

But it fails saying that class/4d36e978-e325-11ce-bfc1-08002be10318 is not an absolute path, I cant find many examples of using --device, I hope to be able to see it show up in my container in /dev/somewhere.

Any tips on how to get my developing environment working ?

I don’t think you can attach devices that way to Docker Desktop’s Linux virtual machine on Windows. That is probably only for Windows containers, but I have never tried. If you know a way to attach the device to a hyperv VM, you can create one nd install Docker CE in the VM. If you need a GUI, you can install Portainer, the web based GUI.