首先给树莓派刷入 Raspberry Pi OS Lite ,选择最新的 32bit debian12 即可,这里不再赘述。
使用最新的 openocd官方最新版本 编译、安装
1 2 3 4 5 6
git clone git://git.code.sf.net/p/openocd/code openocd cd openocd ./bootstrap with-submodules ./configure --enable-bcm2835gpio --prefix=path/to/openocd_install_path --enable-internal-jimtcl make make install
安装好软件后,我们需要连一下 raspberry pi 1a 和 raspberry pi 5
raspberry pi 5 仅支持 SWD 接口,位于 UART 接口 (默认为 UART,可以配置为 SWD) 可以从某宝上购买 JST SH 1.0 mm 3pin 的转接线转到标准 2.54mm 间距的杜邦线。从左往右依次为
# MEM-AP for direct access target create $_CHIPNAME.ap mem_ap -dap $_CHIPNAME.dap -ap-num 0
# these addresses are obtained from the ROM table via 'dap info 0' command set _DBGBASE {0x80010000 0x80110000 0x80210000 0x80310000} set _CTIBASE {0x80020000 0x80120000 0x80220000 0x80320000}
set _smp_command "target smp"
for { set _core 0 } { $_core < $_cores } { incr _core } { set _CTINAME $_CHIPNAME.cti$_core set _TARGETNAME $_CHIPNAME.cpu$_core
$ ./bin/openocd -f interface/raspberrypi-native.cfg -f target/rpi5b.cfg Open On-Chip Debugger 0.12.0+dev-00850-gd09f53a93-dirty (2025-02-12-18:25) Licensed under GNU GPL v2 For bug reports, read http://openocd.org/doc/doxygen/bugs.html Warn : TMS/SWDIO moved to GPIO 8 (pin 24). Check the wiring please! 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 3646 kHz Info : SWD DPIDR 0x2ba01477 Info : [bcm2712.ap] Examination succeed Info : bcm2712.cpu0: hardware has 6 breakpoints, 4 watchpoints Info : [bcm2712.cpu0] Examination succeed Info : bcm2712.cpu1: hardware has 6 breakpoints, 4 watchpoints Info : [bcm2712.cpu1] Examination succeed Info : bcm2712.cpu2: hardware has 6 breakpoints, 4 watchpoints Info : [bcm2712.cpu2] Examination succeed Info : bcm2712.cpu3: hardware has 6 breakpoints, 4 watchpoints Info : [bcm2712.cpu3] Examination succeed Info : [bcm2712.ap] gdb port disabled Info : [bcm2712.cpu0] starting gdb server on 3333 Info : Listening on port 3333 for gdb connections Info : [bcm2712.cpu1] starting gdb server on 3334 Info : Listening on port 3334 for gdb connections Info : [bcm2712.cpu2] starting gdb server on 3335 Info : Listening on port 3335 for gdb connections Info : [bcm2712.cpu3] starting gdb server on 3336 Info : Listening on port 3336 for gdb connections