You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
trezor-firmware/bootloader/firmware_align.py

12 lines
237 B

#!/usr/bin/env python
import sys
import os
fn = sys.argv[1]
fs = os.stat(fn).st_size
if fs > 32768:
raise Exception('bootloader has to be smaller than 32768 bytes')
with open(fn, 'ab') as f:
f.write(b'\xFF' * (32768 - fs))
f.close()