X-Git-Url: http://git.code-monkey.de/?p=gps-watch.git;a=blobdiff_plain;f=tools%2Fupdate-firmware;h=cd711241ab3858d6e62cb366b1d376549ae48f47;hp=f610343f37c8ba1fb672b73e49ac37c2fde44841;hb=defaea09b33884a4dd17f89e11c7a565605ae2d2;hpb=727108edeb96e0b534c86d52ad3f7515b26c1798 diff --git a/tools/update-firmware b/tools/update-firmware index f610343..cd71124 100755 --- a/tools/update-firmware +++ b/tools/update-firmware @@ -168,6 +168,13 @@ class Application: sys.stderr.write('File too large.\n') return 3 + # The bootloader only accepts chunks whose size is word-aligned: + num_extra = len(chunks[-1]) & 3 + + if num_extra != 0: + num_pad = 4 - extra + chunks[-1] += b'\xff' * num_pad + # Defaulting to zero seems too dangerous: if self._offset is None: sector0 = None