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