-
Notifications
You must be signed in to change notification settings - Fork 747
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
Conversation
bd2692f
to
9b93fb6
Compare
There was a problem hiding this 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.
There was a problem hiding this 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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
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.
45568c7
to
db4ee1d
Compare
@pqcfox (or other OT folk), does OT have any issues with this [hopefully it makes things easier long-run]? |
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!) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great!
Approved by core team and major stakeholders, merging. 😄 |
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
Formatting
make prepush
.