-
Notifications
You must be signed in to change notification settings - Fork 151
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
Implement new InterruptNumber trait from next cortex-m release #473
Conversation
r? @adamgreig (rust_highfive has picked a reviewer for you, use r? to override) |
8a0dd2c
to
fe70437
Compare
This LGTM to me, except I don't understand why we were using |
I have no idea why we're not getting random errors in for different vendors. Need to investigate after cooking... |
fe70437
to
cbeec66
Compare
@adamgreig If we're happy with this we'll only need the cortex-m release to finalize this PR. |
src/generate/device.rs
Outdated
@@ -112,7 +112,7 @@ pub fn render( | |||
out.extend(quote! { | |||
pub use cortex_m::peripheral::Peripherals as CorePeripherals; | |||
#[cfg(feature = "rt")] | |||
pub use cortex_m_rt::interrupt; |
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.
I think this was here to ensure the svd2rust generated PAC exports an interrupt
macro, since the cortex-m-rt documentation says you should use interrupt
from your PAC and not from c-m-rt. So, I think we should keep the pub use cortex_m_rt::interrupt
, but we don't need to pub use cortex_m::interrupt::InterruptNumber
at all, since the impl writes the full path anyway.
cbeec66
to
e5bcf1f
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.
Looks good. I think we'll have to try it out a bit with cortex-m and PACs to be sure it's working as we expect but PR looks fine to me. Could you add a CHANGELOG entry?
This eliminates the bare-metal and cortex-m-rt dependencies for Cortex-M and thus changes CI and svd2rust-regress accordingly. Replaces #455 Signed-off-by: Daniel Egger <[email protected]>
e5bcf1f
to
be9fd64
Compare
@adamgreig I've updated the PR to use the release and added a CHANGELOG. I also ran |
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.
bors merge
@@ -180,9 +180,9 @@ pub fn render( | |||
#variants | |||
} | |||
|
|||
unsafe impl bare_metal::Nr for Interrupt { | |||
unsafe impl cortex_m::interrupt::InterruptNumber for Interrupt { |
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 change breaks the build for avr-device
. The problem is that you modified the else
branch which is for everything but msp430
...
I suppose this code needs to be refactored such that this line is only emitted for cortex-m
. I would assume other platforms (like riscv
) will also run into the same issue.
Cc: @trembel
@Rahix Thanks for noticing. Indeed we has some discussion in #455 about other architectures and the approach to be taken there. Since this doesn't break RISC-V in CI, this would imply that either it doesn't break or that it is not exercised properly. AVR is not even tested in CI which would be a good first thing to add. |
Hmm, from reading the code in
I can look into adding that. For AVR, the vendor files are in a format called ATDF which we first convert to SVD using a small utility called |
This eliminates the bare-metal and cortex-m-rt dependencies for Cortex-M
and thus changes CI and svd2rust-regress accordingly.
Replaces #455
Signed-off-by: Daniel Egger [email protected]