summaryrefslogtreecommitdiff
path: root/riscv
diff options
context:
space:
mode:
authorPrashanth Mundkur2018-10-23 15:17:22 -0700
committerPrashanth Mundkur2018-10-23 15:45:09 -0700
commit1e7b116842ea0e0ad76a70e2736398ef2211dde9 (patch)
tree32147929c1cf633e26a7b71e46e8952648bd98a2 /riscv
parent852929bb8b47993bcb642ada41802383a308c9c2 (diff)
RISC-V: use stderr for terminal output in OCaml backend.
Also add a brief README for booting Linux on the C and OCaml backends.
Diffstat (limited to 'riscv')
-rw-r--r--riscv/README23
-rw-r--r--riscv/platform_impl.ml2
2 files changed, 24 insertions, 1 deletions
diff --git a/riscv/README b/riscv/README
new file mode 100644
index 00000000..b925821e
--- /dev/null
+++ b/riscv/README
@@ -0,0 +1,23 @@
+Booting Linux with the C backend:
+---------------------------------
+
+The C model needs an ELF-version of the BBL (Berkeley-Boot-Loader) that contains
+the Linux kernel as an embedded payload. It also needs a DTB (device-tree blob)
+file describing the platform. Once those are available, the model should be run
+as:
+
+$ ./riscv_sim -b spike.dtb bbl > execution-trace.log 2>&1 &
+$ tail -f term.log
+
+The term.log file contains the console boot messages.
+
+
+Booting Linux with the OCaml backend:
+-------------------------------------
+
+The OCaml model only needs the ELF-version of the BBL, since it can generate its
+own DTB.
+
+$ ./platform bbl > execution-trace.log
+
+The console output is sent to stderr.
diff --git a/riscv/platform_impl.ml b/riscv/platform_impl.ml
index e593dce9..c5cc3fff 100644
--- a/riscv/platform_impl.ml
+++ b/riscv/platform_impl.ml
@@ -159,7 +159,7 @@ let make_dtb dts = (* Call the dtc compiler, assumed to be at /usr/bin/dtc *)
(* Terminal I/O *)
let term_write char =
- ignore (Unix.write_substring Unix.stdout (String.make 1 char) 0 1)
+ ignore (Unix.write_substring Unix.stderr (String.make 1 char) 0 1)
let rec term_read () =
let buf = Bytes.make 1 '\000' in