Skip to content

Commit a5651b6

Browse files
committed
[bazel,qemu] Enable SPI console with TX indicator test for QEMU
Enables the `ottf_console_with_gpio_tx_indicator` test target for the QEMU execution environment, as this test exercises functionality that is required to be supported for provisioning flows. As QEMU does not currently implement the relevant Pinmux connections between OpenTitan and GPIO, a minor extension is made to the test to allow users to optionally specify which GPIO pin should be used as the ready-indicator, rather than hardcoding to IOA5. This is then overriden for the QEMU execution environment only. Signed-off-by: Alex Jones <[email protected]>
1 parent cea4066 commit a5651b6

File tree

2 files changed

+15
-1
lines changed
  • sw
    • device/tests
    • host/tests/chip/ottf_console_with_gpio_tx_indicator/src

2 files changed

+15
-1
lines changed

sw/device/tests/BUILD

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4382,6 +4382,7 @@ opentitan_test(
43824382
exec_env = {
43834383
"//hw/top_earlgrey:fpga_hyper310_rom_with_fake_keys": None,
43844384
"//hw/top_earlgrey:fpga_cw340_rom_with_fake_keys": None,
4385+
"//hw/top_earlgrey:sim_qemu_rom_with_fake_keys": None,
43854386
},
43864387
fpga = fpga_params(
43874388
# We run this as part of the manuf test suite as we want to run it in
@@ -4397,6 +4398,14 @@ opentitan_test(
43974398
""",
43984399
test_harness = "//sw/host/tests/chip/ottf_console_with_gpio_tx_indicator",
43994400
),
4401+
qemu = qemu_params(
4402+
test_cmd = """
4403+
--bootstrap="{firmware}"
4404+
"{firmware:elf}"
4405+
--console-tx-indicator-pin=0
4406+
""",
4407+
test_harness = "//sw/host/tests/chip/ottf_console_with_gpio_tx_indicator",
4408+
),
44004409
deps = [
44014410
"//hw/top_earlgrey/sw/autogen:top_earlgrey",
44024411
"//sw/device/lib/runtime:hart",

sw/host/tests/chip/ottf_console_with_gpio_tx_indicator/src/main.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,17 @@ struct Opts {
3434
/// Path to the firmware's ELF file, for querying symbol addresses.
3535
#[arg(value_name = "FIRMWARE_ELF")]
3636
firmware_elf: PathBuf,
37+
38+
/// Name of the SPI interface to connect to the OTTF console.
39+
#[arg(long, default_value = "IOA5")]
40+
console_tx_indicator_pin: String,
3741
}
3842

3943
fn spi_device_console_test(opts: &Opts, transport: &TransportWrapper) -> Result<()> {
4044
// Setup the SPI console with the GPIO TX indicator pin.
4145
let spi = transport.spi(&opts.console_spi)?;
42-
let device_console_tx_ready_pin = &transport.gpio_pin("IOA5")?;
46+
let device_console_tx_ready_pin =
47+
&transport.gpio_pin(opts.console_tx_indicator_pin.as_str())?;
4348
device_console_tx_ready_pin.set_mode(PinMode::Input)?;
4449
device_console_tx_ready_pin.set_pull_mode(PullMode::None)?;
4550
let spi_console_device = SpiConsoleDevice::new(

0 commit comments

Comments
 (0)