CH32V307 : Debugging with vscode
This is derived from https://www.justinmklam.com/posts/2017/10/vscode-debugger-setup
1- Install native debugging plugin gdb/... within vscode
2- Add (and change) the following line to your settings.json pointing to the toolchain binaries (especially the riscv gdb) and the wch-openocd bin folder :
"riscv_openocd_path" : "/opt/wch/MounRiver_Studio_Community_Linux_x64_V130/MRS_Community/toolchain/OpenOCD/bin",
"riscv_gdb_path" : "/opt/wch/MRS_Toolchain_Linux_x64_V1.60/RISC-V Embedded GCC/bin/"
3- Create the launch.json file, adapt the name to your project
{
"version": "0.2.0",
"configurations": [
{
"name": "riscv_GDB",
"type": "gdb",
"request": "launch",
"cwd": "${workspaceRoot}",
"target": "${workspaceRoot}/build/lnPowerSupply_CH32V3x_72M.elf",
"gdbpath" : "${config:riscv_gdb_path}/riscv-none-embed-gdb",
"autorun": [
"target extended-remote | ${config:riscv_openocd_path}/openocd -c \"gdb_port pipe; log_output openocd.log\" -f ${config:riscv_openocd_path}/wch-riscv.cfg",
"set confirm off",
"set mem inaccessible-by-default off",
"set architecture riscv:rv32",
"set remotetimeout unlimited",
"set remote hardware-breakpoint-limit 4",
"mon reset halt",
"load ",
"tb main ",
"b deadEnd "
]
}
]
}
NB: This WCH OpenOcd daemon is unstable and needs to be restarted at each launch hence the way it is started here.
Comments
Post a Comment