Add bash script tools/test8 for release v8.0 testing

This commit is contained in:
Stefan Rueger
2024-08-09 14:33:11 +01:00
parent 28ebfa0a4b
commit f1df228902
2 changed files with 81 additions and 2 deletions

View File

@@ -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

79
tools/test8 Executable file
View File

@@ -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 <<END
Syntax: $progname [<opts>] <programmer> <part>
Function: test AVRDUDE for v 8.0 release with -c programmer -p part;
also leaves a file bak-<programmer>-<part.hex for inspection
Options:
-i <n> use avrdude -c dryrun -xinit=<n> to initialiase part and exit
-r <n> use avrdude -c dryrun -xrandom=<n> 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<n> or -r<n>
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