Skip to content

Commit

Permalink
Merge pull request espressif#45 "write_flash: Show actual flash write…
Browse files Browse the repository at this point in the history
… speed"

With minor modifications to overwrite last status line, print write
offset in completion line.
  • Loading branch information
projectgus committed Sep 2, 2015
2 parents 582a7ca + 0a836e0 commit 765cf23
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion esptool.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,8 @@ def div_roundup(a, b):
blocks = div_roundup(len(image), esp.ESP_FLASH_BLOCK)
esp.flash_begin(blocks*esp.ESP_FLASH_BLOCK, address)
seq = 0
written = 0
t = time.time()
while len(image) > 0:
print '\rWriting at 0x%08x... (%d %%)' % (address + seq*esp.ESP_FLASH_BLOCK, 100*(seq+1)/blocks),
sys.stdout.flush()
Expand All @@ -597,7 +599,9 @@ def div_roundup(a, b):
esp.flash_block(block, seq)
image = image[esp.ESP_FLASH_BLOCK:]
seq += 1
print
written += len(block)
t = time.time() - t
print '\rWrote %d bytes at 0x%08x in %.1f seconds (%.1f kbit/s)...' % (written, address, t, written / t * 8 / 1000)
print '\nLeaving...'
if args.flash_mode == 'dio':
esp.flash_unlock_dio()
Expand Down

0 comments on commit 765cf23

Please sign in to comment.