summaryrefslogtreecommitdiff
path: root/riscv/platform_main.ml
diff options
context:
space:
mode:
Diffstat (limited to 'riscv/platform_main.ml')
-rw-r--r--riscv/platform_main.ml14
1 files changed, 13 insertions, 1 deletions
diff --git a/riscv/platform_main.ml b/riscv/platform_main.ml
index 6014e7a9..e0032bf8 100644
--- a/riscv/platform_main.ml
+++ b/riscv/platform_main.ml
@@ -51,18 +51,30 @@
open Elf_loader
open Sail_lib
open Riscv
+module P = Platform_impl
(* OCaml driver for generated RISC-V model. *)
let opt_file_arguments = ref ([] : string list)
-let options = Arg.align []
+let opt_dump_dts = ref false
+let opt_dump_dtb = ref false
+
+let options = Arg.align ([("-dump-dts",
+ Arg.Set opt_dump_dts,
+ " dump the platform device-tree source to stdout");
+ ("-dump-dtb",
+ Arg.Set opt_dump_dtb,
+ " dump the *binary* platform device-tree blob to stdout");
+ ])
let usage_msg = "RISC-V platform options:"
let elf_arg =
Arg.parse options (fun s -> opt_file_arguments := !opt_file_arguments @ [s])
usage_msg;
+ if !opt_dump_dts then (P.dump_dts (); exit 0);
+ if !opt_dump_dtb then (P.dump_dtb (); exit 0);
( match !opt_file_arguments with
| f :: _ -> prerr_endline ("Sail/RISC-V: running ELF file " ^ f); f
| _ -> (prerr_endline "Please provide an ELF file."; exit 0)