From 05e8abfee3dc01895368f8dd60087f2a107a37f8 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Fri, 8 Nov 2019 23:27:58 +0100 Subject: [PATCH] soc_core: add integrated-rom-file parameter to allow initializing rom from command line --- litex/soc/integration/soc_core.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/litex/soc/integration/soc_core.py b/litex/soc/integration/soc_core.py index 6539be8d1..7f674b51a 100644 --- a/litex/soc/integration/soc_core.py +++ b/litex/soc/integration/soc_core.py @@ -540,6 +540,8 @@ def soc_core_args(parser): # ROM parameters parser.add_argument("--integrated-rom-size", default=None, type=int, help="size/enable the integrated (BIOS) ROM") + parser.add_argument("--integrated-rom-file", default=None, type=str, + help="integrated (BIOS) ROM binary file") # SRAM parameters parser.add_argument("--integrated_sram_size", default=None, help="size/enable the integrated SRAM") @@ -574,6 +576,10 @@ def soc_core_args(parser): def soc_core_argdict(args): r = dict() + rom_file = getattr(args, "integrated_rom_file", None) + if rom_file is not None: + args.integrated_rom_init = get_mem_data(rom_file, "little") # FIXME: endianness + args.integrated_rom_size = len(args.integrated_rom_init)*4 for a in inspect.getargspec(SoCCore.__init__).args: if a not in ["self", "platform"]: arg = getattr(args, a, None)