-
Notifications
You must be signed in to change notification settings - Fork 721
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[sw/silicon_creator] Add structured kChipInfo to ROM
This commit adds a new `chip_info_t` struct that contains info about the ROM's provenance. The ROM now prints the Git commit hash on shutdown after the "VER:" prefix. The ROM linker script was already configured to place the .chip_info section at the top of ROM, but I'm not confident that it worked as expected. The autogenerated header contained a static constant, so I think a copy would be inlined at some arbitrary location into any compilation unit that used it, rather than being placed by the linker script. To verify that the ROM prints the Git commit hash on shutdown: ./bazelisk.sh test --test_output=streamed \ //sw/device/silicon_creator/rom/e2e:shutdown_output_dev_fpga_cw310_rom To verify that the .chip_info section contains data from chip_info.o: ./bazelisk.sh build-then 'less %s' --config riscv32 \ //sw/device/silicon_creator/rom:rom_with_fake_keys_fpga_cw310_map To see the value of `kChipInfo` at the end of ROM: ./bazelisk.sh build-then 'xxd %s | less' --config riscv32 \ //sw/device/silicon_creator/rom:rom_with_fake_keys_fpga_cw310_bin For example, here's the end of the ROM from the previous command. Note that it contains 32 bits of a git commit hash starting at 0x7f80, followed by a human-readable timestamp. ... 00007f70: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 00007f80: e3fe 72cd 3230 3233 2d30 342d 3230 2031 ..r.2023-04-20 1 00007f90: 363a 3533 3a34 3800 6:53:48. Issue #14892 Signed-off-by: Dan McArdle <dmcardle@opentitan.org>
- Loading branch information
Showing
9 changed files
with
115 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright lowRISC contributors. | ||
// Licensed under the Apache License, Version 2.0, see LICENSE for details. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#ifndef OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_CHIP_INFO_H_ | ||
#define OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_CHIP_INFO_H_ | ||
|
||
#include <assert.h> | ||
#include <stdint.h> | ||
|
||
typedef struct chip_info { | ||
uint32_t scm_revision; | ||
char build_date_str[20]; | ||
} chip_info_t; | ||
|
||
// This struct contains information about the ROM's provenance, and critically, | ||
// it can be manually decoded from a hexdump. The linker script should place | ||
// this at the top of the ROM. | ||
extern const chip_info_t kChipInfo __attribute__((section(".chip_info"))); | ||
|
||
// Set an arbitrary upper bound on the size of `kChipInfo` to prevent future | ||
// additions from wasting space in the ROM. | ||
static_assert(sizeof(kChipInfo) <= 32u, "Size of kChipInfo exceeds budget."); | ||
|
||
#endif // OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_CHIP_INFO_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters