From 5bd58bc309e959537e3e820abfa39ee629b140a5 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Tue, 7 Oct 2014 09:39:25 +0200 Subject: Reorganized firmware/ subdirectory (x300->usrp3, zpu->usrp2) --- firmware/usrp3/utils/bin_to_coe.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 firmware/usrp3/utils/bin_to_coe.py (limited to 'firmware/usrp3/utils') diff --git a/firmware/usrp3/utils/bin_to_coe.py b/firmware/usrp3/utils/bin_to_coe.py new file mode 100755 index 000000000..332c705ae --- /dev/null +++ b/firmware/usrp3/utils/bin_to_coe.py @@ -0,0 +1,18 @@ +#!/usr/bin/python + +import sys +import binascii + +if __name__ == '__main__': + bin_file = sys.argv[1] + coe_file = sys.argv[2] + + #parse bin file into hex lines + h = binascii.hexlify(open(bin_file).read()) + '0'*7 + d = [h[i*8:(i+1)*8] for i in range(len(h)/8)] + + #write output coe file + out = open(coe_file, 'w') + out.write('memory_initialization_radix=16;\n') + out.write('memory_initialization_vector=\n') + out.write(',\n'.join([h[i*8:(i+1)*8] for i in range(len(h)/8)]) + ';') -- cgit v1.2.3