This is an old revision of the document!
Table of Contents
OpenOCD & Raspberry Pi
On a Raspberry Pi following the openOCD manual by Lady Ada.
Install:
$ sudo apt-get install git autoconf libtool make pkg-config libusb-1.0-0 libusb-1.0-0-dev htop
Git clone:
$ git clone http://openocd.zylin.com/openocd $ cd openocd/
Configure & Install:
$ ./bootstrap $ ./configure --enable-sysfsgpio --enable-bcm2835gpio $ make $ sudo make install
Check Interfaces:
$ cd /usr/local/share/openocd/scripts/interface/ $ ls
New Folder:
$ cd ~ $ mkdir bootloader $ cd bootloader
Download the Bootloader:
$ wget https://github.com/arduino/ArduinoCore-samd/raw/master/bootloaders/zero/samd21_sam_ba.bin $ wget https://github.com/Seeed-Studio/ArduinoCore-samd/blob/master/bootloaders/XIAOM0/bootloader-XIAO_m0-v3.7.0-33-g90ff611-dirty.bin $ wget "https://github.com/arduino/ArduinoCore-samd/blob/master/bootloaders/mkrzero/samd21_sam_ba_arduino_mkrzero.bin"
Make your Config File:
$ nano openocd.cfg
Add:
source [find interface/raspberrypi3-native.cfg] transport select swd set CHIPNAME at91samd21g18 source [find target/at91samdXX.cfg] # did not yet manage to make a working setup using srst #reset_config srst_only reset_config srst_nogate adapter srst delay 100 adapter srst pulse_width 100 #bcm2835gpio_swd_nums 25 24 #bcm2835gpio_trst_num 7 #bcm2835gpio_srst_num 18 init targets reset halt #at91samd chip-erase #at91samd restore at91samd bootloader 0 program samd21_sam_ba.bin verify #program bootloader-XIAO_m0-v3.7.0-33-g90ff611-dirty.bin verify #flash write_image unlock bootloader-XIAO_m0-v3.7.0-33-g90ff611-dirty.bin at91samd bootloader 8192 reset shutdown
… and run it
$ sudo openocd -f openocd.cfg
If needed change the Raspberry Pi interface file:
$ sudo nano /usr/local/share/openocd/scripts/interface/raspberrypi2-native.cfg $ sudo nano /usr/local/share/openocd/scripts/interface/raspberrypi3-native.cfg
Change:
# Each of the SWD lines need a gpio number set: swclk swdio # Header pin numbers: 23 22 bcm2835gpio_swd_nums 25 24
# If you define trst or srst, use appropriate reset_config # Header pin numbers: TRST - 26, SRST - 18 bcm2835gpio_trst_num 7 bcm2835gpio_srst_num 18
HEX files
Pinout
Programming Adapter
These Adapter are made with Super Glue and Pogo Pins.
Seeeduino XIAO Adapter
3.3V is take from the regular pins.
SAMD21 M0-Mini Adapter
Power and ground is connected over the regular pins.