From 8171494cceaea7b0754fe7bddef4c83e7547c1ca Mon Sep 17 00:00:00 2001 From: Tangent 128 Date: Sat, 26 Oct 2019 22:46:01 -0400 Subject: [PATCH] save script to automate flashing commands --- hello_gradient/flash.sh | 20 ++++++++++++++++++++ hello_gradient/mnt/.gitignore | 0 2 files changed, 20 insertions(+) create mode 100755 hello_gradient/flash.sh create mode 100644 hello_gradient/mnt/.gitignore diff --git a/hello_gradient/flash.sh b/hello_gradient/flash.sh new file mode 100755 index 0000000..8ef07d1 --- /dev/null +++ b/hello_gradient/flash.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +set -e + +APPLET=$1 +TARGET_BIN="target/thumbv6m-none-eabi/release/$APPLET" +test -e "$TARGET_BIN" || { + echo "'$APPLET' does not exist" + exit 1 +} + +arm-none-eabi-objcopy -O binary "$TARGET_BIN" flash.bin +uf2conv-rs flash.bin -o flash.uf2 + +sudo mount LABEL=ITSYBOOT mnt/ +echo "Flashing..." +sudo cp flash.uf2 mnt/flash.uf2 +sync +echo "Done." +sudo umount mnt/ diff --git a/hello_gradient/mnt/.gitignore b/hello_gradient/mnt/.gitignore new file mode 100644 index 0000000..e69de29