summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlasdair Armstrong2018-06-21 19:02:06 +0100
committerAlasdair Armstrong2018-06-21 19:19:28 +0100
commit7ef0bba057d634f7596f94000233cd36ebdd2fff (patch)
tree58a9a429e16096f3afedb75179bdb06b666a9572 /src
parent2005eb7c190f8d28d6499df3dd77cf65a87e60cb (diff)
Add command line option support for Sail->C compiled models
For example, the MIPS model can boot FreeBSD as ./mips_c --binary=0x100000,/path/to/kernel --image=/path/to/simboot.sailbin Or with short options as ./mips_c -b 0x100000,/path/to/kernel -i /path/to/simboot.sailbin The current options are: -e, --elf, which loads an elf file directly -n, --entry, which sets the entry point -i, --image, which loads an image file compiled by "sail -elf" using Linksem -b, --binary, which loads a plain binary image into memory at a specific address -l, --cyclelimit, which means the (new) cycle_count() builtin exits the model after a certain number of calls Also there are the default -? --help and --usage options.
Diffstat (limited to 'src')
-rw-r--r--src/c_backend.ml4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/c_backend.ml b/src/c_backend.ml
index f58dd71f..450e5f5d 100644
--- a/src/c_backend.ml
+++ b/src/c_backend.ml
@@ -3374,8 +3374,8 @@ let compile_ast ctx (Defs defs) =
let postamble = separate hardline (List.map string
( [ "int main(int argc, char *argv[])";
"{";
- " if (argc > 1) { load_image(argv[1]); }";
- " setup_rts();" ]
+ " setup_rts();";
+ " if (process_arguments(argc, argv)) exit(EXIT_FAILURE);" ]
@ fst exn_boilerplate
@ startup cdefs
@ List.concat (List.map (fun r -> fst (register_init_clear r)) regs)