Introduce new Cargo features generated with cube-parse#82
Merged
arkorobotics merged 3 commits intostm32-rs:masterfrom Feb 25, 2020
Merged
Introduce new Cargo features generated with cube-parse#82arkorobotics merged 3 commits intostm32-rs:masterfrom
arkorobotics merged 3 commits intostm32-rs:masterfrom
Conversation
This PR introduces four new `io-*` features that can be used to differentiate between different GPIO peripheral versions. This is required to properly implement pin mappings for I/O pins (including Serial, I²C, SPI, etc). Additionally, because the GPIO peripheral version don't map cleanly to the previously used families (stm32l0x1, stm32l0x2, stm32l0x3), I added aliases for every MCU in the STM32L0 family where the marketing status is marked as active. Those `mcu-*` features are purely used as aliases and thus do not need to be included in the testing matrix. The features are provided as a shortcut to the user, so that the different HAL parameters (like GPIO peripheral version, MCU subfamily, chip package, etc) do not need to be determined manually. Since the HAL already uses chip packages as features (in the ADC module), I also added a dependency from the MCU feature to the corresponding chip package feature. All features are generated using https://github.com/dbrgn/cube-parse: cargo run -- features STM32L0 -d /path/to/stm32cubemx/db/mcu/defines
Contributor
Author
|
Hmm, there are multiple feature gates in the code where a semi-specific MCU is required. For example, in That's the kind of feature gate that is unmaintainable, because it can result in a dozen different variants for the different MCUs (overspecific). It also makes it hard to verify any changes if the code is not either generated, or identical across an entire (sub)family. Ideally, we'd use the STM32CubeMX database to generate features for the feature classes that we want to cover, similar to the |
This was referenced Jul 18, 2020
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces four new
io-*features that can be used todifferentiate between different GPIO peripheral versions. This is
required to properly implement pin mappings for I/O pins (including
Serial, I²C, SPI, etc). See #74 (comment) for more context.
Additionally, because the GPIO peripheral version don't map cleanly to
the previously used families (stm32l0x1, stm32l0x2, stm32l0x3), I added
aliases for every MCU in the STM32L0 family. Those
mcu-*featuresare purely used as aliases
and thus do not need to be included in the testing matrix. The features
are provided as a shortcut to the user, so that the different HAL
parameters (like GPIO peripheral version, MCU subfamily, chip package,
etc) do not need to be determined manually. MCU features should
never be used as cfg gates in the source code.
Since the HAL already uses chip packages as features (in the ADC
module), I also added a dependency from the MCU feature to the
corresponding chip package feature. I am not sure whether
using physical chip package as a selector is a good idea, but since
that's already the status quo I simply kept them.
All features are generated using https://github.com/dbrgn/cube-parse:
This PR is a requirement to resolve #68 and #76.
CC @adamgreig @HarkonenBade @jonas-schievink @david-sawatzke @arkorobotics @rnestler