-
Notifications
You must be signed in to change notification settings - Fork 239
Upgrade to the upcoming version of avr-device #656
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
Open
Rahix
wants to merge
6
commits into
main
Choose a base branch
from
avr-device-next
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
Use latest avr-device as a git dependency for testing the upcoming version.
This allows us to see which targets are currently failing the build.
As avr-device is upgrading to use svd2rust version 0.33.1, there are some significant changes in the generated API. We have to adapt the HAL code to use the new API whereever relevant. This commit was mostly generated using the following command, which adds the parentheses behind each register access to change it from struct-field access to method call. cargo build --message-format json 2>/dev/null \ | jq '.message.children[].spans[] | {file: .file_name, line: .line_start, col: (.text[0].highlight_start - 1), insert: .suggested_replacement}' 2>/dev/null \ | jq -r '"sed -ri '"'"'" + (.line | tostring) + "s/^(.{" + (.col | tostring) + "})/\\1" + .insert + "/'"'"' $(cd ../..; realpath " + .file + ")"' \ | sort | uniq | bash Shell magic for the win :) Beyond this, .bits() had to be converted to .set() where safe accesses are performed.
avr-device no longer has a `critical-section-impl` feature. Instead it now has a `critical-section` feature that is enabled by default [1]. As such, we can drop the re-exposed feature here. [1]: Rahix/avr-device#195
In svd2rust 0.34.0, the `.write()` and `.modify()` register access functions were changed to return the written register value. As avr-device is upgrading to a more recent svd2rust version, we need to adjust accordingly. Fixup the few places where the return value of `.write()` or `.modify()` mattered due to expression form calls.
Previous versions of `avr-device` allowed accidentally mis-specifying the MCU in the interrupt definition. Now that this is caught, fix one such mistake here.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
dependencies
Pull requests that update a dependency file
waiting-for-avr-device
Waiting for a new release of `avr-device`
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.
The next version of avr-device will bring quite a few breaking changes, mainly due to the upgrade to a newer version of svd2rust. This PR includes all the necessary changes across avr-hal to upgrade to the new API. Please check individual commit messages for details.
This PR will be unblocked when a new release of
avr-device
is ready.