This is an old revision of the document!


SAMD21 Bootloader


... with a Raspberry Pi

One has to install OpenOCD on a Raspberry Pi:
Update and install some tools:

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

Download OpenOCD from http://openocd.zylin.com/#/admin/projects/openocd:

git clone http://openocd.zylin.com/openocd

Compile:

cd openocd-code
./bootstrap
./configure --enable-sysfsgpio --enable-bcm2835gpio
make
sudo make install

List of Interfaces:

cd /usr/local/share/openocd/scripts/interface
ls

Downloading the Bootloader:

cd ~
mkdir bootloader
cd 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

Make a Configuration File:

nano openocd.cfg

and add:

source [find interface/raspberrypi2-native.cfg]
transport select swd
   
set CHIPNAME at91samd21g18
source [find target/at91samdXX.cfg]

reset_config  srst_nogate

adapter_nsrst_delay 100
adapter_nsrst_assert_width 100
   
init
targets
reset halt

Connecting the SAMD21 Board:

 RasPi-GPIO  SAMD21
    18        Reset
    24        SWD IO
    25        SWD CLK
    GND       GND
    3V3       3V3

and Adalink ARM CPU Tool

Download the software from:
https://www.segger.com/downloads/jlink/

Install OpenOCP


Bootloader

Here one finds some SAMD21 bootloader:

Arduino Zero Bootloader

Arduino MKR ZERO

Seeeduino XIAO Bootloader


Acknowledge