chipset: update helper scripts to python3

This commit is contained in:
Matthias Ringwald 2020-08-10 16:20:51 +02:00
parent f58c0c23eb
commit c9921182ab
4 changed files with 11 additions and 10 deletions

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# BlueKitchen GmbH (c) 2012-2014
# documentation for TI Vendor Specific commands:

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# BlueKitchen GmbH (c) 2019
import sys
@ -66,7 +66,7 @@ if len(sys.argv) != 2:
prs_file = sys.argv[1]
fout = sys.stdout
with open (prs_file, 'rb') as fin:
with open (prs_file, 'rt') as fin:
for line_with_nl in fin:
line = line_with_nl.strip()
if line.startswith('&'):

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# BlueKitchen GmbH (c) 2012-2014
# avr-objcopy -I ihex -O binary hci_581_active_uart.hex hci_581_active_uart.bin
@ -8,6 +8,7 @@
from intelhex import IntelHex
import glob
import sys
usage = '''This script converts the HCI Firmware in .hex format for Dialog Semiconductor
into C files to be used with BTstack.
@ -49,14 +50,14 @@ const uint32_t da14581_fw_size = sizeof(da14581_fw_data);
def convert_hex(basename):
hex_name = basename + '.hex'
print ('Reading %s' % hex_name)
print('Reading %s' % hex_name)
ih = IntelHex(hex_name)
# f = open(basename + '.txt', 'w') # open file for writing
# ih.dump(f) # dump to file object
# f.close() # close file
size = ih.maxaddr() - ih.minaddr() + 1
print '- Start: %x' % ih.minaddr()
print '- End: %x' % ih.maxaddr()
print('- Start: %x' % ih.minaddr())
print('- End: %x' % ih.maxaddr())
with open(basename + '.h', 'w') as fout:
fout.write(header.replace('BASENAME',basename));
@ -66,7 +67,7 @@ def convert_hex(basename):
fout.write(' ')
for i in range(0,size):
if i % 1000 == 0:
print ('- Write %05u/%05u' % (i, size))
print('- Write %05u/%05u' % (i, size))
byte = ih[ih.minaddr() + i]
fout.write("0x{0:02x}, ".format(byte))
if (i & 0x0f) == 0x0f:

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# BlueKitchen GmbH (c) 2018
import sys
@ -70,7 +70,7 @@ def convert_emp(basename):
for i in range(0,size):
if i % 1000 == 0:
print ('- Write %05u/%05u' % (i, size))
byte = ord(firm[i])
byte = firm[i]
fout.write("0x{0:02x}, ".format(byte))
if (i & 0x0f) == 0x0f:
fout.write('\n ')