https://github.com/wallarug/rpi-openocd
Starting Template for using Raspberry Pi as an OpenOCD Programmer
https://github.com/wallarug/rpi-openocd
Last synced: 4 months ago
JSON representation
Starting Template for using Raspberry Pi as an OpenOCD Programmer
- Host: GitHub
- URL: https://github.com/wallarug/rpi-openocd
- Owner: wallarug
- Created: 2020-01-18T12:54:37.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-03-30T10:29:47.000Z (about 6 years ago)
- Last Synced: 2025-07-07T04:07:16.987Z (11 months ago)
- Language: GDB
- Size: 16.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# OpenOCD Toolkit
This contains the files required to use the Raspberry Pi as a programmer on GPIO24 and GPIO25. Use the Hackster.io Tutorial for usage instructions.
## Directory Stucture
```
openocd
./firmware - contains bin files
./interface - contains config files for openocd
./target - contains atsamd21 for openocd
```
## Prepare Build Environment (for OpenOCD)
```
sudo apt install gcc-arm-none-eabi dirmngr libtool autoconf libusb-dev
```
**Clone the OpenOCD repository**
Note: (as of writing 322d2fa12c9b5520e06c1d581ce8b4e3c75750ca):
```
git clone https://git.code.sf.net/p/openocd/code openocd-code
cd openocd-code
./bootstrap
./configure --enable-sysfsgpio --enable-bmc8235gpio
make
sudo make install
```
## Usage
**Note:** Remember to update openocd.cfg before uploading. Make sure correct bootloader/firmware is being uploaded.
```
sudo openocd
```
## Example Usage - Arduino Bootloader
Lets flash the Arduino Zero (or Adafruit Feather m0) bootloader:
```
cd openocd
wget -O samd21_sam_ba.bin https://github.com/arduino/ArduinoCore-samd/blob/master/bootloaders/zero/samd21_sam_ba.bin?raw=true
openocd -f bootloader.cfg
```
## Padding File
OpenOCD does not allow for uploading of bin files without a firmware attached. To overcome this, all firmware (CircuitPython, Seesaw, etc) needs to be padded by 0x2000 bits (8 kbytes) for the bootloader. Use below if you plan on using OpenOCD for uploading new firmware.
```
truncate -s 8192 samd21_sam_ba.bin; cat samd21_sam_ba.bin firmware.bin > boot-firmware.bin
```
* samd21_sam_ba.bin - bootloader
* firmware.bin - firmware binary (CircuitPython, Seesaw, etc)
* boot-firmware.bin - output file to be uploaded using `sudo openocd`