diff options
| author | Prashanth Mundkur | 2018-06-22 15:16:33 -0700 |
|---|---|---|
| committer | Prashanth Mundkur | 2018-06-22 17:46:59 -0700 |
| commit | c3b10065d3918be2d63cf12612ac00b59b02640b (patch) | |
| tree | fe4064375189fcc05cc6daef7de5a6f8f8f02c8a /riscv/platform_main.ml | |
| parent | d50d0283aa85abf3911fc57fc9b3f2f1900e067a (diff) | |
Add cli options to riscv simulator to dump platform device-tree info.
Diffstat (limited to 'riscv/platform_main.ml')
| -rw-r--r-- | riscv/platform_main.ml | 14 |
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) |
