James Blogs

1、在树莓派上下载编译openocd

sudo apt install -y make libtool autoconf automake texinfo  # 安装依赖
git clone <https://github.com/ntfreak/openocd> && cd openocd
./bootstrap
./configure --enable-maintainer-mode --enable-bcm2835gpio --enable-sysfsgpio
make -j4
sudo make install

2、新建配置文件

nrf52832.cfg

interface bcm2835gpio

# Raspi1 and RaspiZero peripheral_base address
# bcm2835gpio_peripheral_base 0x20000000
# Raspi2 and Raspi3 peripheral_base address
bcm2835gpio_peripheral_base 0x3F000000

# Raspi1 and RaspiZero BCM2835: (700Mhz)
# bcm2835gpio_speed_coeffs 113714 28
# Raspi2 BCM2836 (900Mhz):
# bcm2835gpio_speed_coeffs 146203 36
# Raspi3 BCM2837 (1200Mhz):
bcm2835gpio_speed_coeffs 194938 48

# SWD GPIO set: swclk swdio
bcm2835gpio_swd_nums 25 24

transport select swd

set CHIPNAME nrf52832
source [find target/nrf52.cfg]

# Uncomment & lower speed to address errors
# adapter_khz 1000

init
targets

3、连接并烧录

openocd -c "telnet_port pipe;log_output /dev/null" -f nrf52832.cfg

reset halt
program <ObjectPath> verify
reset run