相关软件
在 https://www.segger.com/downloads/jlink/ 网址下载安装J-Link Software and Documentation pack。
在 https://developer.arm.com/downloads/-/gnu-rm 网址下载安装Arm GNU toolchain。
在 https://www.segger.com/downloads/jlink/ 网址下载安装J-Link Runtime Library
初始化J-Trace PRO V3
与jlink相同,J-Trace也可以使用JLinkGDBServer进行调试,初始GDB Server start settings如下:
-----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: Unspecified
Target interface: JTAG
Target interface speed: 4000kHz
Target endian: little
其中Target interface是JTAG,需要将其改为SWD,否则连接不上,常用的JLinkGDBServer参数如下:
- -port指定了GDB Server监听的端口。
- -select指定了连接到J-Link的方式。
- -if指定了调试接口。
- -speed指定了J-Link与目标设备的通信速度。
- -device指定了目标设备的型号。
JLinkGDBServer -if SWD # 改变Target interface为SWD
使用gdb连接
启动arm-none-eabi-gdb调试器,使用target remote localhost:2331连接JLinkGDBServer 。
$ ./arm-none-eabi-gdb yourprogrammer.elf
GNU gdb (GNU Arm Embedded Toolchain 10-2020-q4-major) 10.1.90.20201028-git
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=x86_64-linux-gnu --target=arm-none-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb) target remote localhost:2331
Remote debugging using localhost:2331
warning: No executable has been specified and target does not support
determining executable automatically. Try using the "file" command.
0x000004cc in ?? ()
(gdb)