Skip to content

Commit

Permalink
write_flash: Show actual flash write speed.
Browse files Browse the repository at this point in the history
There're various reports of various port baud speeds non-working (or
working), show actual write speed should provide more insight into
that.
  • Loading branch information
pfalcon committed Jul 20, 2015
1 parent 043f928 commit 0a836e0
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 @@ -558,6 +558,8 @@ def arg_auto_int(x):
blocks = math.ceil(len(image)/float(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 @@ -570,7 +572,9 @@ def arg_auto_int(x):
esp.flash_block(block, seq)
image = image[esp.ESP_FLASH_BLOCK:]
seq += 1
print
written += len(block)
t = time.time() - t
print '\nWritten %d bytes in %.2f seconds (%.2f kbit/s)...' % (written, t, written / t * 8 / 1000)
print '\nLeaving...'
if args.flash_mode == 'dio':
esp.flash_unlock_dio()
Expand Down

0 comments on commit 0a836e0

Please sign in to comment.