Add options -a and -m to test8

This commit is contained in:
Stefan Rueger
2024-08-09 20:24:53 +01:00
parent c833d9fae0
commit 526ffe1814

View File

@@ -4,6 +4,8 @@
# Author Stefan Rueger, 2024
progname=$(basename "$0")
adopts=()
mem=ALL
init=-1
rand=-1
@@ -13,8 +15,10 @@ 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
-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
-a <opt> pass avrdude option <opt> through to avrdude test commands
-m <mlist> use memory list <mlist> instead of ALL
Examples:
- Prepare a part with non-trivial random content
@@ -26,12 +30,16 @@ Examples:
END
}
while getopts ":i:r:" opt; do
while getopts ":i:r:a:m:" opt; do
case ${opt} in
i) init=0; [[ ! -z "$OPTARG" ]] && init="$OPTARG"
;;
r) rand=0; [[ ! -z "$OPTARG" ]] && rand="$OPTARG"
;;
a) if [[ ! -z "$OPTARG" ]]; then adopts+=("$OPTARG"); fi
;;
m) if [[ ! -z "$OPTARG" ]]; then mem="$OPTARG"; fi
;;
--) shift;
break
;;
@@ -63,8 +71,8 @@ f="bak-$1-$2.hex:I"
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
avrdude -qqc dryrun -p $2 -U $mem:r:$f -x $how
avrdude -c $1 -p $2 -U $mem:w:$f
echo $progname: $2 initialsed
exit 0
fi
@@ -72,8 +80,8 @@ fi
######
# Actual test
if ! avrdude -c $1 -p $2 -D -UALL:r:$f -T "fact reset" -UALL:w:$f -UALL:v:$f; then
if ! avrdude "${adopts[@]}" -c $1 -p $2 -D -U$mem:r:$f -T "fact reset" -U$mem:w:$f -U$mem: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
avrdude "${adopts[@]}" -vvv -c $1 -p $2 -D -U$mem:r:$f -T "fact reset" -U$mem:w:$f -U$mem:v:$f -llog-$1-$2.txt
fi