Merge pull request #1786 from motec-research/json2renode

litex_json2renode: fix --bios-binary and add --opensbi-binary
This commit is contained in:
AndrewD 2023-09-30 12:41:58 +10:00 committed by GitHub
commit e8689eb1dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 6 deletions

View File

@ -883,16 +883,23 @@ showAnalyzer sysbus.uart Antmicro.Renode.Analyzers.LoggingUartAnalyzer
""".format(cpu_type, args.repl)
opensbi_base = csr['memories']['opensbi']['base'] if 'opensbi' in csr['memories'] else None
if opensbi_base is not None and args.bios_binary:
# load LiteX BIOS to ROM
if opensbi_base is not None and args.opensbi_binary:
# load OpenSBI to opensbi base
result += """
sysbus LoadBinary @{} {}
""".format(args.bios_binary, hex(opensbi_base))
if opensbi_base:
""".format(args.opensbi_binary, hex(opensbi_base))
for cpu_id in range(0, number_of_cores):
result += f"cpu{cpu_id} PC {hex(opensbi_base)}\n"
rom_base = csr['memories']['rom']['base'] if 'rom' in csr['memories'] else None
if rom_base is not None and args.bios_binary:
# load LiteX BIOS to ROM base
result += """
sysbus LoadBinary @{} {}
""".format(args.bios_binary, hex(rom_base))
for cpu_id in range(0, number_of_cores):
result += f"cpu{cpu_id} PC {hex(rom_base)}\n"
if args.tftp_ip:
result += """
@ -1047,8 +1054,12 @@ def parse_args():
help='Output platform definition file')
parser.add_argument('--configure-network', action='store',
help='Generate virtual network and connect it to host')
parser.add_argument('--bios-binary', action='store',
bios_group = parser.add_mutually_exclusive_group()
bios_group.add_argument('--bios-binary', action='store',
help='Path to the BIOS binary')
bios_group.add_argument('--opensbi-binary', action='store',
help='Path to the OpenSBI binary')
parser.add_argument('--firmware-binary', action='store',
help='Path to the binary to load into boot flash')
parser.add_argument('--flash-binary', action='append', dest='flash_binaries_args',