树莓派 安装OPENOCD

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


这是本实验室推出的一款树莓派扩展板,可对多种单片机、spi-flash、eeprom进行编程烧录。 特定如下: 1 支持SWD接口,配合开源调试器openocd,可对stm32、gd32、nrf51/52、k40/k60实现烧录调试。 2 支持JTAG接口,配合openocd可对全球范围内的多种平台实现调试,如如ARM Cortex-A系列、DSP、FPGA、MIPS等,因为SWD协议只是ARM自己定义的私有协议,而JTAG则是国际IEEE 1149标准。 3 支持ICSP接口,支持AVR系列的所有芯片编程调试,著名的创客开源丹巴ARDUINO系列即使用AVR系列芯片。 4 支持SPI接口,配合开源工具flashrom,可对spi-flash进行编程烧录。 5 支持I2C接口,配合eeprog,可对常见的EEPROM进行编程烧录。 6 引出按键、LED、蜂鸣器,方便用户自行进行二次开发,所有的软件均为开源软件,方便用户自行定制。 硬件软件均为开放开源,方便用户进行个性化的定制,典型使用场景如下: 1. 脱机烧录器、用于产品量产,烧录stm32、AVR、NRF等系列单片机。可使用充电宝为树莓派单独供电,方便的进行产品程序烧录,而且由于树莓派主频极高,烧录速度远超过当前市面上的其他脱机烧录器(其他脱机烧录器一般使用stm32实现,主频只有72MHz,然而树莓派主频则有1.2GHz。) 2. flash烧录器、产品中需要使用flash存储,需要烧录之后再上机进行贴片。 3. eeprom烧录器,一些简单的小电子产品中会使用eeprom,相比flash容量更小,价格也更便宜,可对eeprom进行烧录。 4.无线调试器,部分硬件调试场景需要脱离电脑,如调试电机、四旋翼、机器人等,可将树莓派和扩展板固定在目标上,令树莓派连接到wifi,然后从PC上远程ssh登录到后台使用openocd进行调试。 5. 硬件hack,用于硬件破解,可读出各类芯片中的固件或者数据文件,然后进行逆向分析,传统的工具需要先使用专用硬件和专用软件将数据读出,然后再放到linux使用binwalk之类的工具进行二进制分析,然而通过树莓派强大的Linux环境,完全可以可将固件破解和分析集成在同一套系统中。 更多内容,请查阅https://www.muselab-tech.com/geekgong-ju-ba-shu-me... 已经配置好环境的树莓派镜像,只需烧录到SD卡中,插入到树莓派后启动即可使用: 链接:https://pan.baidu.com/s/1uNPgvZJgs6zxXi0U9eFYbg 提取码:5z9u 已经集成的软件脚本,方便使用: git clonehttps://github.com/wuxx/RPI-HAT-Programmer
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值