From a3e34a0d3ce302c257780701d7d878e5ec35ab92 Mon Sep 17 00:00:00 2001 From: Stefan Rueger Date: Mon, 22 Jun 2026 14:22:16 +0100 Subject: [PATCH] Add -f to test8 erasing flash/eeprom in lieu of factory reset --- tools/test8 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/test8 b/tools/test8 index b8116c2c..e29a6fec 100755 --- a/tools/test8 +++ b/tools/test8 @@ -19,6 +19,7 @@ Options: -i Write human-readable contents seeded by to part and exit -r Write random contents seeded by to part and exit -e Path of the avrdude executable + -f Emulate factory reset by erasing eeprom and flash only -a Pass option to avrdude; no space in , eg, -Pch340 -m Use memory list 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