matcha/tock: switch to opentitan manifest image format
The manifest precedes the flash header and will eventually be used to
support secure boot.
Change-Id: Ib5162252244133125cda11c0ebdf421ded1b485b
diff --git a/platform/layout.ld b/platform/layout.ld
index 3334bfe..eeb90d0 100644
--- a/platform/layout.ld
+++ b/platform/layout.ld
@@ -5,6 +5,18 @@
ram (!rx) : ORIGIN = 0x10000000, LENGTH = 0x20000
}
+_manifest_code_start = _stext - ORIGIN(rom);
+/*
+ * The end of the .text section relative to the beginning of the associated slot
+ * for use in the manifest.
+ */
+_manifest_code_end = _etext - ORIGIN(rom);
+/*
+ * The location of the entry point relative to the beginning of the associated
+ * slot for use in the manifest.
+ */
+_manifest_entry_point = _start - ORIGIN(rom);
+
MPU_MIN_ALIGN = 1K;
SECTIONS {
/*
@@ -14,6 +26,14 @@
* versioning information to make it slightly easier to debug when the
* boot ROM and Tock are out of sync with respect to the definition...
*/
+ .manifest ORIGIN(rom) : {
+ . = . + 884; /* magic # comes from manifest.h */
+ LONG(_manifest_code_start);
+ LONG(_manifest_code_end);
+ LONG(_manifest_entry_point);
+ . = ALIGN(1024);
+ } > rom
+
.flash_header : {
LONG(_stext)
} > rom
diff --git a/platform/layout_debug.ld b/platform/layout_debug.ld
index 4ef628e..be2d087 100644
--- a/platform/layout_debug.ld
+++ b/platform/layout_debug.ld
@@ -8,6 +8,18 @@
ram (!rx) : ORIGIN = 0x10000000, LENGTH = 0x1000000
}
+_manifest_code_start = _stext - ORIGIN(rom);
+/*
+ * The end of the .text section relative to the beginning of the associated slot
+ * for use in the manifest.
+ */
+_manifest_code_end = _etext - ORIGIN(rom);
+/*
+ * The location of the entry point relative to the beginning of the associated
+ * slot for use in the manifest.
+ */
+_manifest_entry_point = _start - ORIGIN(rom);
+
MPU_MIN_ALIGN = 1K;
SECTIONS {
/*
@@ -17,6 +29,14 @@
* versioning information to make it slightly easier to debug when the
* boot ROM and Tock are out of sync with respect to the definition...
*/
+ .manifest ORIGIN(rom) : {
+ . = . + 884; /* magic # comes from manifest.h */
+ LONG(_manifest_code_start);
+ LONG(_manifest_code_end);
+ LONG(_manifest_entry_point);
+ . = ALIGN(1024);
+ } > rom
+
.flash_header : {
LONG(_stext)
} > rom