Skip to content

Commit

Permalink
- Revert changes in firmware.rs
Browse files Browse the repository at this point in the history
- Add the hw-latest feature selection in build_firmware_elfs_uncached.
  • Loading branch information
rusty1968 authored and jhand2 committed Mar 21, 2024
1 parent 32ba420 commit ec78696
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 78 deletions.
78 changes: 0 additions & 78 deletions builder/src/firmware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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
Expand Down
8 changes: 8 additions & 0 deletions builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit ec78696

Please sign in to comment.