Small project by using Ebassy Async RTOS
If everything is installed properly, the workspace can be opened in VS Code and a hit on F5 should build the project without errors or warnings and automatically start a debug session. The program should be halted at the breakpoint at main().
In this post, it’ll be tried to explain how to get a working example by using only the tools that provided by Rust community. So let’s start!
- Rust Toolchain1
- usbpid-win2
- probe-rs3
- VSCode4
- WSL5
- rust-analyzer plugin for VSCode6
- probe-rs plugin for VSCode7
- WSL plugin for VSCode8
- GitHUB repository9
- STM32F429ZI Discovery Board10
- Embassy OS11
- Install WSL12 and an Ubuntu 22.04.2 LTS13 instance from Windows Store
- Download and install usbpid-win from the Github repository2
- Run the WSL instance on a windows commandline as follow
PS C:\Users\ierturk> wsl ~
- Install probe-rs within WSL instance as decribed in here3
- Plugin the Discovery board into a USB port on your Windows PC
On a windows command line when you issued follwing commad, a list will be displayed
PS C:\Users\ierturk> usbipd wsl list
BUSID VID:PID DEVICE STATE
3-1 0483:374b ST-Link Debug, USB Mass Storage Device, STMicroelectronic... Not attached
3-2 046d:c52b Logitech USB Input Device, USB Input Device Not attached
4-1 05ac:8509 FaceTime HD Camera (Built-in), FaceTime HD camera Not attached
6-2 05ac:8242 Apple IR Receiver Not attached
6-3 05ac:0253 Apple Keyboard, Apple Multi-Touch, USB Input Device Not attached
7-3 05ac:821d Apple Broadcom Built-in Bluetooth Not attached
- Bind the USB device on an elevated command line as follow
PS C:\Users\root> usbipd bind --busid 3-1
- Now you can attach the USB device as standard user as follow
PS C:\Users\ierturk> usbipd wsl attach --busid 3-1
- Open VSCode
- Install WSL plugin8 in VSCode
- Connect to WSL instance from within VSCode using WSL plugin8
- Install rust-analyzer6 and probe-rs7 plugins in VSCode in WSL instance
- Open terminal in VSCode
- Create a work directory and clone the repository9 as follow
ierturk@DESKTOP-JC8L4M1:~$ mkdir Work
ierturk@DESKTOP-JC8L4M1:~$ cd Work
ierturk@DESKTOP-JC8L4M1:~$ sudo apt-get install git
ierturk@DESKTOP-JC8L4M1:~$ git clone https://github.com/ierturk/rust-embedded-wsl-probe-rs.git
- Open folder
rust-embedded-wsl-probe-rs
- Now just open debug tab and hit the button
- Place breakpoints where you want
- Hit the play button
Then it should be displayed following screen
It just woks as you can see. Yo can work on this and modify some parts according to your requirements.
Hope you enjoyed with the tutorial, found useful. Thank you for reading.