stm32f1xx-hal icon indicating copy to clipboard operation
stm32f1xx-hal copied to clipboard

Exporting the sdv2rust crate as device

Open TeXitoi opened this issue 5 years ago • 15 comments

For consistency, I propose to re export the sdv2rust crate as device. It is coherent with the name used by RTFM: https://japaric.github.io/cortex-m-rtfm/book/by-example/app.html

If there is approvals and no veto, I can propose such a PR.

TeXitoi avatar Feb 11 '19 10:02 TeXitoi

Actually the agreed on terminology is pac. I would not go as far as insta-dropping stm32 but we can certainly mark it is deprecated and re-export the PAC as pac.

therealprof avatar Feb 11 '19 10:02 therealprof

Funny enough even the proponents of that terminology are not using pac to re-export the PAC: pub use nrf52832_pac as target;

therealprof avatar Feb 11 '19 10:02 therealprof

Changing the name does sound like a good idea, I don't really like the current stm32 name, device makes a lot more sense. However, if pac is the agreed upon terminology, we should probably do that.

Out of curiosity, why was pac chosen, I don't really understand what it would mean in this context.

TheZoq2 avatar Feb 11 '19 10:02 TheZoq2

pac := Peripheral Access Crate

therealprof avatar Feb 11 '19 10:02 therealprof

cf. https://rust-embedded.github.io/book/portability/index.html

therealprof avatar Feb 11 '19 10:02 therealprof

Of course we will do that with a new export. I don't really care of the name as long as it can be common between all hal implementation (not only stm32).

The ambiguity with pac is that there are 2 PAC crates: the core PAC (cortex-m) and the device PAC (stm32f1 in this case).

TeXitoi avatar Feb 11 '19 10:02 TeXitoi

Is that so? I haven't thought of cortex-m as a PAC so far. Maybe we should raise the question as issue on the embedded-wg issue tracker to sort out potential conflicts before settling on an implementation.

therealprof avatar Feb 11 '19 10:02 therealprof

If nothing else, the figure in the embedded book seems to indicate that the PAC is the only layer between the microcontroller and the HAL. A wg issue sounds like a good idea to get clarifications about this and to make sure it is standardised

TheZoq2 avatar Feb 11 '19 11:02 TheZoq2

Well, don't let the figure irritate you; I've created that. ;)

However https://rust-embedded.github.io/book/start/registers.html agrees with that view and that hadn't been done by me.

therealprof avatar Feb 11 '19 11:02 therealprof

The thing is that makes me saying that cortex-m is a "PAC" is that there is a Peripherals object in cortex-m: https://docs.rs/cortex-m/0.5.8/cortex_m/peripheral/struct.Peripherals.html

TeXitoi avatar Feb 11 '19 11:02 TeXitoi

In RTFM, there is a core peripheral object and a device peripheral object that is given to the init function.

TeXitoi avatar Feb 11 '19 11:02 TeXitoi

#29 Closed this automatically but I don't think it's fixed since we didn't agree upon a name

TheZoq2 avatar Feb 22 '19 18:02 TheZoq2

@TheZoq2 Uhm, but with the latest changes we're exporting it as stm32, pac and device.

therealprof avatar Feb 22 '19 18:02 therealprof

Yea, that's true, but I feel like we should eventually decide on one of them to avoid confusion. Allthough I suppose allowing all three also has some benefits

TheZoq2 avatar Feb 22 '19 18:02 TheZoq2

Well, if we have to chose one it should probably the documented one which is pac. 😏

therealprof avatar Feb 22 '19 18:02 therealprof