From f1df22890212b52ddf7d23ace3a50120599a8dfe Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Fri, 9 Aug 2024 14:33:11 +0100 Subject: [PATCH] Add bash script tools/test8 for release v8.0 testing --- src/avrdude.conf.in | 4 +-- tools/test8 | 79 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 2 deletions(-) create mode 100755 tools/test8 diff --git a/src/avrdude.conf.in b/src/avrdude.conf.in index 960d0ed6..0332d15b 100644 --- a/src/avrdude.conf.in +++ b/src/avrdude.conf.in @@ -2983,7 +2983,7 @@ programmer # powerdebugger_tpi # 4 TDO DATA UPDI SDI # 5 TCK SCK # 6 RST SCK dW RST -# 7 TDI SDI TX (target) +# 7 TDI SDO TX (target) # 8 TMS RX (target) # # * The PICkit4 can also be used as a USB to UART @@ -3094,7 +3094,7 @@ programmer # pickit4_tpi # 4 TDO DATA UPDI SDI # 5 TCK SCK # 6 RST SCK dW RST -# 7 TDI SDI TX (target) +# 7 TDI SDO TX (target) # 8 TMS RX (target) # # * The MPLAB SNAP can also be used as a USB to UART diff --git a/tools/test8 b/tools/test8 new file mode 100755 index 00000000..5725ae36 --- /dev/null +++ b/tools/test8 @@ -0,0 +1,79 @@ +#!/usr/bin/env bash + +# Published under GNU General Public License, version 3 (GPL-3.0) +# Author Stefan Rueger, 2024 + +progname=$(basename "$0") +init=-1 +rand=-1 + +Usage() { +cat <] +Function: test AVRDUDE for v 8.0 release with -c programmer -p part; + also leaves a file bak-- use avrdude -c dryrun -xinit= to initialiase part and exit + -r use avrdude -c dryrun -xrandom= to initialiase part and exit + +Examples: + - Prepare a part with non-trivial random content + $ test8 -r1 usbasp t13a + + - Then test ... + $ test8 avrisp2 t13a + $ test8 snap_isp t13a +END +} + +while getopts ":i:r:" opt; do + case ${opt} in + i) init=0; [[ ! -z "$OPTARG" ]] && init="$OPTARG" + ;; + r) rand=0; [[ ! -z "$OPTARG" ]] && rand="$OPTARG" + ;; + --) shift; + break + ;; + \?) echo "$progname: invalid option -$OPTARG" 1>&2 + Usage; exit 1 + ;; + : ) echo "$progname: invalid option -$OPTARG requires an argument" 1>&2 + Usage; exit 1 + ;; + esac +done +shift $((OPTIND -1)) + + +if [ $# -ne 2 ]; then + why=missing; [ $# -gt 2 ] && why="too many" + echo $progname: $why arguments + Usage + exit 1 +fi + +###### +# Generated backup file + +f="bak-$1-$2.hex:I" + +###### +# Initialise and exit if requested by -i or -r + +if [[ $init -gt -1 || $rand -gt -1 ]]; then + how="init=$init"; [ $rand -gt -1 ] && how="random=$rand" + avrdude -qqc dryrun -p $2 -U ALL:r:$f -x $how + avrdude -c $1 -p $2 -U ALL:w:$f + echo $progname: $2 initialsed + exit 0 +fi + +###### +# Actual test + +if ! avrdude -c $1 -p $2 -D -UALL:r:$f -T "fact reset" -UALL:w:$f -UALL:v:$f; then + echo ------------------------------- + echo Re-running to create error logs + avrdude -vvv -c $1 -p $2 -D -UALL:r:$f -T "fact reset" -UALL:w:$f -UALL:v:$f -llog-$1-$2.txt +fi