无法在 Mac 上安装和配置 J-Link JTAG 调试器
Posted
技术标签:
【中文标题】无法在 Mac 上安装和配置 J-Link JTAG 调试器【英文标题】:Unable to install and configure a J-Link JTAG debugger on a Mac 【发布时间】:2020-09-24 08:38:49 【问题描述】:我有一个 Segger J-Link,我正试图在运行 MacOS Catalina 10.15.4 的 Macbook 上使用它,并带有 openocd 和 GDB 对 ESP32 板。问题是我看不到设备:
$ ls /dev/cu.*
/dev/cu.Bluetooth-Incoming-Port /dev/cu.JimsiPhone-WirelessiAP /dev/cu.SLAB_USBtoUART /dev/cu.usbserial-0001
这些都不是 J-Link。如果我运行 lsusb 我可以看到它:
$ lsusb
Bus 020 Device 002: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP210x UART Bridge / myAVR mySmartUSB light
Bus 020 Device 003: ID 1366:0101 SEGGER J-Link ARM
我已经安装了从 Segger 下载的“J-Link 软件和文档包”。我检查了 Mac 的“安全和隐私”设置,它没有报告它阻止了任何驱动程序或程序的安装或运行。
在 J-Link 上,绿色 LED 亮起,每秒闪烁两次,非常短暂。
我确定我缺了一块,希望能得到一些帮助。
更新:我一直按照这里的说明进行操作:
OpenOCD Instructions
在我进入第 6 步之前一切正常,我按照以下说明进行操作:
Serial driver instructions
问题是,驱动程序的路径永远不会出现,如上所述。如果我不能让它与我的 J-link 对话,我认为我无法运行 OpenOCD。
当我运行 openocd-esp32 时,我得到(来自 openocd-esp32 输出的完整粘贴如下):
Error: No J-Link device found.
esp32-wroom-32.cfg的内容是:
echo "WARNING: boards/esp-wroom-32.cfg is deprecated, and may be removed in a future release."
set ESP32_FLASH_VOLTAGE 3.3
source [find target/esp32.cfg]
这是完整的粘贴:
Jims-MacBook-Pro-486:~ jim$ openocd -f interface/jlink.cfg -f board/esp-wroom-32.cfg -c "program_esp32 build/hello-world.bin 0x10000 verify exit"
Open On-Chip Debugger v0.10.0-esp32-20200420 (2020-04-20-16:15)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
WARNING: boards/esp-wroom-32.cfg is deprecated, and may be removed in a future release.
Info : Configured 2 cores
Error: No J-Link device found.
** OpenOCD init failed **
shutdown command invoked
Assertion failed: (jtag_trst == 0), function jtag_checks, file src/jtag/core.c, line 343.
Abort trap: 6
运行 JLinkExe 确实找到了 J-Link:
Jims-MacBook-Pro-486:~ jim$ JLinkExe
SEGGER J-Link Commander V6.80b (Compiled Jun 5 2020 17:42:04)
DLL version V6.80b, compiled Jun 5 2020 17:41:46
Connecting to J-Link via USB...Updating firmware: J-Link V11 compiled Apr 23 2020 16:49:23
Replacing firmware: J-Link V11 compiled Aug 14 2019 16:21:09
Waiting for new firmware to boot
New firmware booted successfully
O.K.
Firmware: J-Link V11 compiled Apr 23 2020 16:49:23
Hardware version: V11.00
S/N: 51000936
License(s): GDB
VTref=0.000V
Type "connect" to establish a target connection, '?' for help
J-Link>
执行上述操作后,我现在在运行 openocd-esp32 时收到不同的错误消息(可能是因为 J-Link 固件升级?)。最初它抱怨没有设置适配器速度,所以我修改了interface/jlink.cfg并添加了:
adapter_khz 3000
我现在得到一个不同的错误:
Error: JTAG scan chain interrogation failed: all ones
我一直在谷歌上搜索,这可能意味着电路板坏或还有另一个配置问题。 SD卡插槽中没有SD卡,板上没有其他SPI设备,虽然ESP32-WROVER-32U上面有SPI flash。
这是 openocd-esp32 的完整输出:
Jims-MacBook-Pro-486:~ jim$ openocd -f interface/jlink.cfg -f board/esp-wroom-32.cfg -c "program_esp32 build/hello-world.bin 0x10000 verify exit"
Open On-Chip Debugger v0.10.0-esp32-20200420 (2020-04-20-16:15)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
adapter speed: 3000 kHz
WARNING: boards/esp-wroom-32.cfg is deprecated, and may be removed in a future release.
Info : Configured 2 cores
Info : J-Link V11 compiled Apr 23 2020 16:49:23
Info : Hardware version: 11.00
Info : VTarget = 0.000 V
Info : clock speed 3000 kHz
Error: JTAG scan chain interrogation failed: all ones
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway...
Error: esp32.cpu0: IR capture error; saw 0x1f not 0x01
Warn : Bypassing JTAG setup events due to errors
Info : Listening on port 3333 for gdb connections
Error: JTAG scan chain interrogation failed: all ones
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway...
Error: esp32.cpu0: IR capture error; saw 0x1f not 0x01
Warn : Bypassing JTAG setup events due to errors
Info : cpu0: Debug controller 0 was reset.
Info : cpu0: Core 0 was reset.
Error: esp32_soc_reset: Couldn't halt target before SoC reset
embedded:startup.tcl:449: Error: ** Unable to reset target **
in procedure 'program_esp32'
in procedure 'program_esp' called at file "/Users/jim/.espressif/tools/openocd-esp32/v0.10.0-esp32-20200420/openocd-esp32/share/openocd/scripts/target/esp32.cfg", line 64
in procedure 'program_error' called at file "/Users/jim/.espressif/tools/openocd-esp32/v0.10.0-esp32-20200420/openocd-esp32/share/openocd/scripts/target/esp_common.cfg", line 75
at file "embedded:startup.tcl", line 449
Warn : Flash driver of esp32.flash does not support free_driver_priv()
Warn : Flash driver of esp32.irom does not support free_driver_priv()
Warn : Flash driver of esp32.drom does not support free_driver_priv()
成功!该电路使用 Segger 10 针针式连接器。在那个连接器上,引脚 1 是 VTREF,而在我的板上,它本应连接到 V3.3 时处于浮动状态。我连接了它并且:
Jims-MacBook-Pro-486:~ jim$ openocd -f interface/jlink.cfg -f board/esp32-wrover.cfg
Open On-Chip Debugger v0.10.0-esp32-20200420 (2020-04-20-16:15)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
adapter speed: 1000 kHz
WARNING: boards/esp32-wrover.cfg is deprecated, and may be removed in a future release.
If your board is ESP32-WROVER-KIT, use board/esp32-wrover-kit-1.8v.cfg instead.
Info : Configured 2 cores
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : J-Link V11 compiled Apr 23 2020 16:49:23
Info : Hardware version: 11.00
Info : VTarget = 3.290 V
Info : clock speed 1000 kHz
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32: Debug controller 0 was reset.
Info : esp32: Core 0 was reset.
Info : esp32: Debug controller 1 was reset.
Info : esp32: Core 1 was reset.
Info : Listening on port 3333 for gdb connections
【问题讨论】:
您正在执行的确切 openocd 命令是什么?它的确切输出是什么? 很抱歉刚刚看到您的回复。今晚我会更新我的问题,谢谢。 @Frant 我已经为我的问题添加了一些细节。 我更多的是要求复制/粘贴您执行的确切 openocd 命令及其输出。有什么不能生产的原因吗? @Frant 对不起,我已经添加了。错误是它找不到 J-Link 设备,这是有道理的,因为似乎没有通往它的路径。 【参考方案1】:我建议逐步验证您的设置 - 我个人不喜欢 big bang 集成。
-
验证您的 Segger 软件可以看到您的 JLink 探针 - 好在
lsusb
可以看到它。 JLink Commander 应该提供一些有用的信息。
在没有任何可执行相关参数的情况下启动 openocd:openocd -f interface/jlink.cfg -f board/esp-wroom-32.cfg
验证基本命令是否正常工作,即重置 CPU、显示寄存器、读/写内存。
如果您仍在尝试问题,请仔细检查您的接线 - 请参阅here 了解更多信息。
【讨论】:
以上是关于无法在 Mac 上安装和配置 J-Link JTAG 调试器的主要内容,如果未能解决你的问题,请参考以下文章