-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
Fix CI: source of PACs matrix + clippy satisfaction #71
Conversation
That required a good number of changes to satisfy the doctests and clippy. I suspect the bump in version is to blame. error[E0599]: `Peripherals` is not an iterator
--> hal/src/tc/mod.rs:25:34
|
11 | let pac = hal::pac::Peripherals::take().unwrap();
| ^^^^ `Peripherals` is not an iterator
|
::: /mnt/c/Users/martin.mortsell/Documents/atsams70-rust/target/x86_64-unknown-linux-gnu/debug/build/atsamv71q21b-90d0014a7c81a20a/out/lib.rs:1:55241
|
1 | ...All the peripherals."] # [allow (non_snake_case)] pub struct Peripherals { # [doc = "ACC"] pub ACC : ACC , # [doc = "AES"] pub AES : AES , # [doc = "AFEC0"] pub AF...
| ---------------------- doesn't satisfy `Peripherals: Iterator`
|
= note: the following trait bounds were not satisfied:
`Peripherals: Iterator`
which is required by `&mut Peripherals: Iterator`
error: aborting due to previous error I don't understand what the issue is, but solved it by changing all occurrences of |
@@ -28,7 +28,7 @@ For example, if we want to configure the [`MainClock`]: | |||
use atsamx7x_hal as hal; | |||
use hal::fugit::RateExtU32; | |||
|
|||
let pac = hal::pac::Peripherals::take().unwrap(); | |||
let pac = unsafe{hal::pac::Peripherals::steal()}; |
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.
It's unsafe
again??? 🤔
Looks like it depends on critical-section
implementation: https://docs.rs/svd2rust/latest/svd2rust/#peripheral-api
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.
steal()
is unsafe as it returns a peripheral struct without checking if the peripherals have been generated before, potentially violating the singleton assumption.
It seems take()
is a method implemented for iterators which confuses the doc test since Peripherals is not an iterator.
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.
And yes, I believe you are correct that critical-section
is the root cause here.
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.
Looking into this a bit more and rolling back to an older version of the pac makes this error go away.
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.
It seems Peripherals
does not have the take()
method anymore. Very unclear, investigating further.
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 interesting. I should have some time tomorrow to branch and try next version of svd2rust
to see if it's intermittent problem. There's 0.30.1 and two other point releases to try with.
I'm not going straight to last version as there are breaking changes and invocation changes + I want something to work on release automation (I wish I have like two weeks full time to work on that).
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.
Sounds good, I will keep investigating in the meantime.
I can't seem to build the pacs locally. python3 tools/pacs.py svd
should work, right?
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.
rust-embedded/svd2rust#704 Found the relevant issue.
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.
we don't catch this in our examples as they all utse RTIC and RTIC does a steal()
internally.
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.
tools/pacs.py
requires mapping JSON file as argument... I forgot to commit it - harvester generates it when downloads atpacks and extract SVDs.
For now you can run harvester yourself to redownload and obtain the file. It's used to fill up ATPACKs version numbers in README.md
s of each PAC.
Co-authored-by: Michał Fita <[email protected]>
@martinmortsell I can't commit to PRs raised from GrepitAB's forks. I'm merging this as is and I'm going to work on more fixes for #72 on another branch. |
The CI was broken due to the pac folder being removed.
This fix extracts the pac features from
hal/Cargo.toml
instead.