aboutsummaryrefslogtreecommitdiffstats
path: root/firmware/x300/bin_to_coe.py
diff options
context:
space:
mode:
authorBen Hilburn <ben.hilburn@ettus.com>2014-02-04 11:04:07 -0800
committerBen Hilburn <ben.hilburn@ettus.com>2014-02-04 11:04:07 -0800
commit178ac3f1c9950d383c8f64b3df464c0f943c4a23 (patch)
tree318ed621a7b59b7d34d4ce6e4a92f73f0bcef509 /firmware/x300/bin_to_coe.py
parent2718ac110fa931cc29daf7cb3dc5ab6230ee02ab (diff)
downloaduhd-178ac3f1c9950d383c8f64b3df464c0f943c4a23.tar.gz
uhd-178ac3f1c9950d383c8f64b3df464c0f943c4a23.tar.bz2
uhd-178ac3f1c9950d383c8f64b3df464c0f943c4a23.zip
Merging USRP X300 and X310 support!!
Diffstat (limited to 'firmware/x300/bin_to_coe.py')
-rwxr-xr-xfirmware/x300/bin_to_coe.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/firmware/x300/bin_to_coe.py b/firmware/x300/bin_to_coe.py
new file mode 100755
index 000000000..332c705ae
--- /dev/null
+++ b/firmware/x300/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)]) + ';')