artiq_flash: fix bit2bin

This commit is contained in:
Sebastien Bourdeauducq 2022-03-05 22:43:25 +08:00
parent ec893222a4
commit 7dafdfe2f7
1 changed files with 1 additions and 4 deletions

View File

@ -280,10 +280,7 @@ def main():
def convert_gateware(bit_filename):
bin_handle, bin_filename = tempfile.mkstemp(
prefix="artiq_", suffix="_" + os.path.basename(bit_filename))
with open(bit_filename, "rb") as bit_file, \
open(bin_handle, "wb") as bin_file:
if header:
bin_file.write(b"\x00"*8)
with open(bit_filename, "rb") as bit_file, open(bin_handle, "wb") as bin_file:
bit2bin(bit_file, bin_file)
atexit.register(lambda: os.unlink(bin_filename))
return bin_filename