[test] Add rom_e2e_shutdown_exception_c test
Fixes 14274
Fixes 14492
Signed-off-by: Alphan Ulusoy <alphan@google.com>
diff --git a/sw/device/silicon_creator/rom/e2e/BUILD b/sw/device/silicon_creator/rom/e2e/BUILD
index efbc1bc..4376282 100644
--- a/sw/device/silicon_creator/rom/e2e/BUILD
+++ b/sw/device/silicon_creator/rom/e2e/BUILD
@@ -15,6 +15,37 @@
package(default_visibility = ["//visibility:public"])
opentitan_functest(
+ name = "rom_e2e_shutdown_exception_c",
+ srcs = ["rom_e2e_shutdown_exception_c_test.c"],
+ cw310 = cw310_params(
+ bitstream = "//hw/bitstream:rom",
+ # Note: This test never prints a failure message so it will fail only
+ # when it times out.
+ exit_failure = "NO_FAILURE_MESSAGE",
+ exit_success = "BFV:01495202(?s:.*)BFV:01495202",
+ ),
+ manifest = "//sw/device/silicon_creator/rom_ext:manifest_standard",
+ signed = True,
+ targets = [
+ "cw310",
+ "verilator",
+ ],
+ verilator = verilator_params(
+ timeout = "eternal",
+ exit_failure = "NO_FAILURE_MESSAGE",
+ exit_success = "BFV:01495202(?s:.*)BFV:01495202",
+ rom = "//sw/device/silicon_creator/rom",
+ ),
+ deps = [
+ "//hw/top_earlgrey/sw/autogen:top_earlgrey",
+ "//sw/device/silicon_creator/lib:manifest_def",
+ "//sw/device/silicon_creator/lib/base:static_critical_boot_measurements",
+ "//sw/device/silicon_creator/lib/base:static_critical_sec_mmio",
+ "//sw/device/silicon_creator/rom_ext:ld_slot_a",
+ ],
+)
+
+opentitan_functest(
name = "e2e_bootup_success",
srcs = ["empty_test.c"],
cw310 = cw310_params(
diff --git a/sw/device/silicon_creator/rom/e2e/rom_e2e_shutdown_exception_c_test.c b/sw/device/silicon_creator/rom/e2e/rom_e2e_shutdown_exception_c_test.c
new file mode 100644
index 0000000..8847926
--- /dev/null
+++ b/sw/device/silicon_creator/rom/e2e/rom_e2e_shutdown_exception_c_test.c
@@ -0,0 +1,21 @@
+// Copyright lowRISC contributors.
+// Licensed under the Apache License, Version 2.0, see LICENSE for details.
+// SPDX-License-Identifier: Apache-2.0
+
+#include "sw/device/silicon_creator/lib/manifest_def.h"
+
+#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"
+
+// Note: Since this test program is written to verify the behavior of the ROM C
+// exception handlers,
+// - it does not have a `.crt` section,
+// - its entrypoint `_rom_ext_start_boot()` is defined here and it doesn't have
+// a `rom_ext_main()` function, and
+// - it has has only the following sections:
+// - `.manifest`, to be able to boot this program from ROM,
+// - `.text`, only 2 instructions to trigger an instruction access fault, and
+// - `.static_critical`, required by the linker script.
+
+void _rom_ext_start_boot(void) {
+ ((void (*)(void))TOP_EARLGREY_SRAM_CTRL_MAIN_RAM_BASE_ADDR)();
+}