一、描述你遇到的问题
我使用 BearPi-Pico H3863 / WS63 开发板,想通过 J-Link V9 连接 SWD/JTAG 进行 GDB 调试。
目前串口下载和串口日志正常,J-Link 也能识别到目标板电压,并且 J-Link 的 nRESET 可以复位开发板。但 OpenOCD 使用 J-Link 连接 SWD 时无法读取调试端口 ID,报错:
Error connecting DP: cannot read IDR
JTAG 扫链也失败,结果为 all zeroes。
想确认 H3863 / WS63 使用 J-Link 调试的正确方法
二、你具体做的所有步骤结果截图
我的接线:
J-Link VTref Pin1 -> BearPi 3V3
J-Link GND -> BearPi GND
J-Link SWDIO/TMS Pin7 -> BearPi GPIO13 / JTAG_TMS / SWD
J-Link SWCLK/TCK Pin9 -> BearPi GPIO14 / JTAG_TCK / SWC
J-Link nRESET Pin15 -> BearPi RST
SWO -> 未连接
系统识别 J-Link:
Bus 001 Device 006: ID 1366:0105 SEGGER J-Link
J-Link 读取目标电压正常:
Info : J-Link V9 compiled May 7 2021 16:26:12
Info : Hardware version: 9.70
Info : VTarget = 3.300 V
SWD 测试命令:
openocd -f interface/jlink.cfg
-c "adapter serial 000602712337"
-c "transport select swd"
-c "adapter speed 100"
-c "reset_config srst_only srst_push_pull connect_deassert_srst"
-c "swd newdap ws63 cpu"
-c "dap create ws63.dap -chain-position ws63.cpu"
-c "init"
-c "dap info 0"
-c "shutdown"
结果:
adapter speed: 100 kHz
Info : J-Link V9 compiled May 7 2021 16:26:12
Info : Hardware version: 9.70
Info : VTarget = 3.296 V
Info : clock speed 100 kHz
Error: Error connecting DP: cannot read IDR
测试过 SWD 速度:
10 / 25 / 50 / 100 / 500 / 1000 / 5000 kHz
结果都一样:
Error connecting DP: cannot read IDR
JTAG 测试结果:
Error: JTAG scan chain interrogation failed: all zeroes
Error: ws63.cpu: IR capture error; saw 0x00 not 0x01
J-Link nRESET 测试正常:执行 reset 后,开发板串口重新输出 boot. 日志。
SDK 里看到的调试配置:
build/config/target_config/ws63/ws63.json:
"debug": {
"elf_path": "./output/ws63/acore/ws63-liteos-app/ws63-liteos-app.elf",
"breakpoints_limitation": "7",
"client": ["gdb"],
"tool": ["jlink"],
"params": [
{
"name": "jlink",
"param": {
"interface": ["swd", "jtag"],
"speed": "5000",
"port": "3333"
}
}
]
}
deveco_config.json:
"debug": {
"debug_client": "gdb",
"debug_tool": "jlink",
"debug_interface": "swd",
"debug_device": "CPU CORE|RISC-V|RISC-V"
}
四、开发板串口所有日志
boot.
Flash Init Fail! ret = 0x80001341
verify_public_rootkey secure verify disable!
verify_params_key_area secure verify disable!
verify_params_area_info secure verify disable!
verify_image_key_area secure verify disable!
verify_image_code_info secure verify disable!
SSB Uart Init Succ!
SSB Flash Init Succ!
verify_image_key_area secure verify disable!
verify_image_code_info secure verify disable!
Flashboot Uart Init Succ!
Flashboot Malloc Init Succ!
Flash Init Succ!
No need to fix SR!
io level work in hw mode, level[chip]:0x33
flashboot version : 1.10.102
[UPG] upgrade init OK!
No need to upgrade...
flash_encrypt disable.
verify_image_key_area secure verify disable!
verify_image_code_info secure verify disable!