diff options
author | Martin Braun <martin.braun@ettus.com> | 2016-08-01 18:49:22 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2016-08-01 18:49:22 -0700 |
commit | 3df0f6e9e4b2784c7c23a566a34391b9629d32c1 (patch) | |
tree | 3b050febb23a25ea5279b21628684b1ff92ee970 /firmware | |
parent | 031839052be29825e4d28b341dfc98abc9d1a903 (diff) | |
parent | 4503c7e6287e4204af946c9aa6e669f76c9b8289 (diff) | |
download | uhd-3df0f6e9e4b2784c7c23a566a34391b9629d32c1.tar.gz uhd-3df0f6e9e4b2784c7c23a566a34391b9629d32c1.tar.bz2 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-x | firmware/fx2/utils/build_eeprom.py | 16 |
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 |