8 #include "sw/device/lib/base/status.h"
10 #include "sw/device/lib/testing/test_framework/check.h"
12 #include "sw/device/silicon_creator/lib/drivers/otp.h"
13 #include "sw/device/silicon_creator/lib/drivers/retention_sram.h"
14 #include "sw/device/silicon_creator/lib/drivers/uart.h"
18 OTTF_DEFINE_TEST_CONFIG();
21 kImmutableRomExtSectionHashSizeIn32BitWords =
22 OTP_CTRL_PARAM_CREATOR_SW_CFG_IMMUTABLE_ROM_EXT_SHA256_HASH_SIZE /
24 kSramValuePass = 0x53534150,
30 const uint64_t kStr1 = 0x6c626174756d6d49;
32 const uint32_t kStr2 = 0x65;
33 const uint32_t kNewline = 0x0a0d;
34 uart_write_imm(kStr1);
35 uart_write_imm(kStr2);
36 uart_write_imm(kNewline);
39 while (!uart_tx_idle()) {
49 uint32_t immutable_rom_ext_section_enabled =
50 otp_read32(OTP_CTRL_PARAM_CREATOR_SW_CFG_IMMUTABLE_ROM_EXT_EN_OFFSET);
51 LOG_INFO(
"Immutable ROM_EXT Enable OTP: 0x%08x",
52 immutable_rom_ext_section_enabled);
54 "Immutable ROM_EXT Start Offset OTP: 0x%08x",
56 OTP_CTRL_PARAM_CREATOR_SW_CFG_IMMUTABLE_ROM_EXT_START_OFFSET_OFFSET));
57 LOG_INFO(
"Immutable ROM_EXT Length OTP: 0x%08x",
59 OTP_CTRL_PARAM_CREATOR_SW_CFG_IMMUTABLE_ROM_EXT_LENGTH_OFFSET));
60 uint32_t immutable_rom_ext_hash[kImmutableRomExtSectionHashSizeIn32BitWords];
61 otp_read(OTP_CTRL_PARAM_CREATOR_SW_CFG_IMMUTABLE_ROM_EXT_SHA256_HASH_OFFSET,
62 immutable_rom_ext_hash, kImmutableRomExtSectionHashSizeIn32BitWords);
64 "Immutable ROM_EXT Section Hash OTP: 0x%08x%08x%08x%08x%08x%08x%08x%08x",
65 immutable_rom_ext_hash[7], immutable_rom_ext_hash[6],
66 immutable_rom_ext_hash[5], immutable_rom_ext_hash[4],
67 immutable_rom_ext_hash[3], immutable_rom_ext_hash[2],
68 immutable_rom_ext_hash[1], immutable_rom_ext_hash[0]);
75 OTP_CTRL_PARAM_CREATOR_SW_CFG_IMMUTABLE_ROM_EXT_START_OFFSET_OFFSET) ==
81 CHECK(retention_sram_get()->owner.reserved[0] == kSramValuePass);