用的是EVKmini,ft2232作为调试器jtag接口调试
启动start_gui.exe
以hello_world为例,更改一下build path,可以generate并使用gcc compile
最后会得到这些
点击start_gui里面的命令行,用命令行启动vscode
新建.vscode文件夹,建立两个文件
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "HPM Debug",
"cwd": "${workspaceRoot}",
// "executable": "${command:cmake.launchTargetPath}",
"executable": "${workspaceRoot}/build/output/demo.elf",
"request": "launch",
"type": "cortex-debug",
"servertype": "openocd",
"searchDir": ["${env:OPENOCD_SCRIPTS}"],
"device": "HPM6750",
"configFiles": [
"probes/ft2232.cfg",
"soc/hpm6750-single-core.cfg",
"boards/hpm6750evkmini.cfg"
],
"armToolchainPath": "${env:GNURISCV_TOOLCHAIN_PATH}/bin",//工具链的路径
"gdbPath": "${env:GNURISCV_TOOLCHAIN_PATH}/bin/riscv32-unknown-elf-gdb",//GDB的路径
"interface": "jtag",
"svdFile":"${env:HPM_SDK_BASE}/soc/HPM6700/HPM6750/HPM6750_svd.xml",
// "showDevDebugOutput": "raw",
"runToEntryPoint": "main",
// Work around for stopping at main on restart
"postRestartCommands": [
"break main",
"continue"
],
"preLaunchTask":"CMake: build"
}
]
}
settings.json
{
"cmake.buildBeforeRun": true,
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools",
"cortex-debug.openocdPath.windows": "D:\\sdk_env-1.6.0\\tools\\openocd\\openocd.exe",
"cortex-debug.gdbPath.windows": "${env:GNURISCV_TOOLCHAIN_PATH}/bin/riscv32-unknown-elf-gdb.exe",
"cortex-debug.objdumpPath.windows": "${env:GNURISCV_TOOLCHAIN_PATH}/bin/riscv32-unknown-elf-objdump.exe",
"cortex-debug.armToolchainPath.windows": "${env:GNURISCV_TOOLCHAIN_PATH}/bin",
"cortex-debug.variableUseNaturalFormat": false,
"cmake.configureSettings": {
"BOARD":"hpm6750evkmini"
},
"cmake.defaultVariants": {
"buildType": {
"choices": {
"flash_xip": {
"short": "flash_xip",
"long": "hpm flash xip",
"buildType": "flash_xip"
}
}
}
},
"files.associations": {
"stdio.h": "c",
"hpm_debug_console.h": "c",
"board.h": "c"
}
}
vscode安装cortex-debug、cmake tools
cmake点这里
scan for kits,找到riscv的gcc
选release或者debug,然后build
点击进行单步调试,此时先build再烧写程序进入调试
单步调试
目前svd文件还读不进去,不知道为什么