Skip to content

Add a feature flag for firmware for 2.1 HW. #267

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 17, 2025
Merged

Add a feature flag for firmware for 2.1 HW. #267

merged 1 commit into from
Jul 17, 2025

Conversation

swenson
Copy link
Collaborator

@swenson swenson commented Jul 17, 2025

This is an additive flag to turn on 2.1 features, particularly for ROM (I3C AXI recovery bypass) and eventually for SPDM (ML-KEM, external mu support for ML-DSA).

This adds support for switching versions when using cargo xtask runtime, which will ensure that the firmware is built with the hw-2-1 flag if running the emulator for 2.1.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a --hw-revision flag to the cargo xtask runtime command and a corresponding hw-2-1 feature flag for firmware crates, enabling 2.1 hardware features (I3C AXI recovery bypass, ML-KEM support).

  • Add hw_revision argument in xtask/src/main.rs and handle it in xtask/src/runtime.rs to automatically include the hw-2-1 flag when building.
  • Update Cargo.toml for multiple crates to define and expose the new hw-2-1 feature.
  • Wrap ROM flash recovery flow in a cfg!(feature = "hw-2-1") guard and document hardware revision usage in README.md.

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
xtask/src/main.rs Added --hw-revision CLI flag with default 2.0.0.
xtask/src/runtime.rs Inject hw-2-1 feature into build flags when needed.
rom/src/rom.rs Guard flash recovery code with hw-2-1 feature.
rom/Cargo.toml Define hw-2-1 feature for ROM crate.
platforms/emulator/runtime/userspace/apps Add hw-2-1 feature to user and example app crates.
platforms/emulator/runtime/Cargo.toml Define hw-2-1 feature for emulator runtime crate.
platforms/emulator/rom/Cargo.toml Define hw-2-1 and attach it to common code.
README.md Document hardware revision workflow and flags.
Comments suppressed due to low confidence (2)

xtask/src/runtime.rs:33

  • Add unit tests around this branch to verify that the hw-2-1 flag is only pushed into the features list when hw_revision >= 2.1.0, and not otherwise.
    if hw_revision >= semver::Version::new(2, 1, 0) {

README.md:50

  • [nitpick] Include a brief example showing how to enable hw-2-1 in Cargo.toml or via cargo build --features hw-2-1 to make it clearer for users.
For firmware, 2.1 features can be enabled using the `hw-2-1` feature flag when specifying dependencies.

This is an additive flag to turn on 2.1 features, particularly for ROM
(I3C AXI recovery bypass) and eventually for SPDM (ML-KEM, external mu
support for ML-DSA).

This adds support for switching versions when using `cargo xtask
runtime`, which will ensure that the firmware is built with the `hw-2-1`
flag if running the emulator for 2.1.

clippy fixes
Copy link
Collaborator

@helloxiling helloxiling left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@swenson
Copy link
Collaborator Author

swenson commented Jul 17, 2025

Thanks!

@swenson swenson merged commit b1e3e29 into main Jul 17, 2025
1 of 2 checks passed
@swenson swenson deleted the feature-2.1 branch July 17, 2025 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants