% ssh pi@raspberrypi.local
@ WARNING: POSSIBLE DNS SPOOFING DETECTED! @
% ssh-keygen -R raspberrypi.local
The authenticity of host 'raspberrypi.local (fe80::faab:348c:edcd:446f%en0)' can't be established.
ECDSA key fingerprint is SHA256:Dxs24lNBk9lAubin3bRb9H4FMjG5NFNVr6mNUVaCcbw.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
$ sudo apt-get update
$ sudo apt-get install git autoconf libtool make pkg-config libusb-1.0-0 libusb-1.0-0-dev
$ git clone http://openocd.zylin.com/openocd
$ ls
openocd
$ cd openocd
$ ls
bootstrap
$ ./bootstrap
$ ./configure --enable-sysfsgpio --enable-bcm2835gpio
$ ls
makefile
$ make
$ sudo make install
$ cd /usr/local/share/openocd/scripts/interface
$ ls
raspberrypi2-native.cfg
$ cat /usr/local/share/openocd/scripts/interface/raspberrypi2-native.cfg
#
# Config for using Raspberry Pi's expansion header
#
# This is best used with a fast enough buffer but also
# is suitable for direct connection if the target voltage
# matches RPi's 3.3V and the cable is short enough.
#
# Do not forget the GND connection, pin 6 of the expansion header.
#
adapter driver bcm2835gpio
bcm2835gpio peripheral_base 0x3F000000
# Transition delay calculation: SPEED_COEFF/khz - SPEED_OFFSET
# These depend on system clock, calibrated for stock 700MHz
# bcm2835gpio speed SPEED_COEFF SPEED_OFFSET
bcm2835gpio speed_coeffs 146203 36
# Each of the JTAG lines need a gpio number set: tck tms tdi tdo
# Header pin numbers: 23 22 19 21
bcm2835gpio jtag_nums 11 25 10 9
# Each of the SWD lines need a gpio number set: swclk swdio
# Header pin numbers: 23 22
bcm2835gpio swd_nums 11 25
# If you define trst or srst, use appropriate reset_config
# Header pin numbers: TRST - 26, SRST - 18
# bcm2835gpio trst_num 7
# reset_config trst_only
# bcm2835gpio srst_num 24
# reset_config srst_only srst_push_pull
# or if you have both connected,
# reset_config trst_and_srst srst_push_pull
Note
As default in raspberrypi2-native.cfg ,
SWD CLK is GPIO_11
SWD DIO is GPIO_25
SWD RST does not set
$ cd ~
$ cd atsamd11/bootloader/
$ ls
openocd.cfg
sam_ba_Generic_D11C14A_SAMD11C14A.bin
unprotect_bootloader.cfg
$ sudo openocd
Open On-Chip Debugger 0.11.0+dev-00502-gf66a16c4a (2021-11-28-15:06)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : BCM2835 GPIO JTAG/SWD bitbang driver
Info : clock speed 200 kHz
Info : SWD DPIDR 0x0bc11477
Info : at91samd11c14a.cpu: Cortex-M0+ r0p1 processor detected
Info : at91samd11c14a.cpu: target has 4 breakpoints, 2 watchpoints
Info : starting gdb server for at91samd11c14a.cpu on 3333
Info : Listening on port 3333 for gdb connections
target halted due to debug-request, current mode: Thread
xPSR: 0x81000000 pc: 0xfffffffe msp: 0xfffffffc
target halted due to debug-request, current mode: Thread
xPSR: 0x81000000 pc: 0xfffffffe msp: 0xfffffffc
** Programming Started **
Info : SAMD MCU: SAMD11C14A (16KB Flash, 4KB RAM)
** Programming Finished **
** Verify Started **
** Verified OK **
shutdown command invoked
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Ctl+C
12
$ lsusb
Bus 001 Device 006: ID 16d0:0557 MCS Generic SAMD11C14A
source [find interface/raspberrypi2-native.cfg]
transport select swd
set CHIPNAME at91samd11c14a
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 speed 200
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
reset init
at91samd bootloader 0
#program sam_ba_Generic_D11C14A_SAMD11C14A.bin verify
#at91samd bootloader 4096
reset
shutdown
1 2 3 4 5 6 7 8 9101112131415161718
$ sudo openocd -f unprotect_bootloader.cfg
Open On-Chip Debugger 0.11.0+dev-00502-gf66a16c4a (2021-11-28-15:06)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : BCM2835 GPIO JTAG/SWD bitbang driver
Info : clock speed 200 kHz
Info : SWD DPIDR 0x0bc11477
Info : at91samd11c14a.cpu: Cortex-M0+ r0p1 processor detected
Info : at91samd11c14a.cpu: target has 4 breakpoints, 2 watchpoints
Info : starting gdb server for at91samd11c14a.cpu on 3333
Info : Listening on port 3333 for gdb connections
target halted due to debug-request, current mode: Thread
xPSR: 0x21000000 pc: 0xfffffffe msp: 0xfffffffc
Error: at91samd11c14a.cpu -- clearing lockup after double fault
target halted due to debug-request, current mode: Handler HardFault
xPSR: 0x21000003 pc: 0xfffffffe msp: 0xffffffd8
shutdown command invoked
% cd Downloads
% unzip SAMD11C_serial-main.zip
% ls
SAMD11C_serial-main.zip
SAMD11C_serial-main
% cd SAMD11C_serial-main
% ls
SAMD11C_serial
SAMD21E_serial
% cd SAMD11C_serial
% ls
SAMD11C_serial.ino
% open .