diff --git a/litex/tools/litex_json2renode.py b/litex/tools/litex_json2renode.py index 21f2e25822..6f05b6ed3a 100755 --- a/litex/tools/litex_json2renode.py +++ b/litex/tools/litex_json2renode.py @@ -883,16 +883,22 @@ def generate_resc(csr, number_of_cores, args, flash_binaries={}, tftp_binaries={ """.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)) + result += f"cpu0 PC {hex(rom_base)}\n" + if args.tftp_ip: result += """ @@ -1049,6 +1055,8 @@ def parse_args(): help='Generate virtual network and connect it to host') parser.add_argument('--bios-binary', action='store', help='Path to the BIOS binary') + parser.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',