Skip to content

Commit 2f4b66a

Browse files
cfrantzpamaury
authored andcommitted
[rom_ext_e2e] Test ROM_EXT reboots with preserved reset reasons
Test that the ROM_EXT clears `PowerOnReset` when it reboots so that it preserves any boot_svc message sent to itself. Signed-off-by: Chris Frantz <[email protected]> (cherry picked from commit a9d9c94)
1 parent 28e278a commit 2f4b66a

File tree

2 files changed

+64
-0
lines changed
  • sw/device/silicon_creator/rom_ext/e2e

2 files changed

+64
-0
lines changed

sw/device/silicon_creator/rom_ext/e2e/BUILD

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@
22
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
33
# SPDX-License-Identifier: Apache-2.0
44

5+
load(
6+
"//rules:const.bzl",
7+
"CONST",
8+
)
59
load(
610
"//rules:otp.bzl",
711
"STD_OTP_OVERLAYS",
12+
"otp_hex",
813
"otp_image",
914
"otp_json",
1015
"otp_partition",
@@ -43,3 +48,24 @@ otp_image(
4348
":otp_json_secret2_locked",
4449
],
4550
)
51+
52+
otp_json(
53+
name = "otp_json_reset_reason",
54+
partitions = [
55+
otp_partition(
56+
name = "OWNER_SW_CFG",
57+
items = {
58+
"OWNER_SW_CFG_ROM_PRESERVE_RESET_REASON_EN": otp_hex(CONST.HARDENED_TRUE),
59+
},
60+
),
61+
],
62+
)
63+
64+
otp_image(
65+
name = "otp_img_secret2_locked_preserve_reset_rma",
66+
src = "//hw/ip/otp_ctrl/data:otp_json_rma",
67+
overlays = STD_OTP_OVERLAYS + [
68+
":otp_json_secret2_locked",
69+
":otp_json_reset_reason",
70+
],
71+
)

sw/device/silicon_creator/rom_ext/e2e/rescue/BUILD

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,44 @@ opentitan_test(
328328
],
329329
)
330330

331+
opentitan_test(
332+
name = "rescue_inactivity_timeout_preserved_reset_reason",
333+
srcs = [
334+
"//sw/device/silicon_creator/rom_ext/e2e/verified_boot:boot_test",
335+
],
336+
exec_env = {
337+
"//hw/top_earlgrey:fpga_hyper310_rom_ext": None,
338+
},
339+
fpga = fpga_params(
340+
changes_otp = True,
341+
# We configure OTP to preserve the reset reason. This tests that the
342+
# ROM_EXT clears power-on-reset before rebooting so that the ROM wont
343+
# re-scramble ret-ram and destroy the 'skip_once' request.
344+
otp = "//sw/device/silicon_creator/rom_ext/e2e:otp_img_secret2_locked_preserve_reset_rma",
345+
# We use the spidfu rom_ext because we can trigger with a GPIO and we
346+
# want to simulate the trigger being jammed.
347+
rom_ext = "//sw/device/silicon_creator/rom_ext:rom_ext_spidfu",
348+
test_cmd = """
349+
--exec="transport init"
350+
--exec="fpga clear-bitstream"
351+
--exec="fpga load-bitstream {bitstream}"
352+
--exec="bootstrap --clear-uart=true {firmware}"
353+
# Set the trigger with gpio command to simulate the trigger being jammed.
354+
--exec="gpio set --mode PushPull --value true Ioa2"
355+
# Check for firmware execution. We'll enter rescue, timeout,
356+
# then reboot and execute firmware.
357+
--exec="console --non-interactive --exit-success='{exit_success}' --exit-failure='{exit_failure}'"
358+
no-op
359+
""",
360+
),
361+
deps = [
362+
"//sw/device/lib/base:status",
363+
"//sw/device/lib/testing/test_framework:ottf_main",
364+
"//sw/device/silicon_creator/lib:boot_log",
365+
"//sw/device/silicon_creator/lib/drivers:retention_sram",
366+
],
367+
)
368+
331369
# Check that xmodem rescue is functional when the `RESQ` mode is disabled.
332370
opentitan_test(
333371
name = "xmodem_restricted_commands",

0 commit comments

Comments
 (0)