-
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
Remove bare-metal dependency from generated crates #455
Conversation
The only dependency on `bare-metal` was the implementation of the `Nr` trait which has been removed from version 1.0.0 (rust-embedded/bare-metal#32). Closes #453 Signed-off-by: Daniel Egger <[email protected]>
r? @Disasm (rust_highfive has picked a reviewer for you, use r? to override) |
We still want the Interrupt enum on Cortex-M to impl cortex_m::interrupt::Nr, otherwise it can't be used with the cortex-m NVIC methods. The difference is moving to an Nr trait defined by each architecture crate instead of defined in bare-metal, at least as I understood it. |
I see, so we need architecture dependent implementations instead? However I don't see those yet on the horizon, even I have no problem keeping this open for now but we should come up with a definitive plan how we're going to adress that. |
I don't think this is a problem for svd2rust; we simply For today, we should be able to just start using the re-exported Nr available in each architecture crate instead of the bare-metal one. |
Isn't that a contradiction? If the generated PACs need to use So if I'm reading you right the change needs to be redone to use the architecture specific re-export of Alternatively, couldn't the architecture specific crates implement this trait themselves if we're already defining it there? The big thing which wasn't available in the beginning but was added later is the |
Sorry, I meant it's not a problem for svd2rust since it's possible for svd2rust to generate PACs which use the arch crate Nr trait and implement it, which will then keep working with the arch crate interrupt methods. You're right though, we could also change the arch crates to not use Nr in their methods and instead take raw u8s, or somehow take an Interrupt enum (but how would they get the right type?). I think one of the reasons to split this is that some architectures may need a larger type than a u8 to identify the interrupt. Removing Nr was @jonas-schievink's change, perhaps he remembers what we intended to do in the arch specific crates? |
Uhm, well the signature of
so basically up to recently you only had three options to use that anyway:
Option 3 would still work and seems the most natural to me. We could even change the |
Looks good to me, however highfive still thinks I'm in the tools team :) |
How can |
No idea yet, marker trait?. OTOH I just checked and the only place where the ominous |
Wouldn't a marker trait just be
This seems fine too, though I don't know if allowing users to pass a u8 is an "advantage" when they "should" be passing an Interrupt variant from their PAC. |
I'd define the marker trait in the PAC and leave out the useless
Well, the |
To summarise the discussion from today's meeting about this, we decided:
This is a breaking change across the bare-metal/arch crate/svd2rust/PAC ecosystem so we'll have to manage it with the various 1.0 releases we have planned. |
241: Add new InterruptNumber trait r=therealprof a=adamgreig This is a first go at the new trait needed for rust-embedded/svd2rust#455 since we removed `Nr` from bare-metal. In this case I've written it as `unsafe trait InterruptNumber: Into<u16>` rather than providing a conversion method inside the trait; I think this is neat and idiomatic but please correct me if there's a reason to not do it like this. [Here's](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=4f2f8b9604b5a62298f9907780d844c7) a playground link showing an example implementation. Co-authored-by: Adam Greig <[email protected]>
As discussed in todays meeting this is blocked on a |
Additionally, it sounds like msp430 doesn't use the |
My proposal for MSP430 is to:
|
From this weeks discussion: Didn't get to it, will look into making the changes for MSP430 and Cortex-M soon, RISC-V is still pending on input from the team. |
Same for RISC-V I think: remove the |
Well, for MSP430 we're only keeping it for documentation purposes. For Cortex-M they're actually used and in general the assumption would be that it makes sense to copy what Cortex-M is doing... |
The |
This also removes the `bare-metal` dependency from PACs created for MSP430, as requested in #455 (comment) Signed-off-by: Daniel Egger <[email protected]>
@Disasm The question was not about the |
@therealprof Thanks for clarification. Indeed, we could do something like this for RISC-V, but right at the moment such |
This also removes the `bare-metal` dependency from PACs created for MSP430, as requested in #455 (comment) Signed-off-by: Daniel Egger <[email protected]>
460: Rework `Interrupt` enum for MSP430 r=adamgreig a=therealprof This also removes the `bare-metal` dependency from PACs created for MSP430, as requested in #455 (comment) Signed-off-by: Daniel Egger <[email protected]> Co-authored-by: Daniel Egger <[email protected]>
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]>
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]>
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]>
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]>
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]>
473: Implement new InterruptNumber trait from next cortex-m release r=adamgreig a=therealprof 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]> Co-authored-by: Daniel Egger <[email protected]>
I think we can close this, right? |
The only dependency on
bare-metal
was the implementation of theNr
trait which has been removed from version 1.0.0
(rust-embedded/bare-metal#32).
Closes #453
Signed-off-by: Daniel Egger [email protected]