Connecting to J-Link via USB...O.K. Firmware: J-Link V9 compiled May 7 2021 16:26:12 Hardware version: V9.20 S/N: -1 License(s): RDI, FlashBP, FlashDL, JFlash, GDB VTref=3.330V
Type "connect" to establish a target connection, '?' for help J-Link> connect / Please specify device / core. <Default>: STM32F103C8 Type '?' for selection dialog Device> STM32F103C8 Please specify target interface: J) JTAG (Default) S) SWD T) cJTAG TIF> S Specify target interface speed [kHz]. <Default>: 4000 kHz Speed> 2 mHz Device "STM32F103C8" selected.
Connecting to target via SWD InitTarget() start InitTarget() end Found SW-DP with ID 0x1BA01477 DPIDR: 0x1BA01477 Scanning AP map to find all available APs AP[1]: Stopped AP scan as end of AP map has been reached AP[0]: AHB-AP (IDR: 0x14770011) Iterating through AP map to find AHB-AP to use AP[0]: Core found AP[0]: AHB-AP ROM base: 0xE00FF000 CPUID register: 0x411FC231. Implementer code: 0x41 (ARM) Found Cortex-M3 r1p1, Little endian. FPUnit: 6 code (BP) slots and 2 literal slots CoreSight components: ROMTbl[0] @ E00FF000 [0][0]: E000E000 CID B105E00D PID 001BB000 SCS [0][1]: E0001000 CID B105E00D PID 001BB002 DWT [0][2]: E0002000 CID B105E00D PID 000BB003 FPB [0][3]: E0000000 CID B105E00D PID 001BB001 ITM [0][4]: E0040000 CID B105900D PID 001BB923 TPIU-Lite Cortex-M3 identified. J-Link> /xxx/xxx/xxx/xxx/dfs.bin,0x8000000 #全路径,起始地址
三、JLink常用命令
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
usb 连接目标板 r 重启目标板 halt 停止cpu运行的程序 loadbin 加载可执行的二进制文件 g 跳到代码段地址执行 s 单步执行(调试用) setpc 设置pc寄存器的值(调试用) setbp 设置断点 Regs 读寄存器组织,该命令会把所有的寄存器显示出来 wreg 写寄存器 mem 读内存 w4 写内存 power off mmu 关闭mmu,这个对于裸板调试很重要 w4 cpsr,0x0000001f 切换到系统模式 speed 设置jtag的传输速率 rce 0,c0,c0,0 设置cp15寄存器的第1个寄存器为0 q Quit(退出) qc Close JLink connection andquit(关闭jlink连接,并退出) r Reset target(重启目标)