Skip to content

Commit 4d77037

Browse files
committed
[rom,e2e] Add a test for the chip_info
The chip_info became broken without anyone realizing because it was untested. This test ensures that at least the chip info is filled and has the expected version. Signed-off-by: Amaury Pouly <[email protected]>
1 parent 9a50583 commit 4d77037

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

sw/device/silicon_creator/rom/e2e/BUILD

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,3 +472,16 @@ opentitan_test(
472472
"//sw/device/silicon_creator/lib/drivers:rstmgr",
473473
],
474474
)
475+
476+
opentitan_test(
477+
name = "rom_e2e_chip_info",
478+
srcs = ["chip_info_test.c"],
479+
exec_env = {
480+
"//hw/top_earlgrey:fpga_cw310_rom_with_fake_keys": None,
481+
"//hw/top_earlgrey:fpga_cw340_rom_with_fake_keys": None,
482+
},
483+
deps = [
484+
"//sw/device/lib/testing/test_framework:ottf_main",
485+
"//sw/device/silicon_creator/lib:chip_info",
486+
],
487+
)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
7+
#include "sw/device/lib/testing/test_framework/ottf_main.h"
8+
#include "sw/device/silicon_creator/lib/chip_info.h"
9+
10+
OTTF_DEFINE_TEST_CONFIG();
11+
12+
bool test_main(void) {
13+
chip_info_t *chip_info = (chip_info_t *)&_chip_info_start;
14+
LOG_INFO("Chip Info");
15+
LOG_INFO(" Version: %x", chip_info->version);
16+
LOG_INFO(" SCM lo: %x", chip_info->scm_revision.scm_revision_low);
17+
LOG_INFO(" SCM hi: %x", chip_info->scm_revision.scm_revision_high);
18+
19+
return chip_info->version == kChipInfoVersion1;
20+
}

0 commit comments

Comments
 (0)