Pinecil 的 JLink JTAG 访问方式
JLink JTAG Access on the Pinecil

原始链接: https://danielmangum.com/posts/jlink-jtag-pinecil/

随着 Zephyr 对 Bouffalo Lab BL706 MCU 上游支持的完善,作者提供了一份关于 Pinecil 电烙铁 JTAG 调试的指南。虽然 UART 对于获取日志很有用,但 JTAG 访问对于深入的系统初始化和驱动程序调试至关重要。 此过程需要作者此前记录的 Pinecil 转接板,它提供了包括 3.3V 参考电压和接地引脚在内的必要 JTAG 信号。作者详细介绍了使用 J-Link 调试器和母对母杜邦线(或为了方便起见使用排线)的连接过程。 在确保引脚映射正确(特别是匹配 VTref 3.3V 引脚)后,通过 `JLinkExe` 验证连接。最后,作者演示了如何初始化 `JLinkGDBServer` 以连接到 MCU 的 SiFive E24 内核。这使开发人员能够使用 `gdb` 加载固件符号、设置断点并进行单步调试,从而促进对 Pinecil 内部组件的高级调试。

对不起。
相关文章

原文

It has been more than two years since I bought a Pinecil soldering iron and wrote about soldering the breakout board and accessing the UART. I’ve been doing more work with the Pinecil as of late following the addition of upstream support for the Bouffalo Lab BL706 MCU in Zephyr (big shout out to @VynDragon, @will-tm, @josuah, and everyone else who has been contributing to the upstream Bouffalo Lab efforts!).

While accessing the UART is helpful for viewing logs, debug access is critical when chasing down early system initialization and driver issues. While there are a variety of JTAG probes on the market, I typically reach for my JLink due to its broad compatibilty and robust tooling. In order to connect a JLink to the Pinecil, the breakout board described in my previous posts is required. It includes a 10-pin header for JTAG breakout with a 3v3 reference pin, 4 GND pins, and the standard JTAG signals. While there are many adapters for attaching various debug pinouts to the JLink 20-pin connector, it is easy to use female-to-female dupont wires to connect the standard 2.54mm pins on the Pinecil breakout and the JLink. The diagram at the top of this post illustrates the pin mapping, and the image below shows the wiring with a ribbon cable between the wires and the JLink (with female-to-male dupont wires), which can be useful to avoid having to reconnect the pins each time if needing to use the JLink for other purposes between Pinecil debugging sessions.

If using a ribbon cable, it can be easy to get confused about orientation when mapping pins. With the notch upwards, the VTref pin (pin 1 on JLink, see white wire below) is in the top left corner of the ribbon cable pinout as it needs to mate with the VTref pin in the top right corner of the JLink pinout.

After connecting, JLinkExe can be used to verify that the mapping is correct. The VTref connection to the breakout board’s 3v3 pin should allow the JLink to detect the logic voltage level (~ 3.3V).

SEGGER J-Link Commander V9.28 (Compiled Mar 18 2026 15:27:55)
DLL version V9.28, compiled Mar 18 2026 15:26:49

Connecting to J-Link via USB...O.K.
Firmware: J-Link V11 compiled Apr  1 2025 10:02:30
Hardware version: V11.00
J-Link uptime (since boot): 0d 00h 00m 02s
S/N: 821010562
License(s): GDB
USB speed mode: High speed (480 MBit/s)
VTref=3.335V

To attach a debugger, such as gdb, JLinkGDBServer can be used to connect to the JTAG circuitry on the underlying SiFive E24 core complex in the BL706 MCU and start a local gdb server on port 2331.

JLinkGDBServer -device E24 -if JTAG
SEGGER J-Link GDB Server V9.28 Command Line Version

JLinkARM.dll V9.28 (DLL compiled Mar 18 2026 15:26:49)

Command line: -device E24 -if JTAG
-----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:                 E24
Target device parameters:      none
Target interface:              JTAG
Target interface speed:        4000kHz
Target endian:                 little

Connecting to J-Link...
J-Link is connected.
Firmware: J-Link V11 compiled Apr  1 2025 10:02:30
Hardware: V11.00
S/N: 821010562
Feature(s): GDB
Checking target voltage...
Target voltage: 3.30 V
Listening on TCP/IP port 2331
Connecting to target...

J-Link found 1 JTAG device, Total IRLen = 5
JTAG ID: 0x20000E05 (RISC-V)
Halting core...
RISC-V RV32 detected. Using RV32 register set for communication with GDB
Core implements single precision FPU
Connected to target
Waiting for GDB connection...

The following gdb command can be used to connect to the server and load the firmware symbols.

gdb -ex 'target remote :2331' ./path/to/firmware.elf
Remote debugging using :2331
arch_irq_unlock (key=8) at /home/hasheddan/code/github.com/zephyrproject-rtos/zephyr/include/zephyr/arch/riscv/arch.h:338
338		__asm__ volatile ("csrs " RV_STATUS_CSR ", %0"

From there you can start stepping through instructions.

Happy debugging!

联系我们 contact @ memedata.com