aboutsummaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2016-08-01 18:49:22 -0700
committerMartin Braun <martin.braun@ettus.com>2016-08-01 18:49:22 -0700
commit3df0f6e9e4b2784c7c23a566a34391b9629d32c1 (patch)
tree3b050febb23a25ea5279b21628684b1ff92ee970 /firmware
parentutils: Added querying a sensor to uhd_usrp_probe (diff)
parentcmake: "make uninstall" now removes symlinks (CMake 2.8.1 and above) (diff)
downloaduhd-3df0f6e9e4b2784c7c23a566a34391b9629d32c1.tar.xz
uhd-3df0f6e9e4b2784c7c23a566a34391b9629d32c1.zip
Merge branch 'maint'
Conflicts: host/lib/usrp/dboard/db_wbx_version2.cpp host/lib/usrp/dboard/db_wbx_version3.cpp
Diffstat (limited to 'firmware')
-rwxr-xr-xfirmware/fx2/utils/build_eeprom.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/firmware/fx2/utils/build_eeprom.py b/firmware/fx2/utils/build_eeprom.py
index 76502b923..9180bf1a0 100755
--- a/firmware/fx2/utils/build_eeprom.py
+++ b/firmware/fx2/utils/build_eeprom.py
@@ -45,8 +45,8 @@ def build_eeprom_image (filename, rev):
the EZ-USB FX2 Technical Reference Manual
"""
# get the code we want to run
- f = open(filename, 'rb')
- bytes = f.read()
+ with open(filename, 'rb') as f:
+ out_bytes = f.read()
devid = 4 #for compatibility
start_addr = 0 #prove me wrong
@@ -72,8 +72,8 @@ def build_eeprom_image (filename, rev):
# 4 byte header that indicates where to load
# the immediately follow code bytes.
code_header = [
- msb (len (bytes)),
- lsb (len (bytes)),
+ msb (len (out_bytes)),
+ lsb (len (out_bytes)),
msb (start_addr),
lsb (start_addr)
]
@@ -87,7 +87,7 @@ def build_eeprom_image (filename, rev):
0x00
]
- image = rom_header + code_header + [ord(c) for c in bytes] + trailer
+ image = rom_header + code_header + [ord(c) for c in out_bytes] + trailer
assert (len (image) <= 256)
return image
@@ -111,6 +111,6 @@ if __name__ == '__main__':
image = "".join(chr(c) for c in build_eeprom_image(infile, options.rev))
- f = open(outfile, 'wb')
- f.write(str(image))
- f.close()
+ # Opening in binary mode -> why converting image to str
+ with open(outfile, 'wb') as f:
+ f.write( str(image) ) \ No newline at end of file