#!/bin/sh
case "$#" in
1)
    ;;
*)
    echo "usage: $0 <filename> ..."
    exit 1
    ;;
esac
openocd -f interface/stlink.cfg \
        -c 'transport select hla_swd' \
	-c 'set CHIPNAME at91samd21g18' \
	-c 'set CPUTAPID 0x0bc11477' \
	-f target/at91samdXX.cfg \
	-c init \
	-c 'reset halt' \
	-c 'at91samd bootloader 0' \
	-c "program $1 verify reset" \
	-c "shutdown"
