Software APIs
rom_ext_upgrade_test.c
1 // Copyright lowRISC contributors (OpenTitan project).
2 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
3 // SPDX-License-Identifier: Apache-2.0
4 
5 #include <stdbool.h>
6 
9 #include "sw/device/silicon_creator/lib/boot_data.h"
10 #include "sw/device/silicon_creator/lib/drivers/lifecycle.h"
11 #include "sw/device/silicon_creator/lib/drivers/otp.h"
12 #include "sw/device/silicon_creator/lib/drivers/rstmgr.h"
13 #include "sw/device/silicon_creator/lib/manifest_def.h"
14 
15 #include "otp_ctrl_regs.h"
16 
17 OTTF_DEFINE_TEST_CONFIG();
18 
19 bool test_main(void) {
21  RETURN_IF_ERROR(boot_data_read(lifecycle_state_get(), &boot_data));
22  LOG_INFO("ROM_EXT booted min_security_version_rom_ext:%d",
25  RETURN_IF_ERROR(boot_data_write(&boot_data));
26  RETURN_IF_ERROR(boot_data_read(kLcStateProd, &boot_data));
27  LOG_INFO("Upgraded min_security_version_rom_ext:%d",
29  LOG_INFO("Resetting...");
30  rstmgr_reset();
32  return true;
33 }