Here are the steps to get your code onto a Atmel SAMD21G18, which is often used by Adafruit, by using OpenOCD on a Raspberry Pi 2/3 Model B running an up-to-date Raspbian. You Need to build OpenOCD by yourself to enable the gpio-flags.
Install the build dependencies. Telnet is needed for communication with OpenOCD later:
apt-get install git autoconf libtool make pkg-config libusb-1.0-0 libusb-1.0-0-dev telnet
Get OpenOCD from Github:
git clone https://github.com/ntfreak/openocd.git
./configure --enable-sysfsgpio --enable-bcm2835gpio
Create a minimal config '~/openocd.cfg' containing:
source [find interface/raspberrypi2-native.cfg]
transport select swd
set CHIPNAME at91samd21g18
source [find target/at91samdXX.cfg]
If you use a different microcontroller, set the config file accordingly. Have a look at the flash driver section of the OpenOCD user guide:
Take a look at the Raspberry config file that came with OpenOCD. It works for both RPI 2 and 3:
Find the header pin numbers of swclk, swdio and srst:
# swclk and sdwio
bcm2835gpio_swd_nums 11 25
Uncomment the srst line:
reset_config srst_only srst_push_pull
Now, connect your microcontroller. Have a look at the pinout of your Raspberry Pi: https://en.wikipedia.org/wiki/Raspberry_Pi#Model_B
Connect swclk, swdio, srst and Gnd accordingly. For instance, swclk is mapped to GPIO 11, which is wired to pin 23 on the Raspberry Model B.
Run OpenOCD (needs superuser access) with your config file:
openocd -f "~/openocd.cfg"
Connect a telnet client:
telnet localhost 4444
You can now play around with the flash tools of the manual: http://openocd.org/doc/html/Flash-Commands.html
The erase parameter of
flash write_image seems not to work for large blocks of data. Use
at91samd chip-erase before flashing, instead.
Flash your code, then:
flash write_image image.bin 0x0000 bin
flash verify_bank 0 image.bin 0x0000