Skip to content
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

Use atomic polyfill for targets missing atomic support #21

Closed
wants to merge 1 commit into from

Conversation

MabezDev
Copy link
Member

Drops in emulated atomics for targets missing core::sync::atomic, on targets that do not have them natively.

@bjoernQ
Copy link

bjoernQ commented Sep 29, 2021

I'd be quite interested in getting this into rtt-target (to make RTT work on BL602)

@MabezDev
Copy link
Member Author

MabezDev commented Nov 9, 2021

@bjoernQ, this may be of interest: https://github.com/esp-rs/riscv-atomic-emulation-trap.

@noppej
Copy link
Contributor

noppej commented Jan 17, 2022

@mvirkkunen What are your thoughts on enabling RISCV targets such as the ESP32C3 board?

@Dirbaio
Copy link
Member

Dirbaio commented Mar 3, 2023

We shouldn't do this. This crate only needs load/store, not CAS. atomic_polyfill will take a critical section for each load/store to prevent them from racing against CAS operations, which is useless overhead in this case because there's no CAS.

Ideally Rust should expose load/store atomics on riscv32-imc (what the esp32c3 is) like it does in thumbv6m. See relevant Rust issue: rust-lang/rust#99668

@MabezDev
Copy link
Member Author

MabezDev commented Mar 3, 2023

Oh wow, I forgot this PR even existed :D. I agree and I think it's coming soon with the +forced-atomics feature. FYI it's also possible to "force" them on the rust side via cfg flags, see https://github.com/esp-rs/riscv-atomic-emulation-trap#usage.

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 this pull request may close these issues.

4 participants