在树莓派上使用Openocd进行ARM CC3200调试

问题描述 投票:0回答:1

我正在尝试通过 TI ARM CC3200 板上的 jtag 端口将树莓派与 openocd 结合使用作为 TI ARM CC3200 的调试探针。我已经启动并运行了它,但我无法让 jtag 或 swd 工作。我对 openocd 和硬件黑客总体来说是新手,感觉有点失落。

我已经在 pi 上设置了 openocd 并且它已启动并正在运行。这是我的配置文件

# SPDX-License-Identifier: GPL-2.0-or-later

# Config for Raspberry Pi used as a bitbang adapter.
# https://www.raspberrypi.com/documentation/computers/raspberry-pi.html

# Supports all models with 40-pin or 26-pin GPIO connector up to Raspberry Pi 4 B
# also supports Raspberry Pi Zero, Zero W and Zero 2 W.

# Adapter speed calibration is computed from cpufreq/scaling_max_freq.
# Adjusts automatically if CPU is overclocked.

adapter driver bcm2835gpio

proc read_file { name } {
    if {[catch {open $name r} fd]} {
        return ""
    }
    set result [read $fd]
    close $fd
    return $result
}

proc measure_clock {} {
    set result [exec vcgencmd measure_clock arm]
    set clock_hz [lindex [split $result "="] 1]
    expr { $clock_hz / 1000 }
}

proc get_max_cpu_clock { default } {
    set clock [read_file /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq]
    if { $clock > 100000 } {
        return $clock
    }

    # cpufreq not available. As the last resort try Broadcom's proprietary utility
    if {![catch measure_clock clock] && $clock > 100000} {
        return $clock
    }

    echo "WARNING: Host CPU clock unknown."
    echo "WARNING: Using the highest possible value $default kHz as a safe default."
    echo "WARNING: Expect JTAG/SWD clock significantly slower than requested."

    return $default
}

set compat [read_file /proc/device-tree/compatible]
set clocks_per_timing_loop 4

if {[string match *bcm2711* $compat]} {
    set speed_offset 52
} elseif {[string match *bcm2837* $compat] || [string match *bcm2710* $compat]} {
    set speed_offset 34
} elseif {[string match *bcm2836* $compat] || [string match *bcm2709* $compat]} {
    set speed_offset 36
} elseif {[string match *bcm2835* $compat] || [string match *bcm2708* $compat]} {
    set clocks_per_timing_loop 6
    set speed_offset 32
} else {
    set speed_offset 32
    echo "WARNING: Unknown type of the host SoC. Expect JTAG/SWD clock slower than requested."
}

set clock [get_max_cpu_clock 2000000]
set speed_coeff [expr { $clock / $clocks_per_timing_loop }]

# Transition delay calculation: SPEED_COEFF/khz - SPEED_OFFSET
# The coefficients depend on system clock and CPU frequency scaling.
bcm2835gpio speed_coeffs $speed_coeff $speed_offset


# Each of the JTAG lines need a gpio number set: tck tms tdi tdo
# Header pin numbers: 23 24 19 21
adapter gpio tck -chip 0 11
adapter gpio tms -chip 0 8
adapter gpio tdi -chip 0 10
adapter gpio tdo -chip 0 9


adapter gpio swdio -chip 0 11
adapter gpio swclk -chip 0 8

adapter speed 5000

transport select jtag

对于目标配置,我使用了这个text

当我使用 `pi_jtag@raspberrypi:~/config $ openocd -f /home/pi_jtag/config/rpi_config.cfg -f target/ti_cc32xx.cfg 运行它时

我收到此错误:

transport select jtag

pi_jtag@raspberrypi:~/config $ openocd -f /home/pi_jtag/config/rpi_config.cfg -f target/ti_cc32xx.cfg
Open On-Chip Debugger 0.12.0-g4d87f6dca (2023-08-11-07:45)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
jtag
0
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : BCM2835 GPIO JTAG/SWD bitbang driver
Info : clock speed 1000 kHz
Error: JTAG scan chain interrogation failed: all zeroes
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway...
Error: cc32xx.jrc: IR capture error; saw 0x00 not 0x01
Warn : Bypassing JTAG setup events due to errors
Info : starting gdb server for cc32xx.cpu on 3333
Info : Listening on port 3333 for gdb connections

这个

transport select swd

typi_jtag@raspberrypi:~/config $ openocd -f /home/pi_jtag/config/rpi_config.cfg -f target/ti_cc32xx.cfg
Open On-Chip Debugger 0.12.0-g4d87f6dca (2023-08-11-07:45)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
swd
0
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : BCM2835 GPIO JTAG/SWD bitbang driver
Info : clock speed 1000 kHz
Error: Error connecting DP: cannot read IDR

我仔细检查了接线,它是正确的。该芯片使用与 pi 相同的 3.3 伏电压。我想知道如何消除这个错误。谢谢您的帮助。

arm raspberry-pi3 openocd jtag swd
1个回答
0
投票

您使用的是哪种树莓派?如果像我一样是 Raspberry Pi 3 Model B,则需要在 .cfg 中使用灰色 ALT 功能引脚号 GPIO pin functionshttps://i.postimg.cc/c413WHZD/rpi-gpio-functions.jpg

© www.soinside.com 2019 - 2024. All rights reserved.