From 274ac34b6cea3b557325598bc3892cb2ab1c00ee Mon Sep 17 00:00:00 2001 From: stefanrueger Date: Mon, 26 Feb 2024 23:07:58 +1300 Subject: [PATCH 01/12] Add benchmark option -b to test-avrdude MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This executes five tests for typical programming tasks: - Write/verify a "difficult" sketch to flash: two code sections and one data section separated by "holes" of different sizes - Dump all flash, eg, to make a backup - Write/verify a "difficult" eeprom data file with holes - Dump all eeprom, eg, to make a backup - Chip erase (bootloaders are expected to page erase flash apart from the bootloader itself) and spot check whether flash was erased The reported times are realistic times with overhead of starting avrdude, resetting the board via DTR/RTS, establishing comms, including erasing the flash before writing/verifying the sketch and disengaging the chip. $ test-avrdude -b -d 0 \ -p "u7.7/weu-jPrac -c urclock -P ch340 -p m328p -b 1000000" \ -p "u7.7/-eu-jPrac -c urclock -P ch340 -p m328p -b 1000000" Testing avrdude version 7.3-20240225 (20788712) Prepare "u7.7/weu-jPrac -c urclock -P ch340 -p m328p -b 1000000" and press 'enter' or 'space' to continue. Press any other key to skip ✅ 2.174 s: flash -U write/verify holes_rjmp_loops_32768B.hex ✅ 1.339 s: flash -U read all flash ✅ 1.415 s: eeprom -U write/verify holes_pack_my_box_1024B.hex ✅ 1.034 s: eeprom -U read all ✅ 1.604 s: chip erase and spot check flash is actually erased ✅ 7.566 s: benchmark for u7.7/weu-jPrac -c urclock -P ch340 -p m328p -b 1000000 Prepare "u7.7/-eu-jPrac -c urclock -P ch340 -p m328p -b 1000000" and press 'enter' or 'space' to continue. Press any other key to skip ✅ 2.001 s: flash -U write/verify holes_rjmp_loops_32768B.hex ✅ 1.333 s: flash -U read all flash ✅ 1.405 s: eeprom -U write/verify holes_pack_my_box_1024B.hex ✅ 1.029 s: eeprom -U read all ✅ 1.618 s: chip erase and spot check flash is actually erased ✅ 7.386 s: benchmark for u7.7/-eu-jPrac -c urclock -P ch340 -p m328p -b 1000000 Note the benchmark line with the cumulative time for all five tasks --- tools/test-avrdude | 123 ++++++++++++++++++++++++++++++--------------- 1 file changed, 83 insertions(+), 40 deletions(-) diff --git a/tools/test-avrdude b/tools/test-avrdude index 5a696e56..7ecabe8c 100755 --- a/tools/test-avrdude +++ b/tools/test-avrdude @@ -7,6 +7,7 @@ progname=$(basename "$0") tfiles=$(dirname "$0")/test_files tfiles=$(printf "%q" "$tfiles") # Quote directory string in case there are spaces etc +benchmark=0 # If set to 1 does benchmark testing only avrdude_conf='' # Configuration for every run, eg, '-C path_to_avrdude_conf' delay=0.75 # Some programmers need a delay between AVRDUDE calls avrdude_bin=avrdude # Executable @@ -22,6 +23,7 @@ cat <} Function: test AVRDUDE for certain programmer and part combinations Options: + -b benchmark testing only and summarise overall time -c additional configuration options used for all runs -d delay between test commands (default $delay seconds) -e set path of AVRDUDE executable (default $avrdude_bin) @@ -39,8 +41,10 @@ Examples: END } -while getopts ":\?hc:d:e:lp:st:Tv" opt; do +while getopts ":\?hbc:d:e:lp:st:Tv" opt; do case ${opt} in + b) benchmark=1 + ;; c) avrdude_conf="$OPTARG" ;; d) delay="$OPTARG" @@ -158,6 +162,7 @@ trap "rm -f $status $logfile $outfile $tmpfile $resfile" EXIT TIMEFORMAT=%R # time built-in only returns elapsed wall-clock time elapsed=-1 # Global variable holding time of last execute command in seconds +bench_t=-1 # Copy of global variable holding time of last execute command command=(sleep 0.1) # Array with AVRDUDE command emulated=0 # Is programmer dryrun or dryboot, ie, programming is emulated? @@ -185,6 +190,7 @@ result () { echo ❌ "$(printf '%7.3f s' $elapsed): $specify (failed command below)" echo "\$ ${command[@]}" | sed "s/ -l [^ ]* / /" | tr -s " " FAIL=true + bench_char="❌" exitstate=1 [[ $emulated -eq 0 ]] && sleep 4 # Let the hw settle down before next test fi @@ -192,6 +198,7 @@ result () { else cat $outfile fi + bench_t=$elapsed cp /dev/null $outfile; cp /dev/null $logfile; elapsed=-999; specify="unknown"; command=(sleep 0.1) return $ret } @@ -222,6 +229,7 @@ for (( p=0; p<$arraylength; p++ )); do read -n1 -s -r -p $'' key [[ $emulated -eq 0 ]] && sleep 0.15 # Debounce key when not using dryrun/dryboot fi + bench_char="✅"; bench_t_flwr=0; bench_t_flrd=0; bench_t_eewr=0; bench_t_eerd=0; bench_t_ce=0 if [ "$key" == '' ]; then FAIL=false @@ -229,7 +237,9 @@ for (( p=0; p<$arraylength; p++ )); do # Get flash and EEPROM size in bytes and make sure the numbers are in dec form FLASH_SIZE=$(${avrdude[@]} -cdryrun -T 'part -m' 2>/dev/null | grep flash | awk '{print $2}') + bench_flwr_size=$((FLASH_SIZE/6)) # Approximate(!) size of file holes_rjmp_loops_${FLASH_SIZE}B.hex EE_SIZE=$(${avrdude[@]} -cdryrun -T 'part -m' 2>/dev/null | grep eeprom | awk '{print $2}') + bench_eewr_size=$((EEPROM_SIZE/6)) # Approximate(!) size of file holes_pack_my_box_${EE_SIZE}B.hex if [[ -z "$FLASH_SIZE" ]]; then echo "Cannot detect flash; check that \"${pgm_and_target[$p]}\" are valid avrdude options; skipping this test" @@ -257,7 +267,7 @@ for (( p=0; p<$arraylength; p++ )); do ##### # Dryrun tests for high-level progrmmer-independent tests (only for -m2560 or similar) # - if [[ "$programmer" == -cdryrun && $FLASH_SIZE -eq 262144 ]]; then + if [[ "$programmer" == -cdryrun && $FLASH_SIZE -eq 262144 && $benchmark -eq 0 ]]; then # Raw test specify="flash raw format -T/-U write/verify cola-vending-machine.raw" command=(${avrdude[@]} @@ -314,7 +324,7 @@ for (( p=0; p<$arraylength; p++ )); do ##### # Fuse test (bootloaders usually cannot set fuses) # - if [[ $is_bootloader -ne 1 && $fusetest -eq 1 ]]; then + if [[ $is_bootloader -ne 1 && $fusetest -eq 1 && $benchmark -eq 0 ]]; then if [ -n "$EE_SIZE" ]; then specify="fuse access: clear, set and read eesave fuse bit" command=(${avrdude[@]} -T '"config eesave=0; config eesave=1; config eesave"') @@ -341,10 +351,12 @@ for (( p=0; p<$arraylength; p++ )); do ###### # Chip erase for defined initial state # - specify="chip erase" - command=(${avrdude[@]} -e) - execute "${command[@]}" - result [ $? == 0 ] + if [ $benchmark -eq 0 ]; then + specify="chip erase" + command=(${avrdude[@]} -e) + execute "${command[@]}" + result [ $? == 0 ] + fi ##### # Flash test: a relatively difficult file with two code blocks and one data block with holes @@ -353,61 +365,86 @@ for (( p=0; p<$arraylength; p++ )); do command=(${avrdude[@]} -Uflash:w:$tfiles/holes_rjmp_loops_${FLASH_SIZE}B.hex) execute "${command[@]}" result [ $? == 0 ] - if [ $? != 0 ]; then # Not working? try a file without holes + if [[ $? != 0 && $benchmark -eq 0 ]]; then # Not working? try a file without holes specify="flash -U write/verify rjmp_loops_for_bootloaders_${FLASH_SIZE}B.hex" command=(${avrdude[@]} -Uflash:w:$tfiles/rjmp_loops_for_bootloaders_${FLASH_SIZE}B.hex) execute "${command[@]}" result [ $? == 0 ] fi + bench_t_flwr=$bench_t - specify="flash -T write/verify holes_rjmp_loops_${FLASH_SIZE}B.hex" - command=(${avrdude[@]} -T '"write flash '$tfiles/holes_rjmp_loops_${FLASH_SIZE}B.hex:a'"') - execute "${command[@]}" > $outfile - result [[ ! -s $outfile '&&' ! -s $logfile ]] - if [ $? != 0 ]; then # Not working? try a file without holes - specify="flash -T write/verify rjmp_loops_for_bootloaders_${FLASH_SIZE}B.hex" - command=(${avrdude[@]} -T '"write flash '$tfiles/rjmp_loops_for_bootloaders_${FLASH_SIZE}B.hex:a'"') + if [[ $benchmark -eq 1 ]]; then + specify="flash -U read all flash" + command=(${avrdude[@]} -Uflash:r:/dev/null) + execute "${command[@]}" + result [ $? == 0 ] + bench_t_flrd=$bench_t + fi + + if [[ $benchmark -eq 0 ]]; then + specify="flash -T write/verify holes_rjmp_loops_${FLASH_SIZE}B.hex" + command=(${avrdude[@]} -T '"write flash '$tfiles/holes_rjmp_loops_${FLASH_SIZE}B.hex:a'"') execute "${command[@]}" > $outfile result [[ ! -s $outfile '&&' ! -s $logfile ]] + if [ $? != 0 ]; then # Not working? try a file without holes + specify="flash -T write/verify rjmp_loops_for_bootloaders_${FLASH_SIZE}B.hex" + command=(${avrdude[@]} -T '"write flash '$tfiles/rjmp_loops_for_bootloaders_${FLASH_SIZE}B.hex:a'"') + execute "${command[@]}" > $outfile + result [[ ! -s $outfile '&&' ! -s $logfile ]] + fi fi ###### # EEPROM tests # if [ $check_eeprom -eq 1 ]; then - # -U cannot cope with EEPROMs that are unable to set cleared bits but - # the terminal can if the eesave fuse makes chip erase erase EEPROM - specify="eeprom check whether programmer can flip 0s to 1s" - command=(${avrdude[@]} -Ueeprom:w:0x55:m -Ueeprom:w:0xaa:m) - execute "${command[@]}" - result [ $? == 0 ] - if [ $? == 0 ]; then # OK, try a file with holes + if [ $benchmark -eq 1 ]; then specify="eeprom -U write/verify holes_pack_my_box_${EE_SIZE}B.hex" command=(${avrdude[@]} -Ueeprom:w:$tfiles/holes_pack_my_box_${EE_SIZE}B.hex) execute "${command[@]}" result [ $? == 0 ] - if [ $? != 0 ]; then # Not working? try a file without holes - specify="eeprom -U write/verify the_quick_brown_fox_${EE_SIZE}B.hex" - command=(${avrdude[@]} -Ueeprom:w:$tfiles/the_quick_brown_fox_${EE_SIZE}B.hex) + bench_t_eewr=$bench_t + + specify="eeprom -U read all" + command=(${avrdude[@]} -Ueeprom:r:/dev/null) + execute "${command[@]}" + result [ $? == 0 ] + bench_t_eerd=$bench_t + else + # -U cannot cope with EEPROMs that are unable to set cleared bits but + # the terminal can if the eesave fuse makes chip erase erase EEPROM + specify="eeprom check whether programmer can flip 0s to 1s" + command=(${avrdude[@]} -Ueeprom:w:0x55:m -Ueeprom:w:0xaa:m) + execute "${command[@]}" + result [ $? == 0 ] + if [ $? == 0 ]; then # OK, try a file with holes + specify="eeprom -U write/verify holes_pack_my_box_${EE_SIZE}B.hex" + command=(${avrdude[@]} -Ueeprom:w:$tfiles/holes_pack_my_box_${EE_SIZE}B.hex) execute "${command[@]}" result [ $? == 0 ] + if [ $? != 0 ]; then # Not working? try a file without holes + specify="eeprom -U write/verify the_quick_brown_fox_${EE_SIZE}B.hex" + command=(${avrdude[@]} -Ueeprom:w:$tfiles/the_quick_brown_fox_${EE_SIZE}B.hex) + execute "${command[@]}" + result [ $? == 0 ] + fi + else + echo "# ... the next test may therefore take longer" fi - else - echo "# ... the next test may therefore take longer" - fi - specify="eeprom -T write/verify holes_{the_five_boxing_wizards,pack_my_box}_${EE_SIZE}B.hex" - command=(${avrdude[@]} - -T '"write eeprom '$tfiles/holes_the_five_boxing_wizards_${EE_SIZE}B.hex:a'"' - -T flush - -T '"write eeprom '$tfiles/holes_pack_my_box_${EE_SIZE}B.hex:a'"') - execute "${command[@]}" > $outfile - result [[ ! -s $outfile '&&' ! -s $logfile ]] - if [ $? != 0 ]; then # Not working? try a file without holes - specify="eeprom -T write/verify lorem_ipsum_${EE_SIZE}B.srec" - command=(${avrdude[@]} -T '"write eeprom '$tfiles/lorem_ipsum_${EE_SIZE}B.srec:a'"') + specify="eeprom -T write/verify holes_{the_five_boxing_wizards,pack_my_box}_${EE_SIZE}B.hex" + command=(${avrdude[@]} + -T '"write eeprom '$tfiles/holes_the_five_boxing_wizards_${EE_SIZE}B.hex:a'"' + -T flush + -T '"write eeprom '$tfiles/holes_pack_my_box_${EE_SIZE}B.hex:a'"') execute "${command[@]}" > $outfile result [[ ! -s $outfile '&&' ! -s $logfile ]] + if [ $? != 0 ]; then # Not working? try a file without holes + specify="eeprom -T write/verify lorem_ipsum_${EE_SIZE}B.srec" + command=(${avrdude[@]} -T '"write eeprom '$tfiles/lorem_ipsum_${EE_SIZE}B.srec:a'"') + execute "${command[@]}" > $outfile + result [[ ! -s $outfile '&&' ! -s $logfile ]] + fi fi fi @@ -418,17 +455,18 @@ for (( p=0; p<$arraylength; p++ )); do command=(${avrdude[@]} -e -Uflash:v:$tfiles/holes_flash_0xff_${FLASH_SIZE}B.hex) execute "${command[@]}" result [ $? == 0 ] - if [[ $? == 0 && $check_eeprom -eq 1 && $is_bootloader -eq 0 ]]; then + if [[ $? == 0 && $check_eeprom -eq 1 && $is_bootloader -eq 0 && $benchmark -eq 0 ]]; then specify="spot check eeprom is erased, too" command=(${avrdude[@]} -Ueeprom:v:$tfiles/holes_eeprom_0xff_${EE_SIZE}B.hex) execute "${command[@]}" result [ $? == 0 ] fi + bench_t_ce=$bench_t ###### # Write and verify random data to usersig if present # - if [[ -n "$USERSIG_SIZE" && $is_bootloader -ne 1 ]]; then + if [[ -n "$USERSIG_SIZE" && $is_bootloader -ne 1 && $benchmark -eq 0 ]]; then specify="usersig -T/-U write/read random_data_${USERSIG_SIZE}B.bin" command=(${avrdude[@]} -T '"erase usersig; write usersig '$tfiles/random_data_${USERSIG_SIZE}B.bin'"' @@ -443,6 +481,11 @@ for (( p=0; p<$arraylength; p++ )); do cp /dev/null $tmpfile fi + if [ $benchmark -eq 1 ]; then + bench_sum=$(echo "$bench_t_flwr $bench_t_flrd $bench_t_eewr $bench_t_eerd $bench_t_ce" | awk '{print $1+$2+$3+$4+$5}') + echo $bench_char "$(printf '%7.3f s' $bench_sum): benchmark for ${pgm_and_target[$p]}" + fi + if [ $FAIL == true ]; then echo '' read -rep "One or more AVRDUDE \"${pgm_and_target[$p]}\" tests failed. Do you want to retry this particular test? (y/n): " choice From 6e6404cbb49173f30dc892c1a68e013914b94916 Mon Sep 17 00:00:00 2001 From: stefanrueger Date: Tue, 27 Feb 2024 11:54:40 +1300 Subject: [PATCH 02/12] Use alternative for /dev/null when not available --- tools/test-avrdude | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/test-avrdude b/tools/test-avrdude index 7ecabe8c..7064f6a6 100755 --- a/tools/test-avrdude +++ b/tools/test-avrdude @@ -160,6 +160,9 @@ tmpfile=$(mktemp "$tmp/$progname.tmp.XXXXXX") resfile=$(mktemp "$tmp/$progname.res.XXXXXX") trap "rm -f $status $logfile $outfile $tmpfile $resfile" EXIT +devnull=/dev/null +[[ ! -w /dev/null ]] && devnull=$tmpfile + TIMEFORMAT=%R # time built-in only returns elapsed wall-clock time elapsed=-1 # Global variable holding time of last execute command in seconds bench_t=-1 # Copy of global variable holding time of last execute command @@ -375,7 +378,7 @@ for (( p=0; p<$arraylength; p++ )); do if [[ $benchmark -eq 1 ]]; then specify="flash -U read all flash" - command=(${avrdude[@]} -Uflash:r:/dev/null) + command=(${avrdude[@]} -Uflash:r:$devnull) execute "${command[@]}" result [ $? == 0 ] bench_t_flrd=$bench_t @@ -406,7 +409,7 @@ for (( p=0; p<$arraylength; p++ )); do bench_t_eewr=$bench_t specify="eeprom -U read all" - command=(${avrdude[@]} -Ueeprom:r:/dev/null) + command=(${avrdude[@]} -Ueeprom:r:$devnull) execute "${command[@]}" result [ $? == 0 ] bench_t_eerd=$bench_t From 3b567687a73c1cbaae4171e647e1b5c4b165b66c Mon Sep 17 00:00:00 2001 From: stefanrueger Date: Tue, 27 Feb 2024 13:44:36 +1300 Subject: [PATCH 03/12] Lowercase variable names in test-avrdude Uppercase names are typically used for environment variables in bash --- tools/test-avrdude | 78 +++++++++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/tools/test-avrdude b/tools/test-avrdude index 7064f6a6..0c207887 100755 --- a/tools/test-avrdude +++ b/tools/test-avrdude @@ -192,7 +192,7 @@ result () { else echo ❌ "$(printf '%7.3f s' $elapsed): $specify (failed command below)" echo "\$ ${command[@]}" | sed "s/ -l [^ ]* / /" | tr -s " " - FAIL=true + fail=true bench_char="❌" exitstate=1 [[ $emulated -eq 0 ]] && sleep 4 # Let the hw settle down before next test @@ -235,22 +235,22 @@ for (( p=0; p<$arraylength; p++ )); do bench_char="✅"; bench_t_flwr=0; bench_t_flrd=0; bench_t_eewr=0; bench_t_eerd=0; bench_t_ce=0 if [ "$key" == '' ]; then - FAIL=false + fail=false avrdude=($avrdude_bin -l $logfile $avrdude_conf -qq ${pgm_and_target[$p]}) # Get flash and EEPROM size in bytes and make sure the numbers are in dec form - FLASH_SIZE=$(${avrdude[@]} -cdryrun -T 'part -m' 2>/dev/null | grep flash | awk '{print $2}') - bench_flwr_size=$((FLASH_SIZE/6)) # Approximate(!) size of file holes_rjmp_loops_${FLASH_SIZE}B.hex - EE_SIZE=$(${avrdude[@]} -cdryrun -T 'part -m' 2>/dev/null | grep eeprom | awk '{print $2}') - bench_eewr_size=$((EEPROM_SIZE/6)) # Approximate(!) size of file holes_pack_my_box_${EE_SIZE}B.hex + flash_size=$(${avrdude[@]} -cdryrun -T 'part -m' 2>/dev/null | grep flash | awk '{print $2}') + bench_flwr_size=$((flash_size/6)) # Approximate(!) size of file holes_rjmp_loops_${flash_size}B.hex + ee_size=$(${avrdude[@]} -cdryrun -T 'part -m' 2>/dev/null | grep eeprom | awk '{print $2}') + bench_eewr_size=$((ee_size/6)) # Approximate(!) size of file holes_pack_my_box_${ee_size}B.hex - if [[ -z "$FLASH_SIZE" ]]; then + if [[ -z "$flash_size" ]]; then echo "Cannot detect flash; check that \"${pgm_and_target[$p]}\" are valid avrdude options; skipping this test" continue fi # Memories that may or may not be present - USERSIG_SIZE=$(${avrdude[@]} -cdryrun -T 'part -m' 2>/dev/null | grep usersig | awk '{print $2}') # R/W + usersig_size=$(${avrdude[@]} -cdryrun -T 'part -m' 2>/dev/null | grep usersig | awk '{print $2}') # R/W # Is the to be tested programmer for a bootloader? is_bootloader=0 @@ -264,13 +264,13 @@ for (( p=0; p<$arraylength; p++ )); do # Should EEPROM test be carried out? check_eeprom=1 - [[ -z "$EE_SIZE" ]] && check_eeprom=0 + [[ -z "$ee_size" ]] && check_eeprom=0 [[ $is_bootloader -eq 1 && $skip_eeprom -eq 1 ]] && check_eeprom=0 ##### # Dryrun tests for high-level progrmmer-independent tests (only for -m2560 or similar) # - if [[ "$programmer" == -cdryrun && $FLASH_SIZE -eq 262144 && $benchmark -eq 0 ]]; then + if [[ "$programmer" == -cdryrun && $flash_size -eq 262144 && $benchmark -eq 0 ]]; then # Raw test specify="flash raw format -T/-U write/verify cola-vending-machine.raw" command=(${avrdude[@]} @@ -328,7 +328,7 @@ for (( p=0; p<$arraylength; p++ )); do # Fuse test (bootloaders usually cannot set fuses) # if [[ $is_bootloader -ne 1 && $fusetest -eq 1 && $benchmark -eq 0 ]]; then - if [ -n "$EE_SIZE" ]; then + if [ -n "$ee_size" ]; then specify="fuse access: clear, set and read eesave fuse bit" command=(${avrdude[@]} -T '"config eesave=0; config eesave=1; config eesave"') else @@ -341,7 +341,7 @@ for (( p=0; p<$arraylength; p++ )); do mv ${outfile}-2 $outfile result [[ '"$fusebit"' == 1 '&&' ! -s $outfile '&&' ! -s $logfile ]] - if [ -n "$EE_SIZE" ]; then + if [ -n "$ee_size" ]; then specify="fuse access: set eesave fusebit to delete EEPROM on chip erase" command=(${avrdude[@]} -T '"config eesave=ee*erased"') execute "${command[@]}" > $outfile @@ -364,13 +364,13 @@ for (( p=0; p<$arraylength; p++ )); do ##### # Flash test: a relatively difficult file with two code blocks and one data block with holes # - specify="flash -U write/verify holes_rjmp_loops_${FLASH_SIZE}B.hex" - command=(${avrdude[@]} -Uflash:w:$tfiles/holes_rjmp_loops_${FLASH_SIZE}B.hex) + specify="flash -U write/verify holes_rjmp_loops_${flash_size}B.hex" + command=(${avrdude[@]} -Uflash:w:$tfiles/holes_rjmp_loops_${flash_size}B.hex) execute "${command[@]}" result [ $? == 0 ] if [[ $? != 0 && $benchmark -eq 0 ]]; then # Not working? try a file without holes - specify="flash -U write/verify rjmp_loops_for_bootloaders_${FLASH_SIZE}B.hex" - command=(${avrdude[@]} -Uflash:w:$tfiles/rjmp_loops_for_bootloaders_${FLASH_SIZE}B.hex) + specify="flash -U write/verify rjmp_loops_for_bootloaders_${flash_size}B.hex" + command=(${avrdude[@]} -Uflash:w:$tfiles/rjmp_loops_for_bootloaders_${flash_size}B.hex) execute "${command[@]}" result [ $? == 0 ] fi @@ -385,13 +385,13 @@ for (( p=0; p<$arraylength; p++ )); do fi if [[ $benchmark -eq 0 ]]; then - specify="flash -T write/verify holes_rjmp_loops_${FLASH_SIZE}B.hex" - command=(${avrdude[@]} -T '"write flash '$tfiles/holes_rjmp_loops_${FLASH_SIZE}B.hex:a'"') + specify="flash -T write/verify holes_rjmp_loops_${flash_size}B.hex" + command=(${avrdude[@]} -T '"write flash '$tfiles/holes_rjmp_loops_${flash_size}B.hex:a'"') execute "${command[@]}" > $outfile result [[ ! -s $outfile '&&' ! -s $logfile ]] if [ $? != 0 ]; then # Not working? try a file without holes - specify="flash -T write/verify rjmp_loops_for_bootloaders_${FLASH_SIZE}B.hex" - command=(${avrdude[@]} -T '"write flash '$tfiles/rjmp_loops_for_bootloaders_${FLASH_SIZE}B.hex:a'"') + specify="flash -T write/verify rjmp_loops_for_bootloaders_${flash_size}B.hex" + command=(${avrdude[@]} -T '"write flash '$tfiles/rjmp_loops_for_bootloaders_${flash_size}B.hex:a'"') execute "${command[@]}" > $outfile result [[ ! -s $outfile '&&' ! -s $logfile ]] fi @@ -402,8 +402,8 @@ for (( p=0; p<$arraylength; p++ )); do # if [ $check_eeprom -eq 1 ]; then if [ $benchmark -eq 1 ]; then - specify="eeprom -U write/verify holes_pack_my_box_${EE_SIZE}B.hex" - command=(${avrdude[@]} -Ueeprom:w:$tfiles/holes_pack_my_box_${EE_SIZE}B.hex) + specify="eeprom -U write/verify holes_pack_my_box_${ee_size}B.hex" + command=(${avrdude[@]} -Ueeprom:w:$tfiles/holes_pack_my_box_${ee_size}B.hex) execute "${command[@]}" result [ $? == 0 ] bench_t_eewr=$bench_t @@ -421,13 +421,13 @@ for (( p=0; p<$arraylength; p++ )); do execute "${command[@]}" result [ $? == 0 ] if [ $? == 0 ]; then # OK, try a file with holes - specify="eeprom -U write/verify holes_pack_my_box_${EE_SIZE}B.hex" - command=(${avrdude[@]} -Ueeprom:w:$tfiles/holes_pack_my_box_${EE_SIZE}B.hex) + specify="eeprom -U write/verify holes_pack_my_box_${ee_size}B.hex" + command=(${avrdude[@]} -Ueeprom:w:$tfiles/holes_pack_my_box_${ee_size}B.hex) execute "${command[@]}" result [ $? == 0 ] if [ $? != 0 ]; then # Not working? try a file without holes - specify="eeprom -U write/verify the_quick_brown_fox_${EE_SIZE}B.hex" - command=(${avrdude[@]} -Ueeprom:w:$tfiles/the_quick_brown_fox_${EE_SIZE}B.hex) + specify="eeprom -U write/verify the_quick_brown_fox_${ee_size}B.hex" + command=(${avrdude[@]} -Ueeprom:w:$tfiles/the_quick_brown_fox_${ee_size}B.hex) execute "${command[@]}" result [ $? == 0 ] fi @@ -435,16 +435,16 @@ for (( p=0; p<$arraylength; p++ )); do echo "# ... the next test may therefore take longer" fi - specify="eeprom -T write/verify holes_{the_five_boxing_wizards,pack_my_box}_${EE_SIZE}B.hex" + specify="eeprom -T write/verify holes_{the_five_boxing_wizards,pack_my_box}_${ee_size}B.hex" command=(${avrdude[@]} - -T '"write eeprom '$tfiles/holes_the_five_boxing_wizards_${EE_SIZE}B.hex:a'"' + -T '"write eeprom '$tfiles/holes_the_five_boxing_wizards_${ee_size}B.hex:a'"' -T flush - -T '"write eeprom '$tfiles/holes_pack_my_box_${EE_SIZE}B.hex:a'"') + -T '"write eeprom '$tfiles/holes_pack_my_box_${ee_size}B.hex:a'"') execute "${command[@]}" > $outfile result [[ ! -s $outfile '&&' ! -s $logfile ]] if [ $? != 0 ]; then # Not working? try a file without holes - specify="eeprom -T write/verify lorem_ipsum_${EE_SIZE}B.srec" - command=(${avrdude[@]} -T '"write eeprom '$tfiles/lorem_ipsum_${EE_SIZE}B.srec:a'"') + specify="eeprom -T write/verify lorem_ipsum_${ee_size}B.srec" + command=(${avrdude[@]} -T '"write eeprom '$tfiles/lorem_ipsum_${ee_size}B.srec:a'"') execute "${command[@]}" > $outfile result [[ ! -s $outfile '&&' ! -s $logfile ]] fi @@ -455,12 +455,12 @@ for (( p=0; p<$arraylength; p++ )); do # Chip erase and verify # specify="chip erase and spot check flash is actually erased" - command=(${avrdude[@]} -e -Uflash:v:$tfiles/holes_flash_0xff_${FLASH_SIZE}B.hex) + command=(${avrdude[@]} -e -Uflash:v:$tfiles/holes_flash_0xff_${flash_size}B.hex) execute "${command[@]}" result [ $? == 0 ] if [[ $? == 0 && $check_eeprom -eq 1 && $is_bootloader -eq 0 && $benchmark -eq 0 ]]; then specify="spot check eeprom is erased, too" - command=(${avrdude[@]} -Ueeprom:v:$tfiles/holes_eeprom_0xff_${EE_SIZE}B.hex) + command=(${avrdude[@]} -Ueeprom:v:$tfiles/holes_eeprom_0xff_${ee_size}B.hex) execute "${command[@]}" result [ $? == 0 ] fi @@ -469,18 +469,18 @@ for (( p=0; p<$arraylength; p++ )); do ###### # Write and verify random data to usersig if present # - if [[ -n "$USERSIG_SIZE" && $is_bootloader -ne 1 && $benchmark -eq 0 ]]; then - specify="usersig -T/-U write/read random_data_${USERSIG_SIZE}B.bin" + if [[ -n "$usersig_size" && $is_bootloader -ne 1 && $benchmark -eq 0 ]]; then + specify="usersig -T/-U write/read random_data_${usersig_size}B.bin" command=(${avrdude[@]} - -T '"erase usersig; write usersig '$tfiles/random_data_${USERSIG_SIZE}B.bin'"' + -T '"erase usersig; write usersig '$tfiles/random_data_${usersig_size}B.bin'"' -T flush -U usersig:r:$tmpfile:r -U usersig:v:$tmpfile:r -T '"erase usersig"' -T flush - -U usersig:v:$tfiles/0xff_${USERSIG_SIZE}B.hex:i) + -U usersig:v:$tfiles/0xff_${usersig_size}B.hex:i) execute "${command[@]}" >$outfile - result [[ ! -s $outfile '&&' ! -s $logfile ]] '&&' cmp -s "$tfiles/random_data_${USERSIG_SIZE}B.bin" "$tmpfile" + result [[ ! -s $outfile '&&' ! -s $logfile ]] '&&' cmp -s "$tfiles/random_data_${usersig_size}B.bin" "$tmpfile" cp /dev/null $tmpfile fi @@ -489,7 +489,7 @@ for (( p=0; p<$arraylength; p++ )); do echo $bench_char "$(printf '%7.3f s' $bench_sum): benchmark for ${pgm_and_target[$p]}" fi - if [ $FAIL == true ]; then + if [ $fail == true ]; then echo '' read -rep "One or more AVRDUDE \"${pgm_and_target[$p]}\" tests failed. Do you want to retry this particular test? (y/n): " choice case "$choice" in From df3c67f2d0aba9ab4752978fe19a709841ff456c Mon Sep 17 00:00:00 2001 From: stefanrueger Date: Tue, 27 Feb 2024 14:04:09 +1300 Subject: [PATCH 04/12] Add normalised avrbench number suitable for markdown tables The cumulative time for typical user tasks depends on the flash and EEPROM size of the part. This commit computes a size-normalised time. Lower is better. This avrbench number still depends on the part, but less so than the cumulative time of the tasks. The summary line is put in vertical bars to make creation of markdown tables easier. --- tools/test-avrdude | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/test-avrdude b/tools/test-avrdude index 0c207887..0e75a066 100755 --- a/tools/test-avrdude +++ b/tools/test-avrdude @@ -486,7 +486,11 @@ for (( p=0; p<$arraylength; p++ )); do if [ $benchmark -eq 1 ]; then bench_sum=$(echo "$bench_t_flwr $bench_t_flrd $bench_t_eewr $bench_t_eerd $bench_t_ce" | awk '{print $1+$2+$3+$4+$5}') - echo $bench_char "$(printf '%7.3f s' $bench_sum): benchmark for ${pgm_and_target[$p]}" + [[ $check_eeprom -eq 0 ]] \ + && bench_norm=$(echo "$bench_t_flwr $bench_t_flrd $flash_size" | awk '{print 10705*(($1+$2)/$3)}') \ + || bench_norm=$(echo "$bench_t_flwr $bench_t_flrd $flash_size $bench_t_eewr $bench_t_eerd $ee_size" | \ + awk '{print 6789*(($1+$2)/$3 + ($4+$5)/(32*$6))}') + echo "|$bench_char|$(printf '%6.3f s' $bench_sum)|$(printf '%7.3f s' $bench_norm)|${pgm_and_target[$p]}|" fi if [ $fail == true ]; then From f088a9bc3feea230c8b5a7b9cc8a711ea559b055 Mon Sep 17 00:00:00 2001 From: stefanrueger Date: Tue, 27 Feb 2024 14:46:37 +1300 Subject: [PATCH 05/12] Clarify -b option --- tools/test-avrdude | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/test-avrdude b/tools/test-avrdude index 0e75a066..568c6d36 100755 --- a/tools/test-avrdude +++ b/tools/test-avrdude @@ -23,7 +23,7 @@ cat <} Function: test AVRDUDE for certain programmer and part combinations Options: - -b benchmark testing only and summarise overall time + -b benchmark only summarising overall and avrbench time -c additional configuration options used for all runs -d delay between test commands (default $delay seconds) -e set path of AVRDUDE executable (default $avrdude_bin) From cd41d2b4e24c2d017d635537b2f1dc5385dd81e9 Mon Sep 17 00:00:00 2001 From: stefanrueger Date: Tue, 27 Feb 2024 15:00:22 +1300 Subject: [PATCH 06/12] Change /dev/null to temp file to be Windows compatible --- tools/test-avrdude | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/test-avrdude b/tools/test-avrdude index 568c6d36..10ede616 100755 --- a/tools/test-avrdude +++ b/tools/test-avrdude @@ -160,8 +160,7 @@ tmpfile=$(mktemp "$tmp/$progname.tmp.XXXXXX") resfile=$(mktemp "$tmp/$progname.res.XXXXXX") trap "rm -f $status $logfile $outfile $tmpfile $resfile" EXIT -devnull=/dev/null -[[ ! -w /dev/null ]] && devnull=$tmpfile +devnull=$tmpfile # Cannot use /dev/null as file in Windows avrdude TIMEFORMAT=%R # time built-in only returns elapsed wall-clock time elapsed=-1 # Global variable holding time of last execute command in seconds From efd6bab19ce6c6aace07fa2760e887c0564460fd Mon Sep 17 00:00:00 2001 From: stefanrueger Date: Tue, 27 Feb 2024 22:51:36 +1300 Subject: [PATCH 07/12] Widen chip erase tests to also capture -c urclock emulation --- tools/test-avrdude | 7 +++++-- tools/test_files/flash_one_byte_0xff_10240B.hex | 3 +++ tools/test_files/flash_one_byte_0xff_1024B.hex | 3 +++ tools/test_files/flash_one_byte_0xff_131072B.hex | 3 +++ tools/test_files/flash_one_byte_0xff_139264B.hex | 3 +++ tools/test_files/flash_one_byte_0xff_16384B.hex | 3 +++ tools/test_files/flash_one_byte_0xff_204800B.hex | 3 +++ tools/test_files/flash_one_byte_0xff_20480B.hex | 3 +++ tools/test_files/flash_one_byte_0xff_2048B.hex | 3 +++ tools/test_files/flash_one_byte_0xff_262144B.hex | 3 +++ tools/test_files/flash_one_byte_0xff_270336B.hex | 3 +++ tools/test_files/flash_one_byte_0xff_32768B.hex | 3 +++ tools/test_files/flash_one_byte_0xff_36864B.hex | 3 +++ tools/test_files/flash_one_byte_0xff_401408B.hex | 3 +++ tools/test_files/flash_one_byte_0xff_40960B.hex | 3 +++ tools/test_files/flash_one_byte_0xff_4096B.hex | 3 +++ tools/test_files/flash_one_byte_0xff_49152B.hex | 3 +++ tools/test_files/flash_one_byte_0xff_512B.hex | 3 +++ tools/test_files/flash_one_byte_0xff_524288B.hex | 3 +++ tools/test_files/flash_one_byte_0xff_65536B.hex | 3 +++ tools/test_files/flash_one_byte_0xff_69632B.hex | 3 +++ tools/test_files/flash_one_byte_0xff_8192B.hex | 3 +++ tools/test_files/generate_test_hex.sh | 4 ++-- 23 files changed, 70 insertions(+), 4 deletions(-) create mode 100644 tools/test_files/flash_one_byte_0xff_10240B.hex create mode 100644 tools/test_files/flash_one_byte_0xff_1024B.hex create mode 100644 tools/test_files/flash_one_byte_0xff_131072B.hex create mode 100644 tools/test_files/flash_one_byte_0xff_139264B.hex create mode 100644 tools/test_files/flash_one_byte_0xff_16384B.hex create mode 100644 tools/test_files/flash_one_byte_0xff_204800B.hex create mode 100644 tools/test_files/flash_one_byte_0xff_20480B.hex create mode 100644 tools/test_files/flash_one_byte_0xff_2048B.hex create mode 100644 tools/test_files/flash_one_byte_0xff_262144B.hex create mode 100644 tools/test_files/flash_one_byte_0xff_270336B.hex create mode 100644 tools/test_files/flash_one_byte_0xff_32768B.hex create mode 100644 tools/test_files/flash_one_byte_0xff_36864B.hex create mode 100644 tools/test_files/flash_one_byte_0xff_401408B.hex create mode 100644 tools/test_files/flash_one_byte_0xff_40960B.hex create mode 100644 tools/test_files/flash_one_byte_0xff_4096B.hex create mode 100644 tools/test_files/flash_one_byte_0xff_49152B.hex create mode 100644 tools/test_files/flash_one_byte_0xff_512B.hex create mode 100644 tools/test_files/flash_one_byte_0xff_524288B.hex create mode 100644 tools/test_files/flash_one_byte_0xff_65536B.hex create mode 100644 tools/test_files/flash_one_byte_0xff_69632B.hex create mode 100644 tools/test_files/flash_one_byte_0xff_8192B.hex diff --git a/tools/test-avrdude b/tools/test-avrdude index 10ede616..44c735bd 100755 --- a/tools/test-avrdude +++ b/tools/test-avrdude @@ -355,7 +355,8 @@ for (( p=0; p<$arraylength; p++ )); do # if [ $benchmark -eq 0 ]; then specify="chip erase" - command=(${avrdude[@]} -e) + # Emulated chip erase needs a tiny file be uploaded + command=(${avrdude[@]} -e -A -U $tfiles/flash_one_byte_0xff_${flash_size}B.hex) execute "${command[@]}" result [ $? == 0 ] fi @@ -454,7 +455,9 @@ for (( p=0; p<$arraylength; p++ )); do # Chip erase and verify # specify="chip erase and spot check flash is actually erased" - command=(${avrdude[@]} -e -Uflash:v:$tfiles/holes_flash_0xff_${flash_size}B.hex) + command=(${avrdude[@]} -e -A + -U $tfiles/flash_one_byte_0xff_${flash_size}B.hex + -U flash:v:$tfiles/holes_flash_0xff_${flash_size}B.hex) execute "${command[@]}" result [ $? == 0 ] if [[ $? == 0 && $check_eeprom -eq 1 && $is_bootloader -eq 0 && $benchmark -eq 0 ]]; then diff --git a/tools/test_files/flash_one_byte_0xff_10240B.hex b/tools/test_files/flash_one_byte_0xff_10240B.hex new file mode 100644 index 00000000..8eeb3356 --- /dev/null +++ b/tools/test_files/flash_one_byte_0xff_10240B.hex @@ -0,0 +1,3 @@ +:020000040000FA +:010A0000FFF6 +:00000001FF diff --git a/tools/test_files/flash_one_byte_0xff_1024B.hex b/tools/test_files/flash_one_byte_0xff_1024B.hex new file mode 100644 index 00000000..d9ed2768 --- /dev/null +++ b/tools/test_files/flash_one_byte_0xff_1024B.hex @@ -0,0 +1,3 @@ +:020000040000FA +:01010000FFFF +:00000001FF diff --git a/tools/test_files/flash_one_byte_0xff_131072B.hex b/tools/test_files/flash_one_byte_0xff_131072B.hex new file mode 100644 index 00000000..434fb443 --- /dev/null +++ b/tools/test_files/flash_one_byte_0xff_131072B.hex @@ -0,0 +1,3 @@ +:020000040000FA +:01800000FF80 +:00000001FF diff --git a/tools/test_files/flash_one_byte_0xff_139264B.hex b/tools/test_files/flash_one_byte_0xff_139264B.hex new file mode 100644 index 00000000..1c5aab65 --- /dev/null +++ b/tools/test_files/flash_one_byte_0xff_139264B.hex @@ -0,0 +1,3 @@ +:020000040000FA +:01880000FF78 +:00000001FF diff --git a/tools/test_files/flash_one_byte_0xff_16384B.hex b/tools/test_files/flash_one_byte_0xff_16384B.hex new file mode 100644 index 00000000..36f20f79 --- /dev/null +++ b/tools/test_files/flash_one_byte_0xff_16384B.hex @@ -0,0 +1,3 @@ +:020000040000FA +:01100000FFF0 +:00000001FF diff --git a/tools/test_files/flash_one_byte_0xff_204800B.hex b/tools/test_files/flash_one_byte_0xff_204800B.hex new file mode 100644 index 00000000..a20f0dfc --- /dev/null +++ b/tools/test_files/flash_one_byte_0xff_204800B.hex @@ -0,0 +1,3 @@ +:020000040000FA +:01C80000FF38 +:00000001FF diff --git a/tools/test_files/flash_one_byte_0xff_20480B.hex b/tools/test_files/flash_one_byte_0xff_20480B.hex new file mode 100644 index 00000000..fc010281 --- /dev/null +++ b/tools/test_files/flash_one_byte_0xff_20480B.hex @@ -0,0 +1,3 @@ +:020000040000FA +:01140000FFEC +:00000001FF diff --git a/tools/test_files/flash_one_byte_0xff_2048B.hex b/tools/test_files/flash_one_byte_0xff_2048B.hex new file mode 100644 index 00000000..2372e248 --- /dev/null +++ b/tools/test_files/flash_one_byte_0xff_2048B.hex @@ -0,0 +1,3 @@ +:020000040000FA +:01020000FFFE +:00000001FF diff --git a/tools/test_files/flash_one_byte_0xff_262144B.hex b/tools/test_files/flash_one_byte_0xff_262144B.hex new file mode 100644 index 00000000..b7866f30 --- /dev/null +++ b/tools/test_files/flash_one_byte_0xff_262144B.hex @@ -0,0 +1,3 @@ +:020000040001F9 +:01000000FF00 +:00000001FF diff --git a/tools/test_files/flash_one_byte_0xff_270336B.hex b/tools/test_files/flash_one_byte_0xff_270336B.hex new file mode 100644 index 00000000..2f7e6451 --- /dev/null +++ b/tools/test_files/flash_one_byte_0xff_270336B.hex @@ -0,0 +1,3 @@ +:020000040001F9 +:01080000FFF8 +:00000001FF diff --git a/tools/test_files/flash_one_byte_0xff_32768B.hex b/tools/test_files/flash_one_byte_0xff_32768B.hex new file mode 100644 index 00000000..bbf220f0 --- /dev/null +++ b/tools/test_files/flash_one_byte_0xff_32768B.hex @@ -0,0 +1,3 @@ +:020000040000FA +:01200000FFE0 +:00000001FF diff --git a/tools/test_files/flash_one_byte_0xff_36864B.hex b/tools/test_files/flash_one_byte_0xff_36864B.hex new file mode 100644 index 00000000..75d0281b --- /dev/null +++ b/tools/test_files/flash_one_byte_0xff_36864B.hex @@ -0,0 +1,3 @@ +:020000040000FA +:01240000FFDC +:00000001FF diff --git a/tools/test_files/flash_one_byte_0xff_401408B.hex b/tools/test_files/flash_one_byte_0xff_401408B.hex new file mode 100644 index 00000000..6ff2cf4d --- /dev/null +++ b/tools/test_files/flash_one_byte_0xff_401408B.hex @@ -0,0 +1,3 @@ +:020000040001F9 +:01880000FF78 +:00000001FF diff --git a/tools/test_files/flash_one_byte_0xff_40960B.hex b/tools/test_files/flash_one_byte_0xff_40960B.hex new file mode 100644 index 00000000..e6cb14c2 --- /dev/null +++ b/tools/test_files/flash_one_byte_0xff_40960B.hex @@ -0,0 +1,3 @@ +:020000040000FA +:01280000FFD8 +:00000001FF diff --git a/tools/test_files/flash_one_byte_0xff_4096B.hex b/tools/test_files/flash_one_byte_0xff_4096B.hex new file mode 100644 index 00000000..32ce277d --- /dev/null +++ b/tools/test_files/flash_one_byte_0xff_4096B.hex @@ -0,0 +1,3 @@ +:020000040000FA +:01040000FFFC +:00000001FF diff --git a/tools/test_files/flash_one_byte_0xff_49152B.hex b/tools/test_files/flash_one_byte_0xff_49152B.hex new file mode 100644 index 00000000..24009753 --- /dev/null +++ b/tools/test_files/flash_one_byte_0xff_49152B.hex @@ -0,0 +1,3 @@ +:020000040000FA +:01300000FFD0 +:00000001FF diff --git a/tools/test_files/flash_one_byte_0xff_512B.hex b/tools/test_files/flash_one_byte_0xff_512B.hex new file mode 100644 index 00000000..f6a9a764 --- /dev/null +++ b/tools/test_files/flash_one_byte_0xff_512B.hex @@ -0,0 +1,3 @@ +:020000040000FA +:01008000FF80 +:00000001FF diff --git a/tools/test_files/flash_one_byte_0xff_524288B.hex b/tools/test_files/flash_one_byte_0xff_524288B.hex new file mode 100644 index 00000000..9ed27666 --- /dev/null +++ b/tools/test_files/flash_one_byte_0xff_524288B.hex @@ -0,0 +1,3 @@ +:020000040002F8 +:01000000FF00 +:00000001FF diff --git a/tools/test_files/flash_one_byte_0xff_65536B.hex b/tools/test_files/flash_one_byte_0xff_65536B.hex new file mode 100644 index 00000000..a42e27eb --- /dev/null +++ b/tools/test_files/flash_one_byte_0xff_65536B.hex @@ -0,0 +1,3 @@ +:020000040000FA +:01400000FFC0 +:00000001FF diff --git a/tools/test_files/flash_one_byte_0xff_69632B.hex b/tools/test_files/flash_one_byte_0xff_69632B.hex new file mode 100644 index 00000000..66749c42 --- /dev/null +++ b/tools/test_files/flash_one_byte_0xff_69632B.hex @@ -0,0 +1,3 @@ +:020000040000FA +:01440000FFBC +:00000001FF diff --git a/tools/test_files/flash_one_byte_0xff_8192B.hex b/tools/test_files/flash_one_byte_0xff_8192B.hex new file mode 100644 index 00000000..b1721926 --- /dev/null +++ b/tools/test_files/flash_one_byte_0xff_8192B.hex @@ -0,0 +1,3 @@ +:020000040000FA +:01080000FFF8 +:00000001FF diff --git a/tools/test_files/generate_test_hex.sh b/tools/test_files/generate_test_hex.sh index adc74829..0e6bc6a1 100755 --- a/tools/test_files/generate_test_hex.sh +++ b/tools/test_files/generate_test_hex.sh @@ -39,6 +39,8 @@ for i in ${flashsizes[@]}; do -generate $((i-i/3)) $((i-i/4-2)) -repeat-data 0xff \ -generate $((i-i/4-1)) $((i-i/4)) -repeat-data 0xff \ -o holes_flash_0xff_${i}B.hex -Intel + # A file with a single 0xff byte + srec_cat -generate $((i/4)) $((i/4+1)) -repeat-data 0xff -o flash_one_byte_0xff_${i}B.hex -Intel done ### @@ -50,5 +52,3 @@ for i in ${usersigsizes[@]}; do # Empty memory srec_cat -generate 0x00 $i -repeat-data 0xff -o 0xff_${i}B.hex -Intel done - - From 82c001bab4ac9bc529977ea072eb95a2054e7a4c Mon Sep 17 00:00:00 2001 From: stefanrueger Date: Tue, 27 Feb 2024 23:10:01 +1300 Subject: [PATCH 08/12] Drop chip erase and checking test for test-avrdude -b --- tools/test-avrdude | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/tools/test-avrdude b/tools/test-avrdude index 44c735bd..d5259ab7 100755 --- a/tools/test-avrdude +++ b/tools/test-avrdude @@ -231,7 +231,7 @@ for (( p=0; p<$arraylength; p++ )); do read -n1 -s -r -p $'' key [[ $emulated -eq 0 ]] && sleep 0.15 # Debounce key when not using dryrun/dryboot fi - bench_char="✅"; bench_t_flwr=0; bench_t_flrd=0; bench_t_eewr=0; bench_t_eerd=0; bench_t_ce=0 + bench_char="✅"; bench_t_flwr=0; bench_t_flrd=0; bench_t_eewr=0; bench_t_eerd=0 if [ "$key" == '' ]; then fail=false @@ -454,19 +454,20 @@ for (( p=0; p<$arraylength; p++ )); do ###### # Chip erase and verify # - specify="chip erase and spot check flash is actually erased" - command=(${avrdude[@]} -e -A - -U $tfiles/flash_one_byte_0xff_${flash_size}B.hex - -U flash:v:$tfiles/holes_flash_0xff_${flash_size}B.hex) - execute "${command[@]}" - result [ $? == 0 ] - if [[ $? == 0 && $check_eeprom -eq 1 && $is_bootloader -eq 0 && $benchmark -eq 0 ]]; then - specify="spot check eeprom is erased, too" - command=(${avrdude[@]} -Ueeprom:v:$tfiles/holes_eeprom_0xff_${ee_size}B.hex) + if [[ $benchmark -eq 0 ]]; then + specify="chip erase and spot check flash is actually erased" + command=(${avrdude[@]} -e -A + -U $tfiles/flash_one_byte_0xff_${flash_size}B.hex + -U flash:v:$tfiles/holes_flash_0xff_${flash_size}B.hex) execute "${command[@]}" result [ $? == 0 ] + if [[ $? == 0 && $check_eeprom -eq 1 && $is_bootloader -eq 0 ]]; then + specify="spot check eeprom is erased, too" + command=(${avrdude[@]} -Ueeprom:v:$tfiles/holes_eeprom_0xff_${ee_size}B.hex) + execute "${command[@]}" + result [ $? == 0 ] + fi fi - bench_t_ce=$bench_t ###### # Write and verify random data to usersig if present @@ -487,7 +488,7 @@ for (( p=0; p<$arraylength; p++ )); do fi if [ $benchmark -eq 1 ]; then - bench_sum=$(echo "$bench_t_flwr $bench_t_flrd $bench_t_eewr $bench_t_eerd $bench_t_ce" | awk '{print $1+$2+$3+$4+$5}') + bench_sum=$(echo "$bench_t_flwr $bench_t_flrd $bench_t_eewr $bench_t_eerd" | awk '{print $1+$2+$3+$4}') [[ $check_eeprom -eq 0 ]] \ && bench_norm=$(echo "$bench_t_flwr $bench_t_flrd $flash_size" | awk '{print 10705*(($1+$2)/$3)}') \ || bench_norm=$(echo "$bench_t_flwr $bench_t_flrd $flash_size $bench_t_eewr $bench_t_eerd $ee_size" | \ From 61ed3dd18f078ffb0429406fd5d10d4e97021fd0 Mon Sep 17 00:00:00 2001 From: stefanrueger Date: Tue, 27 Feb 2024 23:14:31 +1300 Subject: [PATCH 09/12] Mention avrbench legend in test-avrdude -b summary --- tools/test-avrdude | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/test-avrdude b/tools/test-avrdude index d5259ab7..d79c9231 100755 --- a/tools/test-avrdude +++ b/tools/test-avrdude @@ -493,7 +493,7 @@ for (( p=0; p<$arraylength; p++ )); do && bench_norm=$(echo "$bench_t_flwr $bench_t_flrd $flash_size" | awk '{print 10705*(($1+$2)/$3)}') \ || bench_norm=$(echo "$bench_t_flwr $bench_t_flrd $flash_size $bench_t_eewr $bench_t_eerd $ee_size" | \ awk '{print 6789*(($1+$2)/$3 + ($4+$5)/(32*$6))}') - echo "|$bench_char|$(printf '%6.3f s' $bench_sum)|$(printf '%7.3f s' $bench_norm)|${pgm_and_target[$p]}|" + echo "|$bench_char|$(printf '%6.3f s' $bench_sum)|avrbench $(printf '%6.3f s' $bench_norm)|${pgm_and_target[$p]}|" fi if [ $fail == true ]; then From 64c5d1da0b77b8eed915497f2207ebc8445a4520 Mon Sep 17 00:00:00 2001 From: stefanrueger Date: Wed, 28 Feb 2024 22:07:18 +1300 Subject: [PATCH 10/12] Remove avrbench and generate 4-number benchmark table with legend --- tools/test-avrdude | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/tools/test-avrdude b/tools/test-avrdude index d79c9231..bcb53a5f 100755 --- a/tools/test-avrdude +++ b/tools/test-avrdude @@ -188,11 +188,13 @@ result () { if [[ $list_only -eq 0 ]]; then if [[ $ret -eq 0 ]]; then echo ✅ "$(printf '%7.3f s' $elapsed): $specify" + bench_t=$(printf '%5.2f s' $elapsed) else echo ❌ "$(printf '%7.3f s' $elapsed): $specify (failed command below)" echo "\$ ${command[@]}" | sed "s/ -l [^ ]* / /" | tr -s " " fail=true bench_char="❌" + bench_t=error exitstate=1 [[ $emulated -eq 0 ]] && sleep 4 # Let the hw settle down before next test fi @@ -200,7 +202,6 @@ result () { else cat $outfile fi - bench_t=$elapsed cp /dev/null $outfile; cp /dev/null $logfile; elapsed=-999; specify="unknown"; command=(sleep 0.1) return $ret } @@ -214,13 +215,28 @@ nofusetest=(-pattiny11/ -pt11/ -pattiny12/ -pt12/ -pattiny15/ -pt15/ -pat89s51/ -pavr8ea28/ -pavr8ea32/ -pavr8ea32/ -plgt8f88p/ -plgt8f88p/ -plgt8f168p/ -plgt8f168p/ -plgt8f328p/ -plgt8f328p/) +if [[ $benchmark -eq 1 ]]; then + echo + echo The benchmark shows the wall clock time of avrdude carrying out the following tasks + echo " -" Fl-ewv: erase flash, then write a sketch with three sections separated by holes, and verify + echo " -" Fl-r: read the entire flash memory and write to file + echo " -" EE-wv: write data to EEPROM with two data sections separated by a hole, and verify + echo " -" EE-r: read the entire EEPROM memory and write to file + echo + echo The sketch and data payload is roughly one sixth of the respective memory size + echo + echo '| | `-c pgm` | `-p part` | Fl-ewv | Fl-r | EE-wv | EE-r | Comments |' + echo '|:-:|--:|--:|--:|--:|--:|--:|:--|' +fi + exitstate=0 for (( p=0; p<$arraylength; p++ )); do # Isolate programmer and part (assumes -c prog or -cprog but not sth more tricky such as -qc prog) - programmer=$(echo ${pgm_and_target[$p]} | sed 's/ *\([^-]\)/\1/g' | tr \ \\n | grep ^-c | tr A-Z a-z) - part=$(echo ${pgm_and_target[$p]} | sed 's/ *\([^-]\)/\1/g' | tr \ \\n | grep ^-p | tr A-Z a-z) + programmer=$(echo ${pgm_and_target[$p]} | sed 's/.* *-c *\([^ ]*\) *.*/\1/g' | tr A-Z a-z) + part=$(echo ${pgm_and_target[$p]} | sed 's/.* *-p *\([^ ]*\) *.*/\1/g' | tr A-Z a-z) + rest=$(echo ${pgm_and_target[$p]} | sed -e's/ *-[cpP] *[^ ]* */ /g' -e's/ */ /g') emulated=0 - [[ "$programmer" == -cdryrun || "$programmer" == -cdryboot ]] && emulated=1 + [[ "$programmer" == dryrun || "$programmer" == dryboot ]] && emulated=1 if [[ $list_only -eq 1 ]]; then [[ p -ne 0 ]] && echo @@ -231,7 +247,7 @@ for (( p=0; p<$arraylength; p++ )); do read -n1 -s -r -p $'' key [[ $emulated -eq 0 ]] && sleep 0.15 # Debounce key when not using dryrun/dryboot fi - bench_char="✅"; bench_t_flwr=0; bench_t_flrd=0; bench_t_eewr=0; bench_t_eerd=0 + bench_char="✅"; bench_t_flwr=--; bench_t_flrd=--; bench_t_eewr=--; bench_t_eerd=-- if [ "$key" == '' ]; then fail=false @@ -254,12 +270,12 @@ for (( p=0; p<$arraylength; p++ )); do # Is the to be tested programmer for a bootloader? is_bootloader=0 if [ -n "$programmer" ]; then - ($avrdude_bin $avrdude_conf "$programmer"/At 2>/dev/null | grep -q prog_modes.PM_SPM) && is_bootloader=1 + ($avrdude_bin $avrdude_conf -c"$programmer"/At 2>/dev/null | grep -q prog_modes.PM_SPM) && is_bootloader=1 fi # Should we test fuses? fusetest=1 - [[ -n "$part" && "${nofusetest[@]}" =~ "$part/" ]] && fusetest=0 + [[ -n "$part" && "${nofusetest[@]}" =~ -p"$part/" ]] && fusetest=0 # Should EEPROM test be carried out? check_eeprom=1 @@ -269,7 +285,7 @@ for (( p=0; p<$arraylength; p++ )); do ##### # Dryrun tests for high-level progrmmer-independent tests (only for -m2560 or similar) # - if [[ "$programmer" == -cdryrun && $flash_size -eq 262144 && $benchmark -eq 0 ]]; then + if [[ "$programmer" == dryrun && $flash_size -eq 262144 && $benchmark -eq 0 ]]; then # Raw test specify="flash raw format -T/-U write/verify cola-vending-machine.raw" command=(${avrdude[@]} @@ -488,12 +504,7 @@ for (( p=0; p<$arraylength; p++ )); do fi if [ $benchmark -eq 1 ]; then - bench_sum=$(echo "$bench_t_flwr $bench_t_flrd $bench_t_eewr $bench_t_eerd" | awk '{print $1+$2+$3+$4}') - [[ $check_eeprom -eq 0 ]] \ - && bench_norm=$(echo "$bench_t_flwr $bench_t_flrd $flash_size" | awk '{print 10705*(($1+$2)/$3)}') \ - || bench_norm=$(echo "$bench_t_flwr $bench_t_flrd $flash_size $bench_t_eewr $bench_t_eerd $ee_size" | \ - awk '{print 6789*(($1+$2)/$3 + ($4+$5)/(32*$6))}') - echo "|$bench_char|$(printf '%6.3f s' $bench_sum)|avrbench $(printf '%6.3f s' $bench_norm)|${pgm_and_target[$p]}|" + echo "|$bench_char|$programmer|$part|$bench_t_flwr|$bench_t_flrd|$bench_t_eewr|$bench_t_eerd|$rest|" fi if [ $fail == true ]; then From e35714b1cef52719b03c2897ae4cb726ba2d39f2 Mon Sep 17 00:00:00 2001 From: stefanrueger Date: Wed, 28 Feb 2024 22:14:28 +1300 Subject: [PATCH 11/12] Change 1-byte file upload for emulated chip erase --- tools/test-avrdude | 5 ++--- tools/test_files/flash_one_byte_0xff_10240B.hex | 3 --- tools/test_files/flash_one_byte_0xff_1024B.hex | 3 --- tools/test_files/flash_one_byte_0xff_131072B.hex | 3 --- tools/test_files/flash_one_byte_0xff_139264B.hex | 3 --- tools/test_files/flash_one_byte_0xff_16384B.hex | 3 --- tools/test_files/flash_one_byte_0xff_204800B.hex | 3 --- tools/test_files/flash_one_byte_0xff_20480B.hex | 3 --- tools/test_files/flash_one_byte_0xff_2048B.hex | 3 --- tools/test_files/flash_one_byte_0xff_262144B.hex | 3 --- tools/test_files/flash_one_byte_0xff_270336B.hex | 3 --- tools/test_files/flash_one_byte_0xff_32768B.hex | 3 --- tools/test_files/flash_one_byte_0xff_36864B.hex | 3 --- tools/test_files/flash_one_byte_0xff_401408B.hex | 3 --- tools/test_files/flash_one_byte_0xff_40960B.hex | 3 --- tools/test_files/flash_one_byte_0xff_4096B.hex | 3 --- tools/test_files/flash_one_byte_0xff_49152B.hex | 3 --- tools/test_files/flash_one_byte_0xff_512B.hex | 3 --- tools/test_files/flash_one_byte_0xff_524288B.hex | 3 --- tools/test_files/flash_one_byte_0xff_65536B.hex | 3 --- tools/test_files/flash_one_byte_0xff_69632B.hex | 3 --- tools/test_files/flash_one_byte_0xff_8192B.hex | 3 --- tools/test_files/generate_test_hex.sh | 2 -- 23 files changed, 2 insertions(+), 68 deletions(-) delete mode 100644 tools/test_files/flash_one_byte_0xff_10240B.hex delete mode 100644 tools/test_files/flash_one_byte_0xff_1024B.hex delete mode 100644 tools/test_files/flash_one_byte_0xff_131072B.hex delete mode 100644 tools/test_files/flash_one_byte_0xff_139264B.hex delete mode 100644 tools/test_files/flash_one_byte_0xff_16384B.hex delete mode 100644 tools/test_files/flash_one_byte_0xff_204800B.hex delete mode 100644 tools/test_files/flash_one_byte_0xff_20480B.hex delete mode 100644 tools/test_files/flash_one_byte_0xff_2048B.hex delete mode 100644 tools/test_files/flash_one_byte_0xff_262144B.hex delete mode 100644 tools/test_files/flash_one_byte_0xff_270336B.hex delete mode 100644 tools/test_files/flash_one_byte_0xff_32768B.hex delete mode 100644 tools/test_files/flash_one_byte_0xff_36864B.hex delete mode 100644 tools/test_files/flash_one_byte_0xff_401408B.hex delete mode 100644 tools/test_files/flash_one_byte_0xff_40960B.hex delete mode 100644 tools/test_files/flash_one_byte_0xff_4096B.hex delete mode 100644 tools/test_files/flash_one_byte_0xff_49152B.hex delete mode 100644 tools/test_files/flash_one_byte_0xff_512B.hex delete mode 100644 tools/test_files/flash_one_byte_0xff_524288B.hex delete mode 100644 tools/test_files/flash_one_byte_0xff_65536B.hex delete mode 100644 tools/test_files/flash_one_byte_0xff_69632B.hex delete mode 100644 tools/test_files/flash_one_byte_0xff_8192B.hex diff --git a/tools/test-avrdude b/tools/test-avrdude index bcb53a5f..5a1ffd61 100755 --- a/tools/test-avrdude +++ b/tools/test-avrdude @@ -372,7 +372,7 @@ for (( p=0; p<$arraylength; p++ )); do if [ $benchmark -eq 0 ]; then specify="chip erase" # Emulated chip erase needs a tiny file be uploaded - command=(${avrdude[@]} -e -A -U $tfiles/flash_one_byte_0xff_${flash_size}B.hex) + command=(${avrdude[@]} -e -FAU flash:w:0xff:m) execute "${command[@]}" result [ $? == 0 ] fi @@ -472,8 +472,7 @@ for (( p=0; p<$arraylength; p++ )); do # if [[ $benchmark -eq 0 ]]; then specify="chip erase and spot check flash is actually erased" - command=(${avrdude[@]} -e -A - -U $tfiles/flash_one_byte_0xff_${flash_size}B.hex + command=(${avrdude[@]} -e -FAU flash:w:0xff:m -U flash:v:$tfiles/holes_flash_0xff_${flash_size}B.hex) execute "${command[@]}" result [ $? == 0 ] diff --git a/tools/test_files/flash_one_byte_0xff_10240B.hex b/tools/test_files/flash_one_byte_0xff_10240B.hex deleted file mode 100644 index 8eeb3356..00000000 --- a/tools/test_files/flash_one_byte_0xff_10240B.hex +++ /dev/null @@ -1,3 +0,0 @@ -:020000040000FA -:010A0000FFF6 -:00000001FF diff --git a/tools/test_files/flash_one_byte_0xff_1024B.hex b/tools/test_files/flash_one_byte_0xff_1024B.hex deleted file mode 100644 index d9ed2768..00000000 --- a/tools/test_files/flash_one_byte_0xff_1024B.hex +++ /dev/null @@ -1,3 +0,0 @@ -:020000040000FA -:01010000FFFF -:00000001FF diff --git a/tools/test_files/flash_one_byte_0xff_131072B.hex b/tools/test_files/flash_one_byte_0xff_131072B.hex deleted file mode 100644 index 434fb443..00000000 --- a/tools/test_files/flash_one_byte_0xff_131072B.hex +++ /dev/null @@ -1,3 +0,0 @@ -:020000040000FA -:01800000FF80 -:00000001FF diff --git a/tools/test_files/flash_one_byte_0xff_139264B.hex b/tools/test_files/flash_one_byte_0xff_139264B.hex deleted file mode 100644 index 1c5aab65..00000000 --- a/tools/test_files/flash_one_byte_0xff_139264B.hex +++ /dev/null @@ -1,3 +0,0 @@ -:020000040000FA -:01880000FF78 -:00000001FF diff --git a/tools/test_files/flash_one_byte_0xff_16384B.hex b/tools/test_files/flash_one_byte_0xff_16384B.hex deleted file mode 100644 index 36f20f79..00000000 --- a/tools/test_files/flash_one_byte_0xff_16384B.hex +++ /dev/null @@ -1,3 +0,0 @@ -:020000040000FA -:01100000FFF0 -:00000001FF diff --git a/tools/test_files/flash_one_byte_0xff_204800B.hex b/tools/test_files/flash_one_byte_0xff_204800B.hex deleted file mode 100644 index a20f0dfc..00000000 --- a/tools/test_files/flash_one_byte_0xff_204800B.hex +++ /dev/null @@ -1,3 +0,0 @@ -:020000040000FA -:01C80000FF38 -:00000001FF diff --git a/tools/test_files/flash_one_byte_0xff_20480B.hex b/tools/test_files/flash_one_byte_0xff_20480B.hex deleted file mode 100644 index fc010281..00000000 --- a/tools/test_files/flash_one_byte_0xff_20480B.hex +++ /dev/null @@ -1,3 +0,0 @@ -:020000040000FA -:01140000FFEC -:00000001FF diff --git a/tools/test_files/flash_one_byte_0xff_2048B.hex b/tools/test_files/flash_one_byte_0xff_2048B.hex deleted file mode 100644 index 2372e248..00000000 --- a/tools/test_files/flash_one_byte_0xff_2048B.hex +++ /dev/null @@ -1,3 +0,0 @@ -:020000040000FA -:01020000FFFE -:00000001FF diff --git a/tools/test_files/flash_one_byte_0xff_262144B.hex b/tools/test_files/flash_one_byte_0xff_262144B.hex deleted file mode 100644 index b7866f30..00000000 --- a/tools/test_files/flash_one_byte_0xff_262144B.hex +++ /dev/null @@ -1,3 +0,0 @@ -:020000040001F9 -:01000000FF00 -:00000001FF diff --git a/tools/test_files/flash_one_byte_0xff_270336B.hex b/tools/test_files/flash_one_byte_0xff_270336B.hex deleted file mode 100644 index 2f7e6451..00000000 --- a/tools/test_files/flash_one_byte_0xff_270336B.hex +++ /dev/null @@ -1,3 +0,0 @@ -:020000040001F9 -:01080000FFF8 -:00000001FF diff --git a/tools/test_files/flash_one_byte_0xff_32768B.hex b/tools/test_files/flash_one_byte_0xff_32768B.hex deleted file mode 100644 index bbf220f0..00000000 --- a/tools/test_files/flash_one_byte_0xff_32768B.hex +++ /dev/null @@ -1,3 +0,0 @@ -:020000040000FA -:01200000FFE0 -:00000001FF diff --git a/tools/test_files/flash_one_byte_0xff_36864B.hex b/tools/test_files/flash_one_byte_0xff_36864B.hex deleted file mode 100644 index 75d0281b..00000000 --- a/tools/test_files/flash_one_byte_0xff_36864B.hex +++ /dev/null @@ -1,3 +0,0 @@ -:020000040000FA -:01240000FFDC -:00000001FF diff --git a/tools/test_files/flash_one_byte_0xff_401408B.hex b/tools/test_files/flash_one_byte_0xff_401408B.hex deleted file mode 100644 index 6ff2cf4d..00000000 --- a/tools/test_files/flash_one_byte_0xff_401408B.hex +++ /dev/null @@ -1,3 +0,0 @@ -:020000040001F9 -:01880000FF78 -:00000001FF diff --git a/tools/test_files/flash_one_byte_0xff_40960B.hex b/tools/test_files/flash_one_byte_0xff_40960B.hex deleted file mode 100644 index e6cb14c2..00000000 --- a/tools/test_files/flash_one_byte_0xff_40960B.hex +++ /dev/null @@ -1,3 +0,0 @@ -:020000040000FA -:01280000FFD8 -:00000001FF diff --git a/tools/test_files/flash_one_byte_0xff_4096B.hex b/tools/test_files/flash_one_byte_0xff_4096B.hex deleted file mode 100644 index 32ce277d..00000000 --- a/tools/test_files/flash_one_byte_0xff_4096B.hex +++ /dev/null @@ -1,3 +0,0 @@ -:020000040000FA -:01040000FFFC -:00000001FF diff --git a/tools/test_files/flash_one_byte_0xff_49152B.hex b/tools/test_files/flash_one_byte_0xff_49152B.hex deleted file mode 100644 index 24009753..00000000 --- a/tools/test_files/flash_one_byte_0xff_49152B.hex +++ /dev/null @@ -1,3 +0,0 @@ -:020000040000FA -:01300000FFD0 -:00000001FF diff --git a/tools/test_files/flash_one_byte_0xff_512B.hex b/tools/test_files/flash_one_byte_0xff_512B.hex deleted file mode 100644 index f6a9a764..00000000 --- a/tools/test_files/flash_one_byte_0xff_512B.hex +++ /dev/null @@ -1,3 +0,0 @@ -:020000040000FA -:01008000FF80 -:00000001FF diff --git a/tools/test_files/flash_one_byte_0xff_524288B.hex b/tools/test_files/flash_one_byte_0xff_524288B.hex deleted file mode 100644 index 9ed27666..00000000 --- a/tools/test_files/flash_one_byte_0xff_524288B.hex +++ /dev/null @@ -1,3 +0,0 @@ -:020000040002F8 -:01000000FF00 -:00000001FF diff --git a/tools/test_files/flash_one_byte_0xff_65536B.hex b/tools/test_files/flash_one_byte_0xff_65536B.hex deleted file mode 100644 index a42e27eb..00000000 --- a/tools/test_files/flash_one_byte_0xff_65536B.hex +++ /dev/null @@ -1,3 +0,0 @@ -:020000040000FA -:01400000FFC0 -:00000001FF diff --git a/tools/test_files/flash_one_byte_0xff_69632B.hex b/tools/test_files/flash_one_byte_0xff_69632B.hex deleted file mode 100644 index 66749c42..00000000 --- a/tools/test_files/flash_one_byte_0xff_69632B.hex +++ /dev/null @@ -1,3 +0,0 @@ -:020000040000FA -:01440000FFBC -:00000001FF diff --git a/tools/test_files/flash_one_byte_0xff_8192B.hex b/tools/test_files/flash_one_byte_0xff_8192B.hex deleted file mode 100644 index b1721926..00000000 --- a/tools/test_files/flash_one_byte_0xff_8192B.hex +++ /dev/null @@ -1,3 +0,0 @@ -:020000040000FA -:01080000FFF8 -:00000001FF diff --git a/tools/test_files/generate_test_hex.sh b/tools/test_files/generate_test_hex.sh index 0e6bc6a1..d7b3d2fc 100755 --- a/tools/test_files/generate_test_hex.sh +++ b/tools/test_files/generate_test_hex.sh @@ -39,8 +39,6 @@ for i in ${flashsizes[@]}; do -generate $((i-i/3)) $((i-i/4-2)) -repeat-data 0xff \ -generate $((i-i/4-1)) $((i-i/4)) -repeat-data 0xff \ -o holes_flash_0xff_${i}B.hex -Intel - # A file with a single 0xff byte - srec_cat -generate $((i/4)) $((i/4+1)) -repeat-data 0xff -o flash_one_byte_0xff_${i}B.hex -Intel done ### From 71a9cb47b3200e9f2e4eb016d4505dc71b464114 Mon Sep 17 00:00:00 2001 From: stefanrueger Date: Wed, 28 Feb 2024 23:27:38 +1300 Subject: [PATCH 12/12] Keep case of part in test-avrdude -b -p "-p part ..." --- tools/test-avrdude | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/test-avrdude b/tools/test-avrdude index 5a1ffd61..59c59425 100755 --- a/tools/test-avrdude +++ b/tools/test-avrdude @@ -233,7 +233,8 @@ exitstate=0 for (( p=0; p<$arraylength; p++ )); do # Isolate programmer and part (assumes -c prog or -cprog but not sth more tricky such as -qc prog) programmer=$(echo ${pgm_and_target[$p]} | sed 's/.* *-c *\([^ ]*\) *.*/\1/g' | tr A-Z a-z) - part=$(echo ${pgm_and_target[$p]} | sed 's/.* *-p *\([^ ]*\) *.*/\1/g' | tr A-Z a-z) + part=$(echo ${pgm_and_target[$p]} | sed 's/.* *-p *\([^ ]*\) *.*/\1/g') + lpart=$(echo $part | tr A-Z a-z) rest=$(echo ${pgm_and_target[$p]} | sed -e's/ *-[cpP] *[^ ]* */ /g' -e's/ */ /g') emulated=0 [[ "$programmer" == dryrun || "$programmer" == dryboot ]] && emulated=1 @@ -275,7 +276,7 @@ for (( p=0; p<$arraylength; p++ )); do # Should we test fuses? fusetest=1 - [[ -n "$part" && "${nofusetest[@]}" =~ -p"$part/" ]] && fusetest=0 + [[ -n "$lpart" && "${nofusetest[@]}" =~ -p"$lpart/" ]] && fusetest=0 # Should EEPROM test be carried out? check_eeprom=1