Skip to content

Fix support for 301 family #102

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

Closed
danielgallagher0 opened this issue May 12, 2020 · 5 comments · Fixed by #115
Closed

Fix support for 301 family #102

danielgallagher0 opened this issue May 12, 2020 · 5 comments · Fixed by #115

Comments

@danielgallagher0
Copy link
Contributor

This crate has features for stm32f301xa, xb, xc, and xd devices, but ST does not have those in its product line. It does have 301x6 and 301x8 devices.

I propose adding features for 301x6 and 301x8 (and implementing those devices), and marking the other 301 features as deprecated. The 301xa/b/c/d support can then be removed at some point in the future.

@strom-und-spiele
Copy link
Collaborator

I'd just drop them (no one could have used them in the first place) and add x6 and x8.

@teskje
Copy link
Collaborator

teskje commented Jul 18, 2020

See #115, would be good if one of you could review it.

I've decided to simply remove the sub-target features. It's a breaking change but as @strom-und-spiele suggested, it is very unlikely that anyone actually used those features, considering those models don't exist.

I also did not add new features for the x6 and x8 variants. Looks like they only differ in amount of flash, so I don't think we actually need to differentiate here. In any case, we can add them later if necessary.

@Sh3Rm4n
Copy link
Member

Sh3Rm4n commented Jul 18, 2020

I also did not add new features for the x6 and x8 variants. Looks like they only differ in amount of flash, so I don't think we actually need to differentiate here. In any case, we can add them later if necessary.

Speaking of features, those sub-variant differentiators for the devices always come in pairs of two: [xb, xc], [xd, xe], [x6, x8]. IIRC all those differ only in flash size.

If this is true, we could reduce the amount of features and combine these to `"xc/d", "xd/e", x6/8" features. Not sure about the feature naming though, as these are still somewhat user-facing and should be readable and comprehensible in the end.

@teskje
Copy link
Collaborator

teskje commented Jul 18, 2020

I agree. Something like "stm32f303xc" is still understandable, while "stm32f303xbc" would be confusing.

I think if we do this change it would be the best to keep the current features and introduce "internal" ones which are actually used in the code. So in the Cargo.toml we'd have something like:

f303_bc = []

stm32f303xb = ["f303_bc"]
stm32f303xc = ["f303_bc"]

Something even more promising is figuring out what peripheral versions are used by the different MCUs, like the stm32l0xx-hal does (see stm32-rs/stm32l0xx-hal#82). Then we'd just have to provide in the Cargo.toml a mapping from MCU model features to peripheral version features and could implement our code based (mostly) on the peripheral version features. This should lead us to the minimum amount of #cfg(feature = ...) needed.

@Sh3Rm4n
Copy link
Member

Sh3Rm4n commented Jul 19, 2020

Something even more promising is figuring out what peripheral versions are used by the different MCUs, like the stm32l0xx-hal does (see stm32-rs/stm32l0xx-hal#82). Then we'd just have to provide in the Cargo.toml a mapping from MCU model features to

This approach looks interesting. I wonder, if we should create a tracking issue for these kinds of "small" internal code improvements 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants