diff --git a/litex/tools/litex_json2renode.py b/litex/tools/litex_json2renode.py index 21f2e2582..0f83b5e76 100755 --- a/litex/tools/litex_json2renode.py +++ b/litex/tools/litex_json2renode.py @@ -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',