[silicon_owner/bare_metal] cleanup boot test
This cleans up the bare_metal boot test by making use of the newly added
`opentitan_multislot_flash_binary` macro.
This partially addresses #13511.
Signed-off-by: Timothy Trippel <ttrippel@google.com>
diff --git a/rules/opentitan.bzl b/rules/opentitan.bzl
index 9601f62..875c10d 100644
--- a/rules/opentitan.bzl
+++ b/rules/opentitan.bzl
@@ -42,7 +42,7 @@
"fpga_cw310": ["@//sw/device/lib/arch:fpga_cw310"],
}
-# Default keys used to sign ROM_EXT and Owner images for testing.
+# Default keys used to sign ROM_EXT and BL0 images for testing.
DEFAULT_SIGNING_KEYS = {
"test_key_0": "@//sw/device/silicon_creator/rom/keys:test_private_key_0",
}
@@ -780,9 +780,10 @@
This macro is mostly a wrapper around the `assemble_flash_image` rule, that
invokes `opentitantool` to stitch together multiple `opentitan_flash_binary`
- images to create a single image for bootstrapping. This enables efficient
- testing by only requiring one boostrap operation to load both silicon
- creator and owner stages of flash.
+ images to create a single image for bootstrapping. Since bootstrap erases
+ the flash for programming this is the only way to load multiple
+ (A/B/Virtual) slots and (silicon creator, ROM_EXT, and owner, BL0) stages at
+ the same time.
Args:
@param name: The name of this rule.
@param srcs: A dictionary of `opentitan_flash_binary` targets (to stitch
diff --git a/sw/device/silicon_owner/bare_metal/BUILD b/sw/device/silicon_owner/bare_metal/BUILD
index 33d173b..228c8d2 100644
--- a/sw/device/silicon_owner/bare_metal/BUILD
+++ b/sw/device/silicon_owner/bare_metal/BUILD
@@ -2,9 +2,13 @@
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
-load("//rules:manifest.bzl", "CONST", "manifest")
-load("//rules:opentitan.bzl", "opentitan_flash_binary")
load("//rules:linker.bzl", "ld_library")
+load("//rules:manifest.bzl", "CONST", "manifest")
+load(
+ "//rules:opentitan.bzl",
+ "opentitan_flash_binary",
+ "opentitan_multislot_flash_binary",
+)
load("//rules:opentitan_test.bzl", "cw310_params", "opentitan_functest")
ld_library(
@@ -104,39 +108,31 @@
],
)
-# TODO(#13511): This is a temporary workaround until #13511 is resolved.
-genrule(
- name = "rom_ext_virt_a_owner_virt_a_fpga_cw310_bin_signed_test_key_0",
- srcs = [
- "//sw/device/silicon_creator/rom_ext:rom_ext_slot_virtual_fpga_cw310_bin_signed_test_key_0",
- ":bare_metal_slot_virtual_fpga_cw310_bin_signed_test_key_0",
- ],
- outs = ["rom_ext_virt_a_owner_virt_a_fpga_cw310.test_key_0.signed.bin"],
- cmd = "./$(location //sw/host/opentitantool) image assemble --mirror false --output $@ --size 0x11000 " +
- "$(location //sw/device/silicon_creator/rom_ext:rom_ext_slot_virtual_fpga_cw310_bin_signed_test_key_0)@0 " +
- "$(location :bare_metal_slot_virtual_fpga_cw310_bin_signed_test_key_0)@0x10000",
- tools = ["//sw/host/opentitantool"],
-)
-
-filegroup(
- name = "rom_ext_virt_a_owner_virt_a_fpga_cw310",
- srcs = [":rom_ext_virt_a_owner_virt_a"],
-)
-
-filegroup(
- name = "rom_ext_virt_a_owner_virt_a",
- srcs = ["rom_ext_virt_a_owner_virt_a_fpga_cw310.test_key_0.signed.bin"],
+opentitan_multislot_flash_binary(
+ name = "rom_ext_virtual_bare_metal_virtual",
+ srcs = {
+ "//sw/device/silicon_creator/rom_ext:rom_ext_slot_virtual": {
+ "key": "test_key_0",
+ "offset": "0x0",
+ },
+ ":bare_metal_slot_virtual": {
+ "key": "test_key_0",
+ "offset": "0x10000",
+ },
+ },
+ image_size = "0x11000",
)
BOOT_SUCCESS_MSG = "Bare metal PASS!"
opentitan_functest(
- name = "e2e_rom_ext_virt_a_owner_virt_a",
+ name = "rom_ext_virtual_bare_metal_virtual_boot_test",
cw310 = cw310_params(
bitstream = "//hw/bitstream:rom",
exit_success = BOOT_SUCCESS_MSG,
),
- ot_flash_binary = ":rom_ext_virt_a_owner_virt_a",
+ key = "multislot",
+ ot_flash_binary = ":rom_ext_virtual_bare_metal_virtual",
signed = True,
targets = ["cw310"],
)