Add -e exe option to test8

This commit is contained in:
Stefan Rueger
2024-08-22 17:43:37 +01:00
parent a9594622e2
commit b389e8b89f

View File

@@ -8,6 +8,7 @@ adopts=()
mem=ALL
init=-1
rand=-1
avrdude_bin=avrdude
Usage() {
cat <<END
@@ -17,6 +18,7 @@ Function: test AVRDUDE for v 8.0 release with -c programmer -p part;
Options:
-i <n> use avrdude -c dryrun -xinit=<n> to initialise part and exit
-r <n> use avrdude -c dryrun -xrandom=<n> to initialise part and exit
-e <exe> path of the avrdude executable
-a <opt> pass avrdude option <opt> through to avrdude test commands
-m <mlist> use memory list <mlist> instead of ALL
@@ -30,7 +32,7 @@ Examples:
END
}
while getopts ":i:r:a:m:" opt; do
while getopts ":i:r:a:e:m:" opt; do
case ${opt} in
i) init=0; [[ ! -z "$OPTARG" ]] && init="$OPTARG"
;;
@@ -38,6 +40,8 @@ while getopts ":i:r:a:m:" opt; do
;;
a) if [[ ! -z "$OPTARG" ]]; then adopts+=("$OPTARG"); fi
;;
e) avrdude_bin="$OPTARG"
;;
m) if [[ ! -z "$OPTARG" ]]; then mem="$OPTARG"; fi
;;
--) shift;
@@ -71,8 +75,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 $mem:r:$f -x $how
avrdude "${adopts[@]}" -c $1 -p $2 -U $mem:w:$f
$avrdude_bin -qqc dryrun -p $2 -U $mem:r:$f -x $how
$avrdude_bin "${adopts[@]}" -c $1 -p $2 -U $mem:w:$f
echo $progname: $2 initialised
exit 0
fi
@@ -80,8 +84,8 @@ fi
######
# Actual test
if ! avrdude "${adopts[@]}" -c $1 -p $2 -D -U$mem:r:$f -T "fact reset" -U$mem:w:$f -U$mem:v:$f; then
if ! $avrdude_bin "${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 "${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
$avrdude_bin "${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