Skip to content

Commit

Permalink
Create firmware targets with hw-latest feature.
Browse files Browse the repository at this point in the history
  • Loading branch information
Anthony Rocha authored and jhand2 committed Mar 21, 2024
1 parent 29bc9b2 commit 32ba420
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 3 deletions.
78 changes: 78 additions & 0 deletions builder/src/firmware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,48 +15,118 @@ 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 @@ -81,12 +151,20 @@ 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
1 change: 1 addition & 0 deletions common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ test_only_commands = ["caliptra-api/test_only_commands"]
rom = []
fmc = []
runtime = []
hw-latest = ["caliptra-drivers/hw-latest", "caliptra-registers/hw-latest"]
1 change: 1 addition & 0 deletions cpu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ edition = "2021"
# --profile=firmware \
# --features riscv
riscv = []
hw-latest = ["caliptra-drivers/hw-latest", "caliptra-registers/hw-latest"]

[lib]
test = false
Expand Down
3 changes: 2 additions & 1 deletion fmc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,5 @@ fpga_realtime = ["caliptra-hw-model/fpga_realtime"]
itrng = ["caliptra-hw-model/itrng"]
verilator = ["caliptra-hw-model/verilator"]
fake-fmc = []
hw-latest = ["caliptra-registers/hw-latest", "caliptra-drivers/hw-latest"]
hw-latest = ["caliptra-builder/hw-latest", "caliptra-cpu/hw-latest", "caliptra-drivers/hw-latest",
"caliptra-registers/hw-latest"]
1 change: 1 addition & 0 deletions hw-model/test-fw/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ edition = "2021"
default = []
riscv = ["caliptra-test-harness/riscv"]
emu = ["caliptra-test-harness/emu"]
hw-latest = ["caliptra-drivers/hw-latest", "caliptra-registers/hw-latest"]

[dependencies]
caliptra-drivers.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion rom/dev/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ no-fmc = []
fake-rom = []
no-cfi = ["caliptra-image-verify/no-cfi", "caliptra-drivers/no-cfi"]
slow_tests = []
hw-latest = ["caliptra-registers/hw-latest", "caliptra-drivers/hw-latest"]
hw-latest = ["caliptra-builder/hw-latest", "caliptra-drivers/hw-latest", "caliptra-registers/hw-latest"]

[[bin]]
name = "asm_tests"
Expand Down
2 changes: 1 addition & 1 deletion runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ verilator = ["caliptra-hw-model/verilator"]
fips_self_test=[]
no-cfi = ["caliptra-image-verify/no-cfi", "caliptra-drivers/no-cfi"]
fpga_realtime = ["caliptra-drivers/fpga_realtime"]
hw-latest = ["caliptra-drivers/hw-latest"]
hw-latest = ["caliptra-builder/hw-latest", "caliptra-drivers/hw-latest", "caliptra-registers/hw-latest", "caliptra-kat/hw-latest","caliptra-cpu/hw-latest"]
1 change: 1 addition & 0 deletions test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ itrng = ["caliptra-hw-model/itrng"]
verilator = ["caliptra-hw-model/verilator"]
fips_self_test = ["caliptra-runtime/fips_self_test"]
test_env_immutable_rom = []
hw-latest = ["caliptra-builder/hw-latest", "caliptra-drivers/hw-latest"]

0 comments on commit 32ba420

Please sign in to comment.