Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sw/device/silicon_creator/lib/rescue/dfu.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ enum {
* rescue mode.
*/
kUsbVendorGoogle = 0x18d1,
kUsbProuctRomExt = 0x023a,
kUsbProductRomExt = 0x023a,

/**
* A proprietary vendor request to set the DFU mode using a FourCC code
Expand Down
4 changes: 2 additions & 2 deletions sw/device/silicon_creator/lib/rescue/rescue_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ static const usb_device_descriptor_t device_desc = {
.device_protocol = 0,
.max_packet_size_0 = 64,
.vendor = kUsbVendorGoogle,
.product = kUsbProuctRomExt,
.product = kUsbProductRomExt,
.bcd_device = 0x100,
.imanufacturer = 1,
.iproduct = 2,
Expand All @@ -39,7 +39,7 @@ static const usb_device_descriptor_t device_desc = {
};

#define DFU_INTERFACE_DSCR(alt) \
USB_INTERFACE_DSCR(/*inum=*/1, /*alt=*/alt, /*nep=*/0, \
USB_INTERFACE_DSCR(/*inum=*/0, /*alt=*/alt, /*nep=*/0, \
/*class=*/kDfuDeviceClass, \
/*subclass=*/kDfuDeviceSubClass, \
/*protocol=*/kDfuDeviceProtocol, /*iint=*/4 + alt)
Expand Down
44 changes: 25 additions & 19 deletions sw/device/silicon_creator/rom_ext/e2e/rescue/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ _CONFIGS = {
for name, position in _POSITIONS.items()
]

# Important note: many of the tests in this file modify the owner
# configuration and/or expect an empty owner configuration when
# starting the test. Currently, the only way to clear this configuration
# is to clear the bitstream.

[
opentitan_test(
name = "rescue_firmware_{}_{}".format(name, protocol),
Expand All @@ -110,7 +115,7 @@ _CONFIGS = {
binaries = {
":boot_test_{}".format(name): "payload",
},
changes_otp = True,
changes_otp = True, # See important note at the top
params = config["params"],
rom_ext = config["rom_ext"],
setup = config["setup"],
Expand Down Expand Up @@ -171,7 +176,7 @@ genrule(
":boot_test_{}".format(name): "payload",
":bad_rom_ext": "bad_rom_ext",
},
changes_otp = True,
changes_otp = True, # See important note at the top
exit_failure = _RESCUE_ROMEXT_RESULTS[name == rxslot]["failure"],
exit_success = _RESCUE_ROMEXT_RESULTS[name == rxslot]["success"].format(slot = name),
image_name = "/tmp/rescue_rom_ext_{}.img".format(name),
Expand Down Expand Up @@ -211,7 +216,7 @@ genrule(
":boot_test_slot_a": "slot_a",
":boot_test_slot_b": "slot_b",
},
changes_otp = True,
changes_otp = True, # See important note at the top
params = config["params"],
rom_ext = config["rom_ext"],
setup = config["setup"],
Expand All @@ -221,6 +226,7 @@ genrule(
--exec="fpga clear-bitstream"
--exec="fpga load-bitstream {bitstream}"
--exec="bootstrap --clear-uart=true {firmware}"
--exec="console --non-interactive --timeout=100ms"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This improves slightly the output in case of error by making the console output available up until this point. I only did for this particular tests but this could be of interest in other tests

{setup}
--exec="no-op --info='##### Set next slot via the rescue protocol'"
--exec="rescue {params} boot-svc set-next-bl0-slot --next=SlotB --get-response=false"
Expand Down Expand Up @@ -250,7 +256,7 @@ genrule(
":boot_test_slot_a": "slot_a",
":boot_test_slot_b": "slot_b",
},
changes_otp = True,
changes_otp = True, # See important note at the top
params = config["params"],
rom_ext = config["rom_ext"],
setup = config["setup"],
Expand Down Expand Up @@ -292,7 +298,7 @@ genrule(
binaries = {
":boot_test_slot_a": "payload",
},
changes_otp = True,
changes_otp = True, # See important note at the top
rate = rate,
test_cmd = """
--exec="transport init"
Expand Down Expand Up @@ -327,7 +333,7 @@ genrule(
binaries = {
":boot_test_slot_a": "payload",
},
changes_otp = True,
changes_otp = True, # See important note at the top
rate = rate,
test_cmd = """
--exec="transport init"
Expand Down Expand Up @@ -368,7 +374,7 @@ opentitan_test(
binaries = {
":boot_test_slot_a": "payload",
},
changes_otp = True,
changes_otp = True, # See important note at the top
rom_ext = "//sw/device/silicon_creator/rom_ext/e2e/rescue/testdata:rom_ext_rescue_protocol_0",
test_cmd = """
--exec="transport init"
Expand All @@ -395,7 +401,7 @@ opentitan_test(
"//hw/top_earlgrey:fpga_cw340_rom_ext": None,
},
fpga = fpga_params(
changes_otp = True,
changes_otp = True, # See important note at the top
rom_ext = "//sw/device/silicon_creator/rom_ext:rom_ext_xmodem_timeout",
test_cmd = """
--exec="transport init"
Expand Down Expand Up @@ -437,7 +443,7 @@ opentitan_test(
"//hw/top_earlgrey:fpga_cw340_rom_ext": None,
},
fpga = fpga_params(
changes_otp = True,
changes_otp = True, # See important note at the top
# We configure OTP to preserve the reset reason and set the watchdog timeout
# to one second.
otp = "//sw/device/silicon_creator/rom_ext/e2e:otp_img_secret2_locked_preserve_reset_prod",
Expand Down Expand Up @@ -476,7 +482,7 @@ opentitan_test(
"//hw/top_earlgrey:fpga_cw340_rom_ext": None,
},
fpga = fpga_params(
changes_otp = True,
changes_otp = True, # See important note at the top
exit_failure = "ok: ",
exit_success = "error: mode not allowed",
rom_ext = "//sw/device/silicon_creator/rom_ext:rom_ext_xmodem_restricted_commands",
Expand Down Expand Up @@ -514,7 +520,7 @@ opentitan_test(
"//hw/top_earlgrey:fpga_cw340_rom_ext": None,
},
fpga = fpga_params(
changes_otp = True,
changes_otp = True, # See important note at the top
params = "-p spi-dfu -t gpio -v +Ioa2",
rom_ext = "//sw/device/silicon_creator/rom_ext:rom_ext_spidfu_restricted_commands",
setup = "--exec=\"gpio set --mode OpenDrain Ioa2\"",
Expand Down Expand Up @@ -546,7 +552,7 @@ opentitan_test(
},
fpga = fpga_params(
assemble = "",
changes_otp = True,
changes_otp = True, # See important note at the top
exit_success = "BFV:05525304\r\n",
rom_ext = config.get(
"alt_rom_ext",
Expand Down Expand Up @@ -579,7 +585,7 @@ opentitan_test(
},
fpga = fpga_params(
assemble = "",
changes_otp = True,
changes_otp = True, # See important note at the top
params = config["params"],
rom_ext = config["rom_ext"],
test_cmd = """
Expand All @@ -602,7 +608,7 @@ opentitan_test(
},
fpga = fpga_params(
assemble = "",
changes_otp = True,
changes_otp = True, # See important note at the top
device_id = DEVICE_ID,
params = config["params"],
rom_ext = config["rom_ext"],
Expand Down Expand Up @@ -631,7 +637,7 @@ opentitan_test(
config["rom_ext"]: "romext",
"//sw/device/silicon_creator/rom_ext/e2e/attestation:print_certs": "firmware",
},
changes_otp = True,
changes_otp = True, # See important note at the top
params = config["params"],
test_cmd = """
--clear-bitstream
Expand All @@ -656,7 +662,7 @@ opentitan_test(
"//sw/device/silicon_creator/rom_ext:rom_ext_xmodem_rescue_disability": "romext",
"//sw/device/silicon_creator/rom_ext/e2e/attestation:print_certs": "firmware",
},
changes_otp = True,
changes_otp = True, # See important note at the top
test_cmd = """
--clear-bitstream
--bootstrap={firmware}
Expand All @@ -678,7 +684,7 @@ opentitan_test(
"//sw/device/silicon_creator/rom_ext:rom_ext_spidfu_rescue_disability": "romext",
"//sw/device/silicon_creator/rom_ext/e2e/attestation:print_certs": "firmware",
},
changes_otp = True,
changes_otp = True, # See important note at the top
params = "-p spi-dfu -t gpio -v +Ioa2",
test_cmd = """
--clear-bitstream
Expand Down Expand Up @@ -884,7 +890,7 @@ opentitan_test(
"//hw/top_earlgrey:fpga_cw340_rom_ext": None,
},
fpga = fpga_params(
changes_otp = True,
changes_otp = True, # See important note at the top
exit_failure = "(FAIL|BFV:|mode: RESQ).*",
rom_ext = "//sw/device/silicon_creator/rom_ext:rom_ext_dice_x509_slot_a",
test_cmd = """
Expand Down Expand Up @@ -917,7 +923,7 @@ opentitan_test(
"//hw/top_earlgrey:fpga_cw340_rom_ext": None,
},
fpga = fpga_params(
changes_otp = True,
changes_otp = True, # See important note at the top
exit_success = "mode: RESQ",
rom_ext = "//sw/device/silicon_creator/rom_ext:rom_ext_xmodem_enter_on_watchdog",
test_cmd = """
Expand Down
Loading