8000 ot/earlgrey-cw310: custom build.rs that supports alternative linker script for tests by hudson-ayers · Pull Request #4190 · tock/tock · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

ot/earlgrey-cw310: custom build.rs that supports alternative linker script for tests #4190

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
Oct 9, 2024

Conversation

hudson-ayers
Copy link
Contributor
@hudson-ayers hudson-ayers commented Oct 6, 2024

Pull Request Overview

This pull request fixes the hack where OT currently relies on overwriting the linker script in the target directory, instead using a custom build.rs to allow this board to override the linker script in use based on the value of an environment variable. Rather than copy much of the existing default build.rs, I refactored it into a few standalone functions that I believe best represent its core functionality. This allowed me to reuse most of those functions in this script, to make it less likely that changes to one fail to propagate to the other.

This PR also includes some cleanup to remove some lines that I believe are no longer necessary in the current build system. These line were scattered around the "test" rule for various boards as a holdover from when those tests would directly copy files into the build directory, which is no longer done.

This PR will unblock #4150.

Testing Strategy

This pull request was tested by compiling + running the tests + looking at the output of cargo build -vv.

TODO or Help Wanted

N/A.

Documentation Updated

  • No updates are required.

Formatting

  • Ran make prepush.

@hudson-ayers hudson-ayers requested a review from bradjc October 6, 2024 22:25
@github-actions github-actions bot added the WG-OpenTitan In the purview of the OpenTitan working group. label Oct 6, 2024
@hudson-ayers hudson-ayers force-pushed the hudson.ayers/ot-build-fix branch from bd2692f to 9b93fb6 Compare October 7, 2024 02:06
lschuermann
lschuermann previously approved these changes Oct 7, 2024
Copy link
Member
@lschuermann lschuermann left a comment

Choose a reason for hiding this comment

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

LGTM. I don't claim to fully understand the intricacies of OpenTitan's requirements or this infrastructure, but so long as it works this definitely looks less hacky than what we had before.

bradjc
bradjc previously approved these changes Oct 7, 2024
Copy link
Contributor
@bradjc bradjc left a comment

Choose a reason for hiding this comment

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

Looks great. This seems like the right combination of environment variables, cargo, and build.rs.

mod default;
pub mod default;
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to expose this? We could namespace new functionality in the future, but what we have seems like the normal APIs we can just expose directly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Up to you -- I am fine to re-export all of the functions inside default, but it seems easier to just have default be pub and then we can still hide functions inside the file by making individual functions not pub

@hudson-ayers hudson-ayers dismissed stale reviews from bradjc and lschuermann via 45568c7 October 9, 2024 03:58
This commit fixes the hack where OT currently relies on overwriting the
linker script in the target directory, instead using a custom build.rs
to allow this board to override the linker script in use based on the
value of an environment variable. This PR also includes
some cleanup to remove some lines that I believe are no longer necessary
in the current build system. These line were scattered around the "test"
rule for various boards and would directly copy files into the build
directory, but I that is already handled by Cargo today.
@hudson-ayers hudson-ayers force-pushed the hudson.ayers/ot-build-fix branch from 45568c7 to db4ee1d Compare October 9, 2024 04:01
@ppannuto ppannuto added the last-call Final review period for a pull request. label Oct 9, 2024
@ppannuto
Copy link
Member
ppannuto commented Oct 9, 2024

@pqcfox (or other OT folk), does OT have any issues with this [hopefully it makes things easier long-run]?

@pqcfox
Copy link
Contributor
pqcfox commented Oct 9, 2024

No issues with this at all--very much appreciate these changes going in, this will be really nice to have :)

(thanks for pinging me on this!)

Copy link
@RyanTorok RyanTorok left a comment

Choose a reason for hiding this comment

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

This is great!

@lschuermann
Copy link
Member

Approved by core team and major stakeholders, merging. 😄

@lschuermann lschuermann added this pull request to the merge queue Oct 9, 2024
Merged via the queue into master with commit 90f746f Oct 9, 2024
18 checks passed
@lschuermann lschuermann deleted the hudson.ayers/ot-build-fix branch October 9, 2024 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
last-call Final review period for a pull request. WG-OpenTitan In the purview of the OpenTitan working group.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants
0