CPLD: Change tool interface to accept --xsvf and --hackrf-data args.
More args coming shortly...
This commit is contained in:
@ -27,7 +27,7 @@ include(../hackrf-common.cmake)
|
|||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${PATH_HACKRF_CPLD_DATA_C}
|
OUTPUT ${PATH_HACKRF_CPLD_DATA_C}
|
||||||
COMMAND ${PATH_CPLD_BITSTREAM_TOOL} --code ${PATH_HACKRF_CPLD_XSVF} >${PATH_HACKRF_CPLD_DATA_C}
|
COMMAND ${PATH_CPLD_BITSTREAM_TOOL} --xsvf ${PATH_HACKRF_CPLD_XSVF} --hackrf-data ${PATH_HACKRF_CPLD_DATA_C}
|
||||||
DEPENDS ${PATH_CPLD_BITSTREAM_TOOL} ${PATH_HACKRF_CPLD_XSVF}
|
DEPENDS ${PATH_CPLD_BITSTREAM_TOOL} ${PATH_HACKRF_CPLD_XSVF}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -151,10 +151,10 @@ import argparse
|
|||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
action_group = parser.add_mutually_exclusive_group(required=True)
|
action_group = parser.add_mutually_exclusive_group(required=True)
|
||||||
action_group.add_argument('--checksum', action='store_true', help='Calculate bitstream read-back CRC32 value')
|
action_group.add_argument('--checksum', action='store_true', help='Calculate bitstream read-back CRC32 value')
|
||||||
action_group.add_argument('--code', action='store_true', help='Generate C code for bitstream loading/programming/verification')
|
action_group.add_argument('--hackrf-data', type=str, help='C data file for HackRF bitstream loading/programming/verification')
|
||||||
parser.add_argument('--crcmod', action='store_true', help='Use Python crcmod library instead of built-in CRC32 code')
|
parser.add_argument('--crcmod', action='store_true', help='Use Python crcmod library instead of built-in CRC32 code')
|
||||||
parser.add_argument('--debug', action='store_true', help='Enable debug output')
|
parser.add_argument('--debug', action='store_true', help='Enable debug output')
|
||||||
parser.add_argument('hackrf_xc2c_cpld_xsvf', type=str, help='HackRF Xilinx XC2C64A CPLD XSVF file containing erase/program/verify phases')
|
parser.add_argument('--xsvf', required=True, type=str, help='HackRF Xilinx XC2C64A CPLD XSVF file containing erase/program/verify phases')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
@ -162,7 +162,7 @@ args = parser.parse_args()
|
|||||||
# against the CPLD.
|
# against the CPLD.
|
||||||
#######################################################################
|
#######################################################################
|
||||||
|
|
||||||
with open(args.hackrf_xc2c_cpld_xsvf, "rb") as f:
|
with open(args.xsvf, "rb") as f:
|
||||||
from xsvf import XSVFParser
|
from xsvf import XSVFParser
|
||||||
commands = XSVFParser().parse(f, debug=args.debug)
|
commands = XSVFParser().parse(f, debug=args.debug)
|
||||||
|
|
||||||
@ -202,7 +202,7 @@ if args.checksum:
|
|||||||
|
|
||||||
print('0x%s' % crc.hexdigest().lower())
|
print('0x%s' % crc.hexdigest().lower())
|
||||||
|
|
||||||
if args.code:
|
if args.hackrf_data:
|
||||||
program_sram = make_sram_program(program_blocks)
|
program_sram = make_sram_program(program_blocks)
|
||||||
verify_block = verify_blocks[1]
|
verify_block = verify_blocks[1]
|
||||||
verify_masks = tuple(frozenset(extract_mask(verify_block)))
|
verify_masks = tuple(frozenset(extract_mask(verify_block)))
|
||||||
@ -243,4 +243,5 @@ if args.code:
|
|||||||
'} };',
|
'} };',
|
||||||
'',
|
'',
|
||||||
))
|
))
|
||||||
print('\n'.join(result))
|
with open(args.hackrf_data, 'w') as f:
|
||||||
|
f.write('\n'.join(result))
|
||||||
|
Reference in New Issue
Block a user