| Tools | Description | Environment |
|---|---|---|
| USB/IP (usbipd) | This connects USB devices into WSL (Win11). Latest version is good to use. | host |
| usbutils | provides commands such as lsusb (WSL). |
host (WSL) |
| openocd | debugging client | host (WSL) |
| gdb-multiarch | debugging server | host (WSL) |
| docker | Install docker desktop | host |
| minicom | serial communication via UART | host (WSL) |
At the root of the project folder:
docker build -t docker-demo .Again, at the root of the project folder:
docker run -it --rm --privileged -v "$PWD":/workspace docker-demoNOTE: You may add
--hostname <name you want>to distinguish container vs. host.
To exit out of the container, Ctrl+D.
-
Spin up the docker-demo container.
-
To have CMake generate the build files, use the following command:
cmake -B build -G Ninja
NOTE: If the build directory exists prior, delete the whole folder.
-
To build the application, use the following command:
cmake --build build
-
Now that the application has been built, you may exit out of the container by pressing
Ctrl + D. -
To flash the application, use the following command:
make flash
-
Open minicom via terminal
minicom -b 115200 -D /dev/<device ID>
-
Select from the following:
| Command | Description |
|---|---|
| on | Turns on LED |
| off | Turns off LED |
| blink | Blinks LED at 200ms rate |
| stop | Stops blinking or turns off LED |
The following is required when host is Windows 11.
-
Install USB/IP (
usbipd), may require admins rights. -
Once installed, run
usbipd listin PowerShell. -
Run
usbipd bind --busid <BUS ID>to allow the device to be shared with WSL, may require admin rights.For example, using the ID in the previous image:
usbipd bind --busid 1-3
Then executing
usbipd list, -
Run
usbipd attach --wsl --busid <BUS ID>to attach the USB device to WSL.NOTE: Sometimes the binding fails when attaching the USB device, if this happends,
usbipd bind --force --busid <BUS ID>must be used. -
In WSL, run
lsusbto find the USB device.
In WSL or in Linux environment, sometimes sudo is required to execute openocd since it will be dealing with USB.
Execute ./scripts/setup-stlink.sh, so using openOCD with the USB will not require sudo.



