aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Selkirk <paul@psgd.org>2017-02-23 16:58:17 -0500
committerPaul Selkirk <paul@psgd.org>2017-02-23 16:58:17 -0500
commit4398d7ecdf432a2211a9d93deaedb721648dbb15 (patch)
treef9f6e8d33ff74a340e57c04d12283e72d9829ad0
parent189df371631a2b7bef91803d449e47470ad6a7bf (diff)
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.
-rwxr-xr-xprojects/hsm/cryptech_upload3
1 files changed, 2 insertions, 1 deletions
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()