-
Notifications
You must be signed in to change notification settings - Fork 108
device feature gates #261
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
device feature gates #261
Conversation
Reconsidering b2abfcb and the private naming for the PAC features as that would then make someone with an un / indirectly supported MCU (i.e. L4+) have to do something obviously wrong (a completely different MCU in the features list)
|
This allows for PAC specialisation (like is done for L412 and L4r9) AND grouping in source. The `generic_pac_*` features now enable both the private and dependency features
Added Note that while the PAC has specilisations for the L412, that is not enabled by this PR as it does require functional changes. The intended diff would be - stm32l412 = [ "generic_pac_stm32l4x2", "private_product_L41_L42" ]
+ stm32l412 = [ "stm32l4/stm32l412", "private_line_stm32l4x2", "private_product_L41_L42" ] |
Wow, it turned out that this can of worms was a lot larger than I expected. Do you see any other way of achieving this? Like base feature + extension only available on MCU xxx. |
I must say I agree that this is ugly, but at the same time I don't see a lot of good options here. From what I've looked at Rust doesn't really provide a way to shorthand
The idea here was that a crate depending on this one only uses the chip list. Internally only the I have quite deliberately proposed the "over the top" solution here because I see it having the least impact outside this crate (1 time very easy to resolve feature update) while minimising opportunity for errors internally and making it easy to contribute changes (could probably do with some docs describing the recommended approach to take with gated code as well. I don't particularly like what happened with some of the RTC changes and a single recommended style would be useful once one is established) I'm very open to suggestions/discussion on alternative approaches (not tied to this at all, just need to start somewhere). PS |
#266 as a counterpoint to the heavy use of derived features here. Unlike this PR it does make some functionality changes (took the time to act on comments along the lines of "this should be gated on...") |
#29
This PR introduces device specific cargo features, renaming the old L4 line features to be clear these are private/internal groupings and adding internal groupings for the odd/even product sets, AES support and SHA-256 support. Once features are updated to the specific device instead of line in a downstream crate (i.e. change
stm32L4x2
tostm32l432
in the features list of this crate), no functional changes should occur due to this PR. The purpose of this PR is to give a clear path to contributing device specific changes (prompted by #257 & #258. There was no clear path to merging a change that was specific to L47/L48 products. #29 makes it sound like you want the complete set of changes for a part all at once which is way more than I set out to do when debugging why the temperature readings were off and so led to that fix not making it into the PR)Note: Since the L4 family is split across 3 reference manuals (L41-L46, L47-L4A, L4+), a combination of checking feature tables on the ST website (example) and searching for
defined(stm
/defined (stm
in the C HAL seems likely to be the most productive way to find the majority of the differences