树莓派 安装OPENOCD

本文档指导如何在Raspberry Pi上编译OpenOCD,包括安装必要的软件包、下载源代码、配置编译选项等步骤。适用于希望使用最新版OpenOCD进行微控制器编程的用户。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

https://learn.adafruit.com/programming-microcontrollers-using-openocd-on-raspberry-pi/compiling-openocd

Compiling OpenOCD

Compiling OpenOCD takes about 15 minutes but is worth the effort to get the latest code. You'll  need to have command line access and a Pi on the Internet so you can download packages and software.

Thanks to https://petervanhoyweghen.wordpress.com/2015/10/11/burning-zero-bootloader-with-beaglebone-as-swd-programmer/ for the great tutorial, we're just adapting it for Pi usage!

Compiling OpenOCD

Start by doing a fresh sudo apt-get update this will make sure you have the latest packages and repository set up.

Next, run

sudo apt-get install git autoconf libtool make pkg-config libusb-1.0-0 libusb-1.0-0-dev

to install all the tools you'll need to compile OpenOCD. OpenOCD changes a lot and is under constant development so we do suggest compiling your own!

Download the latest source code for OpenOCD with

git clone git://git.code.sf.net/p/openocd/code openocd-code

Change into the code directory and run the bootstrapper with:

cd openocd-code
./bootstrap

Next, we will compile OpenOCD with the Raspberry Pi native GPIO twiddling support - this will work on various Raspberry Pi's despite being called 'bcm2835gpio'

./configure --enable-sysfsgpio --enable-bcm2835gpio

If you're following this guide on a non-Pi embedded linux board, you can skip the --enable-bcm2835gpio part and try to just use sysfsgpio. Sysfsgpio is much slower than native GPIO twiddling but it may not matter too much in your application.

Note that when done, it wont mention GPIO support in the configuration summary, thats OK!

Run make

Assuming compilation completes successfully as above, you can install with

sudo make install

That's pretty much it!

You can see the list of interfaces available in /usr/local/share/openocd/scripts/interface

There's a lot of options, in particular check out raspberrypi2-native.cfg and raspberrypi-native.cfg if you are interested in using OpenOCD with a non-Pi, loot at sysfsgpio-raspberrypi.cfg which can help you port to a different linux computer


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值