diff --git a/builder/src/firmware.rs b/builder/src/firmware.rs index 189d84e276..bd454d2266 100644 --- a/builder/src/firmware.rs +++ b/builder/src/firmware.rs @@ -15,118 +15,48 @@ pub fn rom_from_env() -> &'static FwId<'static> { } } -#[cfg(feature = "hw-latest")] -pub const ROM: FwId = FwId { - crate_name: "caliptra-rom", - bin_name: "caliptra-rom", - features: &["hw-latest"], -}; - -#[cfg(not(feature = "hw-latest"))] pub const ROM: FwId = FwId { crate_name: "caliptra-rom", bin_name: "caliptra-rom", features: &[], }; -#[cfg(feature = "hw-latest")] -pub const ROM_WITH_UART: FwId = FwId { - crate_name: "caliptra-rom", - bin_name: "caliptra-rom", - features: &["emu", "hw-latest"], -}; - -#[cfg(not(feature = "hw-latest"))] pub const ROM_WITH_UART: FwId = FwId { crate_name: "caliptra-rom", bin_name: "caliptra-rom", features: &["emu"], }; -#[cfg(feature = "hw-latest")] -pub const ROM_FAKE_WITH_UART: FwId = FwId { - crate_name: "caliptra-rom", - bin_name: "caliptra-rom", - features: &["emu", "fake-rom", "hw-latest"], -}; - -#[cfg(not(feature = "hw-latest"))] pub const ROM_FAKE_WITH_UART: FwId = FwId { crate_name: "caliptra-rom", bin_name: "caliptra-rom", features: &["emu", "fake-rom"], }; -#[cfg(feature = "hw-latest")] -pub const FMC_WITH_UART: FwId = FwId { - crate_name: "caliptra-fmc", - bin_name: "caliptra-fmc", - features: &["emu", "hw-latest"], -}; - -#[cfg(not(feature = "hw-latest"))] pub const FMC_WITH_UART: FwId = FwId { crate_name: "caliptra-fmc", bin_name: "caliptra-fmc", features: &["emu"], }; -#[cfg(feature = "hw-latest")] -pub const FMC_FAKE_WITH_UART: FwId = FwId { - crate_name: "caliptra-fmc", - bin_name: "caliptra-fmc", - features: &["emu", "fake-fmc", "hw-latest"], -}; - -#[cfg(not(feature = "hw-latest"))] pub const FMC_FAKE_WITH_UART: FwId = FwId { crate_name: "caliptra-fmc", bin_name: "caliptra-fmc", features: &["emu", "fake-fmc"], }; -#[cfg(feature = "hw-latest")] -pub const APP: FwId = FwId { - crate_name: "caliptra-runtime", - bin_name: "caliptra-runtime", - features: &["fips_self_test", "hw-latest"], -}; - -#[cfg(not(feature = "hw-latest"))] pub const APP: FwId = FwId { crate_name: "caliptra-runtime", bin_name: "caliptra-runtime", features: &["fips_self_test"], }; -#[cfg(feature = "hw-latest")] -pub const APP_WITH_UART: FwId = FwId { - crate_name: "caliptra-runtime", - bin_name: "caliptra-runtime", - features: &["emu", "test_only_commands", "fips_self_test", "hw-latest"], -}; - -#[cfg(not(feature = "hw-latest"))] pub const APP_WITH_UART: FwId = FwId { crate_name: "caliptra-runtime", bin_name: "caliptra-runtime", features: &["emu", "test_only_commands", "fips_self_test"], }; -#[cfg(feature = "hw-latest")] -pub const APP_WITH_UART_FPGA: FwId = FwId { - crate_name: "caliptra-runtime", - bin_name: "caliptra-runtime", - features: &[ - "emu", - "test_only_commands", - "fips_self_test", - "fpga_realtime", - "hw-latest", - ], -}; - -#[cfg(not(feature = "hw-latest"))] pub const APP_WITH_UART_FPGA: FwId = FwId { crate_name: "caliptra-runtime", bin_name: "caliptra-runtime", @@ -151,20 +81,12 @@ pub mod caliptra_builder_tests { pub mod hw_model_tests { use super::*; - #[cfg(not(feature = "hw-latest"))] const BASE_FWID: FwId = FwId { crate_name: "caliptra-hw-model-test-fw", bin_name: "", features: &["emu"], }; - #[cfg(feature = "hw-latest")] - const BASE_FWID: FwId = FwId { - crate_name: "caliptra-hw-model-test-fw", - bin_name: "", - features: &["emu", "hw-latest"], - }; - pub const MAILBOX_RESPONDER: FwId = FwId { bin_name: "mailbox_responder", ..BASE_FWID diff --git a/builder/src/lib.rs b/builder/src/lib.rs index 5faa9b01b5..60b5b5963c 100644 --- a/builder/src/lib.rs +++ b/builder/src/lib.rs @@ -183,6 +183,14 @@ pub fn build_firmware_elfs_uncached<'a>( cmd.arg("--config") .arg("target.'cfg(all())'.rustflags = [\"-Dwarnings\"]"); } + + if cfg!(feature = "hw-latest") { + if !features_csv.is_empty() { + features_csv.push(','); + } + features_csv.push_str("hw-latest"); + } + cmd.arg("build") .arg("--quiet") .arg("--locked")