From f97efeb4005eb540b498a9e793ae79ccaa2b9d0a Mon Sep 17 00:00:00 2001 From: Daniel Beitel Date: Mon, 11 Mar 2024 12:12:08 +0900 Subject: [PATCH] [device/test_rom] Add bootstrap to second test rom Fix some SPI dpi corner cases. Fix Uart drain error. Signed-off-by: Daniel Beitel --- sw/device/lib/testing/test_rom/BUILD | 1 + sw/device/lib/testing/test_rom/test_second_rom.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/sw/device/lib/testing/test_rom/BUILD b/sw/device/lib/testing/test_rom/BUILD index 20dd02665e151..2b92f5c9c9c07 100644 --- a/sw/device/lib/testing/test_rom/BUILD +++ b/sw/device/lib/testing/test_rom/BUILD @@ -183,6 +183,7 @@ cc_library( "//hw/top_darjeeling/sw/autogen:top_darjeeling", "//sw/device/lib/testing/test_framework:check", "//sw/device/lib/testing/test_framework:status", + "//sw/device/silicon_creator/rom:bootstrap", "//sw/lib/sw/device/arch:device", "//sw/lib/sw/device/base:abs_mmio", "//sw/lib/sw/device/base:bitfield", diff --git a/sw/device/lib/testing/test_rom/test_second_rom.c b/sw/device/lib/testing/test_rom/test_second_rom.c index 0f2688e95f6f6..c10951e4bdab3 100644 --- a/sw/device/lib/testing/test_rom/test_second_rom.c +++ b/sw/device/lib/testing/test_rom/test_second_rom.c @@ -4,6 +4,7 @@ #include "sw/device/lib/testing/test_framework/check.h" #include "sw/device/lib/testing/test_framework/status.h" +#include "sw/device/silicon_creator/rom/bootstrap.h" #include "sw/ip/base/dif/dif_base.h" #include "sw/ip/clkmgr/dif/dif_clkmgr.h" #include "sw/ip/gpio/dif/dif_gpio.h" @@ -111,6 +112,20 @@ bool second_rom_test_main(void) { LOG_INFO("Jitter is enabled"); } + if (bootstrap_requested() == kHardenedBoolTrue) { + // This log statement is used to synchronize the rom and DV testbench + // for specific test cases. + LOG_INFO("Boot strap requested"); + + rom_error_t bootstrap_err = bootstrap(); + if (bootstrap_err != kErrorOk) { + LOG_ERROR("Bootstrap failed with status code: %08x", + (uint32_t)bootstrap_err); + // Currently the only way to recover is by a hard reset. + test_status_set(kTestStatusFailed); + } + } + _ottf_main(); // If the test image returns, we should abort anyway.