From 486dd5543653b342fe64c0e5b1fcd342f0a02dbb Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Sun, 19 Nov 2023 01:53:59 -0700 Subject: added *unfinished* support for avr32dd20, plus a build target for a dev kit ADC doesn't work yet. No voltage, no temperature. I need to do a lot of refactoring on the ADC code. :( --- bin/flash-avr32dd20.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 bin/flash-avr32dd20.sh (limited to 'bin/flash-avr32dd20.sh') diff --git a/bin/flash-avr32dd20.sh b/bin/flash-avr32dd20.sh new file mode 100755 index 0000000..ef8b0f3 --- /dev/null +++ b/bin/flash-avr32dd20.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +set -e + +[[ -z "$1" ]] && echo "No .hex file specified." && exit 1 +HEX="$1" + +#pymcuprog ping -t uart -u /dev/ttyUSB2 -d avr32dd20 +#pymcuprog erase -t uart -u /dev/ttyUSB2 -d avr32dd20 +#pymcuprog write verify -t uart -u /dev/ttyUSB2 -d avr32dd20 -f "$HEX" +#pymcuprog verify -t uart -u /dev/ttyUSB2 -d avr32dd20 -f "$HEX" + +pymcuprog write --erase --verify --timing -t uart -u /dev/ttyUSB2 -d avr32dd20 -f "$HEX" -- cgit v1.2.3 From fdac6fcf22cd658785480c88c28243eeae62bcd0 Mon Sep 17 00:00:00 2001 From: Selene ToyKeeper Date: Thu, 30 Nov 2023 09:16:13 -0700 Subject: made the avr32dd20 flashing script more universal --- bin/flash-avr32dd20.sh | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) (limited to 'bin/flash-avr32dd20.sh') diff --git a/bin/flash-avr32dd20.sh b/bin/flash-avr32dd20.sh index ef8b0f3..dcd4967 100755 --- a/bin/flash-avr32dd20.sh +++ b/bin/flash-avr32dd20.sh @@ -1,13 +1,40 @@ #!/usr/bin/env bash +# AVR firmware flashing script, a wrapper for other tools +# Copyright (C) 2023 Selene ToyKeeper +# SPDX-License-Identifier: GPL-3.0-or-later + +# Usage: flash-MCUTYPE.sh hex/foo.hex +# (where the script name specifies the type of MCU chip, +# and the first parameter is the path to a .hex file) +# Example: +# ./bin/flash-avr32dd20.sh hex/anduril.thefreeman-avr32dd20-devkit.hex set -e +# Get the path to a .hex file [[ -z "$1" ]] && echo "No .hex file specified." && exit 1 HEX="$1" -#pymcuprog ping -t uart -u /dev/ttyUSB2 -d avr32dd20 -#pymcuprog erase -t uart -u /dev/ttyUSB2 -d avr32dd20 -#pymcuprog write verify -t uart -u /dev/ttyUSB2 -d avr32dd20 -f "$HEX" -#pymcuprog verify -t uart -u /dev/ttyUSB2 -d avr32dd20 -f "$HEX" +# assume the highest-numbered USB serial device is the correct one, +# since it was probably the most recently plugged in +TTYUSB=$(ls -1 /dev/tty* | grep -i usb | tail -1) + +# figure out the MCU type... +# TODO: find the relevant hw/*/arch file and use that to get MCU type +# use $2 if it exists, and use the name of this script maybe +MCUTYPE="unset" +[[ -n "$2" ]] && MCUTYPE="$2" +#MCUTYPE=$(echo "$0" | sed 's/.*flash-\(.*\).sh.*/\1/') +[[ "$0" =~ flash-(.*).sh ]] && MCUTYPE="${BASH_REMATCH[1]}" + +# Do the actual flashing +echo "Flashing $MCUTYPE MCU on port $TTYUSB: $HEX" +echo pymcuprog write \ + --erase \ + --verify \ + --timing \ + -t uart \ + -u "$TTYUSB" \ + -d "$MCUTYPE" \ + -f "$HEX" -pymcuprog write --erase --verify --timing -t uart -u /dev/ttyUSB2 -d avr32dd20 -f "$HEX" -- cgit v1.2.3