[英]J-Link GDB debugging in CLion
不久前,CLion 添加了对远程 GDB 调试的支持,我正在尝试使用 Seggers 的 J-Link GDB 服务器进行设置。
我的设置:
我通常在 Windows 中工作,但由于 CLion 不支持 Windows 中的远程 GDB,我试图让它在 VirtualBox 中运行 Ubuntu。 我在 CLion 中配置了调试器,如图所示,并从上面链接中的博客中获得了一些帮助。 我使用的参数基于 J-Link 文档(文档:UM08001)和一些猜测。 GDB 服务器设置
我的问题是,当运行调试器时,进程会停止并且 CLion 的控制台输出:
“无法连接到目标。请检查电源、连接和设置。”
我试图从终端运行 JLinkGDBServer 然后我得到了这个:
/usr/bin/JLinkGDBServer -device nrf51422_xxAC -if swd -speed 1000 -endian little
SEGGER J-Link GDB Server V6.10 Command Line Version
JLinkARM.dll V6.10 (DLL compiled Sep 14 2016 16:46:16)
-----GDB Server start settings-----
GDBInit file: none
GDB Server Listening port: 2331
SWO raw output listening port: 2332
Terminal I/O port: 2333
Accept remote connection: yes
Generate logfile: off
Verify download: off
Init regs on start: off
Silent mode: off
Single run mode: off
Target connection timeout: 0 ms
------J-Link related settings------
J-Link Host interface: USB
J-Link script: none
J-Link settings file: none
------Target related settings------
Target device: nrf51422_xxAC
Target interface: SWD
Target interface speed: 1000kHz
Target endian: little
Connecting to J-Link...
J-Link is connected.
Firmware: J-Link OB-SAM3U128-V2-NordicSemi compiled Jul 5 2016 08:42:09
Hardware: V1.00
S/N: 681666518
Checking target voltage...
Target voltage: 3.30 V
Listening on TCP/IP port 2331
Connecting to target...Connected to target
Waiting for GDB connection...
有没有人知道我做错了什么?
您可能混淆了 GDB 服务器和 GDB 本身。 这些是应该在 CLion 的 GDB 远程调试配置中设置的 GDB 选项,而不是 GDB 服务器设置。
也就是说,您首先手动运行 JLinkGDBServer,例如,从终端运行,就像您已经完成的那样,然后让它等待 GDB 附加。 此时应该注意连接端口:
Listening on TCP/IP port 2331 Connecting to target...Connected to target Waiting for GDB connection...
然后在 CLion 中编辑您的 GDB 远程调试配置以使用主机 GDB(在您的情况下很可能是/usr/bin/gdb
,如有必要,请使用sudo apt install gdb
进行sudo apt install gdb
),并使用上面提到的端口作为“目标”的一部分远程”字符串:
/usr/bin/gdb
:2331
注意端口前面的冒号。 这是使用 TCP 连接到 localhost 的简写。 以防万一,显式形式是tcp:localhost:2331
。
现在您可以启动调试会话。 CLion 将启动配置好的主机 GDB,GDB 通过指定的 TCP 连接与 JLinkGDBServer 通信,最后 GDB 服务器与您的设备聊天。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.