# HG changeset patch # User Mychaela Falconia # Date 1582614088 0 # Node ID 97fe41e9242ad3f308b13b4d8aa5bd1cb1442ec2 # Parent 4be92bcd15351e7f9165464eaf5b5305101ac3bc fc-loadtool: added operation time reporting to flash program-m0 diff -r 4be92bcd1535 -r 97fe41e9242a loadtools/flprogsrec.c --- a/loadtools/flprogsrec.c Tue Feb 25 02:43:05 2020 +0000 +++ b/loadtools/flprogsrec.c Tue Feb 25 07:01:28 2020 +0000 @@ -7,6 +7,7 @@ #include #include #include +#include #include "flash.h" #include "srecreader.h" @@ -20,6 +21,8 @@ char *targv[4], shortarg[10], longarg[513]; int resp; unsigned long rec_count; + time_t start_time, finish_time; + unsigned duration, mm, ss; if (flash_detect(bank, 0) < 0) return(-1); @@ -64,9 +67,10 @@ "Warning: S0 record found in line %d of %s (expected in line 1 only)\n", srr.lineno, srr.filename); continue; - } else if (srr.record_type == '7') + } else if (srr.record_type == '7') { + time(&finish_time); break; - else if (srr.record_type != '3') { + } else if (srr.record_type != '3') { fprintf(stderr, "Warning: unsupported S%c record type in line %d of %s\n", srr.record_type, srr.lineno, srr.filename); @@ -99,8 +103,10 @@ fclose(srr.openfile); return(-1); } - if (!rec_count) + if (!rec_count) { printf("Programming flash, each \'.\' is 100 S-records\n"); + time(&start_time); + } sprintf(shortarg, "%lx", (u_long) srr.addr); build_flashw_hex_string(srr.record + 5, longarg, srr.datalen >> 1, is_m0); @@ -128,7 +134,10 @@ srr.filename, srr.lineno); return(-1); } - printf("\nProgramming complete\n"); + duration = finish_time - start_time; + mm = duration / 60; + ss = duration - mm * 60; + printf("\nOperation completed in %um%us\n", mm, ss); return(0); }