diff options
author | Claire Xen <claire@clairexen.net> | 2021-08-30 16:01:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-30 16:01:56 +0200 |
commit | b93cb16bb09e42c3469b01dcc6e08d8ef7700525 (patch) | |
tree | f188ec2231e4c7baf44a9150a1e447ef3ed91d04 /iceprog | |
parent | c495861c19bd0976c88d4964f912abe76f3901c3 (diff) | |
parent | 549fd314a0ce6b966dae6bfcd77fb855c55d03fa (diff) | |
download | icestorm-b93cb16bb09e42c3469b01dcc6e08d8ef7700525.tar.gz icestorm-b93cb16bb09e42c3469b01dcc6e08d8ef7700525.tar.bz2 icestorm-b93cb16bb09e42c3469b01dcc6e08d8ef7700525.zip |
Merge pull request #276 from esden/progress
iceprog: Add write and read progress indication.
Diffstat (limited to 'iceprog')
-rw-r--r-- | iceprog/iceprog.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/iceprog/iceprog.c b/iceprog/iceprog.c index b04fe65..c5243b9 100644 --- a/iceprog/iceprog.c +++ b/iceprog/iceprog.c @@ -966,10 +966,14 @@ int main(int argc, char **argv) rc = fread(buffer, 1, page_size, f); if (rc <= 0) break; + fprintf(stderr, " \r"); + fprintf(stderr, "addr 0x%06X %3ld%%\r", rw_offset + addr, addr / (file_size / 100)); flash_write_enable(); flash_prog(rw_offset + addr, buffer, rc); flash_wait(); } + fprintf(stderr, " \r"); + fprintf(stderr, "done.\n"); /* seek to the beginning for second pass */ fseek(f, 0, SEEK_SET); @@ -984,9 +988,13 @@ int main(int argc, char **argv) fprintf(stderr, "reading..\n"); for (int addr = 0; addr < read_size; addr += 256) { uint8_t buffer[256]; + fprintf(stderr, " \r"); + fprintf(stderr, "addr 0x%06X %3d%%\r", rw_offset + addr, addr / (read_size / 100)); flash_read(rw_offset + addr, buffer, 256); fwrite(buffer, read_size - addr > 256 ? 256 : read_size - addr, 1, f); } + fprintf(stderr, " \r"); + fprintf(stderr, "done.\n"); } else if (!erase_mode && !disable_verify) { fprintf(stderr, "reading..\n"); for (int addr = 0; true; addr += 256) { @@ -994,6 +1002,8 @@ int main(int argc, char **argv) int rc = fread(buffer_file, 1, 256, f); if (rc <= 0) break; + fprintf(stderr, " \r"); + fprintf(stderr, "addr 0x%06X %3ld%%\r", rw_offset + addr, addr / (file_size / 100)); flash_read(rw_offset + addr, buffer_flash, rc); if (memcmp(buffer_file, buffer_flash, rc)) { fprintf(stderr, "Found difference between flash and file!\n"); @@ -1001,6 +1011,7 @@ int main(int argc, char **argv) } } + fprintf(stderr, " \r"); fprintf(stderr, "VERIFY OK\n"); } |