[Cryptech-Commits] [sw/stm32] 01/02: Speed up file upload enormously.

git at cryptech.is git at cryptech.is
Thu Feb 23 22:45:03 UTC 2017


This is an automated email from the git hooks/post-receive script.

paul at psgd.org pushed a commit to branch ksng
in repository sw/stm32.

commit 4398d7ecdf432a2211a9d93deaedb721648dbb15
Author: Paul Selkirk <paul at psgd.org>
AuthorDate: Thu Feb 23 16:58:17 2017 -0500

    Speed up file upload enormously.
    
    We need to start with a long serial timeout, in order to catch the reboot
    messages for a firmware upload (this has to be done through the bootloader).
    But once we start sending the file, cut the serial timeout to 1ms. (I've
    tested it down to 1us, but that may not work for everyone, and it doesn't
    improve performance in a statistically significant way.)
    
    This brings the time to upload a 4.5MB bitstream from 38:23 to 1:25.
---
 projects/hsm/cryptech_upload | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/projects/hsm/cryptech_upload b/projects/hsm/cryptech_upload
index b41f25b..b6d2554 100755
--- a/projects/hsm/cryptech_upload
+++ b/projects/hsm/cryptech_upload
@@ -181,6 +181,7 @@ def send_file(src, size, args, dst):
         print("Device did not accept the upload command (got {!r})".format(response))
         return False
 
+    dst.timeout = 0.001
     crc = 0
     counter = 0
     # 1. Write size of file (4 bytes)
@@ -284,7 +285,7 @@ def main():
         print "Uploading {} from {}".format(name, args.firmware_tarball.name)
 
     print "Initializing serial port and synchronizing with HSM, this may take a few seconds"
-    dst  = serial.Serial(args.device, 921600, timeout = 2)
+    dst  = serial.Serial(args.device, 921600, timeout = 1)
     send_file(src, size, args, dst)
     dst.close()
 



More information about the Commits mailing list