eclipse risc-v调试
一)设置编译环境
1)导入工程
2)(推荐)
在.bashrc文件中加入
export PATH=$PATH:/home/yanxiang/rv_linux_bare_9.21_centos64/bin
或者
(不推荐)
工程属性/MCU/RISC-V Toolchains Paths
Toolchain folder:/home/yanxiang/rv_linux_bare_9.21_centos64/bin
3)(推荐)
sudo apt install rename
rename "s/nuclei-elf/none-embed/" * //
#工程属性/MCU/C_C++Build/Settings/Toolchains
Prefix:riscv-none-embed- //保持原状即可
或者(不推荐)
工程属性/MCU/C_C++Build/Settings/Toolchains
Prefix:riscv-nuclei-elf-
开始编译工程/确定是否成功。
二)设置调试环境
1)Run/Debug配置/GDB OpenOCD Debugging/右击 New Configuration/
选择新建配置项/Main标签/在C_C++ Application项 点击 Search Project…按钮
如果在上述编译成功C_C++ Application项会自动填入编译生成的项如:GD32VF103xB/GD32VF103V_EVAL.elf
2)Run/Debug配置/GDB OpenOCD Debugging/New Configuration/新建项/Debug标签/
a)指定openocd路径:/home/yanxiang/openocd/bin/openocd
b)config options: -f /home/yanxiang/openocd/openocd_jlink.cfg
c)commands新增行:
set arch riscv:rv32
注意:如果是64位cpu可以不设置最末一项
如果32位cpu忘记设置c项可能会提示如下错误:
bfd requires xlen 8, but target has xlen 4
bfd requires xlen 8, but target has xlen 4
Run/Debug配置/GDB OpenOCD Debugging/GD32VF103V_XXX/Debugger
指定cpu架构为32位
set arch riscv:rv32
3)指定SVD Path路径
file path: /home/yanxiang/openocd/GD32VF103.svd