soc_core: add integrated-rom-file parameter to allow initializing rom from command...
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Fri, 8 Nov 2019 22:27:58 +0000 (23:27 +0100)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Fri, 8 Nov 2019 22:32:10 +0000 (23:32 +0100)
litex/soc/integration/soc_core.py

index 6539be8d18559fbb0cf4921d8352d43a01609626..7f674b51a598954eb28987eff4684c1a1a87924b 100644 (file)
@@ -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)