Merge #135

135: cargo: Add support for building OpenTitan apps r=alistair23 a=alistair23

This fixes https://github.com/tock/libtock-rs/issues/134 and adds support for building OT apps,

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>

Co-authored-by: Alistair Francis <alistair.francis@wdc.com>
diff --git a/.cargo/config b/.cargo/config
index 818ce68..98ba621 100644
--- a/.cargo/config
+++ b/.cargo/config
@@ -13,6 +13,13 @@
   "-D", "warnings",
 ]
 
+[target.riscv32imc-unknown-none-elf]
+rustflags = [
+  "-C", "link-arg=-Topentitan_layout.ld",
+  "-C", "relocation-model=static",
+  "-D", "warnings",
+]
+
 # Target configuration for the travis CI Linux build
 [target.x86_64-unknown-linux-gnu]
 rustflags = [
diff --git a/opentitan_layout.ld b/opentitan_layout.ld
new file mode 100644
index 0000000..d2d09ba
--- /dev/null
+++ b/opentitan_layout.ld
@@ -0,0 +1,17 @@
+/* Layout for the RISC-V 32 boards, used by the examples in this repository. */
+
+MEMORY {
+  /* The TBF header region is 32 bytes (0x20) */
+  FLASH (rx) : ORIGIN = 0x20030020, LENGTH = 32M
+  SRAM (rwx) : ORIGIN = 0x10000000, LENGTH = 512K
+}
+
+/*
+ * Any change to STACK_SIZE should be accompanied by a corresponding change to
+ * `elf2tab`'s `--stack` option
+ */
+STACK_SIZE = 2048;
+
+MPU_MIN_ALIGN = 1K;
+
+INCLUDE layout.ld