mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-22 07:21:06 +00:00
chipset: update helper scripts to python3
This commit is contained in:
parent
f58c0c23eb
commit
c9921182ab
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
# BlueKitchen GmbH (c) 2012-2014
|
# BlueKitchen GmbH (c) 2012-2014
|
||||||
|
|
||||||
# documentation for TI Vendor Specific commands:
|
# documentation for TI Vendor Specific commands:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
# BlueKitchen GmbH (c) 2019
|
# BlueKitchen GmbH (c) 2019
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
@ -66,7 +66,7 @@ if len(sys.argv) != 2:
|
|||||||
prs_file = sys.argv[1]
|
prs_file = sys.argv[1]
|
||||||
fout = sys.stdout
|
fout = sys.stdout
|
||||||
|
|
||||||
with open (prs_file, 'rb') as fin:
|
with open (prs_file, 'rt') as fin:
|
||||||
for line_with_nl in fin:
|
for line_with_nl in fin:
|
||||||
line = line_with_nl.strip()
|
line = line_with_nl.strip()
|
||||||
if line.startswith('&'):
|
if line.startswith('&'):
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
# BlueKitchen GmbH (c) 2012-2014
|
# BlueKitchen GmbH (c) 2012-2014
|
||||||
|
|
||||||
# avr-objcopy -I ihex -O binary hci_581_active_uart.hex hci_581_active_uart.bin
|
# avr-objcopy -I ihex -O binary hci_581_active_uart.hex hci_581_active_uart.bin
|
||||||
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
from intelhex import IntelHex
|
from intelhex import IntelHex
|
||||||
import glob
|
import glob
|
||||||
|
import sys
|
||||||
|
|
||||||
usage = '''This script converts the HCI Firmware in .hex format for Dialog Semiconductor
|
usage = '''This script converts the HCI Firmware in .hex format for Dialog Semiconductor
|
||||||
into C files to be used with BTstack.
|
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):
|
def convert_hex(basename):
|
||||||
hex_name = basename + '.hex'
|
hex_name = basename + '.hex'
|
||||||
print ('Reading %s' % hex_name)
|
print('Reading %s' % hex_name)
|
||||||
ih = IntelHex(hex_name)
|
ih = IntelHex(hex_name)
|
||||||
# f = open(basename + '.txt', 'w') # open file for writing
|
# f = open(basename + '.txt', 'w') # open file for writing
|
||||||
# ih.dump(f) # dump to file object
|
# ih.dump(f) # dump to file object
|
||||||
# f.close() # close file
|
# f.close() # close file
|
||||||
size = ih.maxaddr() - ih.minaddr() + 1
|
size = ih.maxaddr() - ih.minaddr() + 1
|
||||||
print '- Start: %x' % ih.minaddr()
|
print('- Start: %x' % ih.minaddr())
|
||||||
print '- End: %x' % ih.maxaddr()
|
print('- End: %x' % ih.maxaddr())
|
||||||
|
|
||||||
with open(basename + '.h', 'w') as fout:
|
with open(basename + '.h', 'w') as fout:
|
||||||
fout.write(header.replace('BASENAME',basename));
|
fout.write(header.replace('BASENAME',basename));
|
||||||
@ -66,7 +67,7 @@ def convert_hex(basename):
|
|||||||
fout.write(' ')
|
fout.write(' ')
|
||||||
for i in range(0,size):
|
for i in range(0,size):
|
||||||
if i % 1000 == 0:
|
if i % 1000 == 0:
|
||||||
print ('- Write %05u/%05u' % (i, size))
|
print('- Write %05u/%05u' % (i, size))
|
||||||
byte = ih[ih.minaddr() + i]
|
byte = ih[ih.minaddr() + i]
|
||||||
fout.write("0x{0:02x}, ".format(byte))
|
fout.write("0x{0:02x}, ".format(byte))
|
||||||
if (i & 0x0f) == 0x0f:
|
if (i & 0x0f) == 0x0f:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
# BlueKitchen GmbH (c) 2018
|
# BlueKitchen GmbH (c) 2018
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ def convert_emp(basename):
|
|||||||
for i in range(0,size):
|
for i in range(0,size):
|
||||||
if i % 1000 == 0:
|
if i % 1000 == 0:
|
||||||
print ('- Write %05u/%05u' % (i, size))
|
print ('- Write %05u/%05u' % (i, size))
|
||||||
byte = ord(firm[i])
|
byte = firm[i]
|
||||||
fout.write("0x{0:02x}, ".format(byte))
|
fout.write("0x{0:02x}, ".format(byte))
|
||||||
if (i & 0x0f) == 0x0f:
|
if (i & 0x0f) == 0x0f:
|
||||||
fout.write('\n ')
|
fout.write('\n ')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user