Milk-V Duo: Build and Debug with Extension
This example follows the IDE documentation to demonstrate how to use the extension for toolchain installation and virtual environment creation, and how to run and debug within VS Code using SSH/gdbserver.
Steps
-
Open VS Code and click the Ruyi icon in the sidebar to enter the extension homepage.
-
In the Packages view, install
gnu-milkv-milkv-duo-musl-bin. -
In the Virtual Environments view, click
+to create a new virtual environment:- Select
milkv-duoas the Profile. - Choose
gnu-milkv-milkv-duo-musl-binas the toolchain. - Specify a name and path, then create and activate the environment by clicking its name.
- Select
-
Obtain the source code: in the Explorer, right-click the target directory and select Extract RuyiSDK Package to unpack the
milkv-duo-examplessource. -
In the VS Code terminal (with the virtual environment activated), run the build, or create VS Code tasks that invoke the toolchain from the virtual environment.
-
Transfer and run:
- Use
scpto transfer the target program to the device (see theuploadtarget in the Makefile from the IDE documentation). - Run the program in an SSH terminal, or configure VS Code’s C/C++ Remote Application to run remotely.
- Use
-
Debug:
- On the device, prepare
gdbserverand run, for example:gdbserver :2345 ./your_binary. - On the host, use
riscv64-unknown-linux-musl-gdbfrom the virtual environment to connect to the device:
- On the device, prepare
riscv64-unknown-linux-musl-gdb ./your_binary
target remote <device-ip>:2345
Notes
- For more complete IDE configuration and demonstrations, please refer to Milkv Duo IDE Development Workflow.