-
Notifications
You must be signed in to change notification settings - Fork 151
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
Support for atomic bitwise operations in MSP430 PAC API #407
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
FWIW, this looks fine to me. Will take a closer look after the msp430 improvements are merged. Please keep in mind that Additionally, why are your |
The new API is unsafe because the bit patterns specified in the write proxy may not be equal to the bits in the actual register after the operation. For example, calling |
What's the status of this? |
@therealprof No further movement on my end, and I just realized this PR as-is would conflict with getting msp430 to work completely on stable (since I would like to hear from @YuhanLiin before closing (and resubmitting) later, though. |
Haven't looked into this PR in a while, so it's probably out of date right now. The stability issue still stands, since there're no ASM intrinsics in MSP430 right now, and I don't see any workarounds at all. Closing with the intention of reopening later makes sense. |
Is there any progress? |
The PR still relies on |
As said one guy |
I think it's more accurate to say there are other blockers on getting msp430 stabilized (I have a list somewhere) that makes it low priority to swap from
I could change this all to In addition, I thought the "new" |
|
Oh great, that means it's gonna be involved to add, doesn't it?
PACs generated with That said, just because I accept the consequences of using nightly doesn't mean other people need to. I still intend to create a stable path for msp430 code:
I think so, as unstable features can allow extremely useful optimizations at the cost of being tied to nightly. I can put |
I have the same opinion |
cc @therealprof What do you think about? |
@YuhanLiin instead of using compile time feature, you can use runtime |
So should the atomics be gated purely by the nightly runtime flag or should there be a compile-time feature gating it as well, as per the previous discussions? |
I think runtime flag is enough for this. |
LGTM. Please, use |
How should I undo my previous merge? |
Just use this branch https://github.com/rust-embedded/svd2rust/tree/msp-atomic2 |
Typically, when setting or clearing bits of a register, RMW in the form of
reg.modify(|r, w| ...)
is needed, which can be interrupted. On the MSP430 architecture however there are instructions such asbis
andxor
that can modify specific bits of a memory location atomically. This change adds APIs to the register proxies to take advantage of those instructions. I also updated the MSP430 regression test cases, though they're still broken because MSP430 doesn't compile on stable.As discussed on matrix, we don't want to merge this until after the MSP430 improvement patch goes in, so I'm uploading the PR for feedback.