Add -f to test8 erasing flash/eeprom in lieu of factory reset

This commit is contained in:
Stefan Rueger
2026-06-22 14:22:16 +01:00
parent 3636d2d4f6
commit a3e34a0d3c

View File

@@ -19,6 +19,7 @@ Options:
-i <n> Write human-readable contents seeded by <n> to part and exit
-r <n> Write random contents seeded by <n> to part and exit
-e <exe> Path of the avrdude executable
-f Emulate factory reset by erasing eeprom and flash only
-a <opt> Pass option <opt> to avrdude; no space in <opt>, eg, -Pch340
-m <mlist> Use memory list <mlist> instead of ALL
@@ -32,7 +33,8 @@ Examples:
END
}
while getopts ":i:r:a:e:m:" opt; do
reset="factory reset"
while getopts ":i:r:a:e:m:f" opt; do
case ${opt} in
i) init=0; [[ ! -z "$OPTARG" ]] && init="$OPTARG"
;;
@@ -42,6 +44,8 @@ while getopts ":i:r:a:e:m:" opt; do
;;
e) avrdude_bin="$OPTARG"
;;
f) reset="erase flash; erase eeprom; flush"
;;
m) if [[ ! -z "$OPTARG" ]]; then mem="$OPTARG"; fi
;;
--) shift;
@@ -84,7 +88,7 @@ fi
######
# Actual test
if ! $avrdude_bin "${adopts[@]}" -c $1 -p $2 -D -U$mem:r:$f -T "fact reset" -U$mem:w:$f; then
if ! $avrdude_bin "${adopts[@]}" -c $1 -p $2 -D -U$mem:r:$f -T "$reset" -U$mem:w:$f; then
echo -------------------------------
echo Re-running to create error logs
$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