Unable to build embassy_rp::multicore

Hi all,

I tried building the embassy_rp multicore example from the Embassy documentation, but I get this:

   Compiling static_cell v2.1.0
error[E0599]: no method named `compare_exchange` found for struct `portable_atomic::AtomicBool` in the current scope
   --> /Users/fred/.cargo/registry/src/index.crates.io-6f17d22bba15001f/static_cell-2.1.0/src/lib.rs:125:14
    |
123 |           if self
    |  ____________-
124 | |             .used
125 | |             .compare_exchange(false, true, Ordering::Ac...
    | |             -^^^^^^^^^^^^^^^^ method not found in `AtomicBool`
    | |_____________|
    |

error[E0599]: no method named `compare_exchange` found for struct `portable_atomic::AtomicBool` in the current scope
   --> /Users/fred/.cargo/registry/src/index.crates.io-6f17d22bba15001f/static_cell-2.1.0/src/lib.rs:194:14
    |
192 |           if self
    |  ____________-
193 | |             .taken
194 | |             .compare_exchange(false, true, Ordering::Ac...
    | |             -^^^^^^^^^^^^^^^^ method not found in `AtomicBool`
    | |_____________|
    |

For more information about this error, try `rustc --explain E0599`.
error: could not compile `static_cell` (lib) due to 2 previous errors

I'm on stable Rust 1.80.1 and embassy-rp 0.2.0. Not sure if the problem is with me because I didn't specify feature such-and-such, or if it's an actual problem with embassy_rp or one of the crates it depends on. This issue over at GitHub might suggest the latter.

Am I meant to do something to resolve this, or should I post this as an issue with embassy_rp (or some other crate)?

I put the minimal demo project up at https://github.com/FredrikBrautigam/multicore_example, in case someone wants to experiment with it.

Best regards,

Fredrik

not a user of embassy, but have some experience with rp2040. if I read the documentation correctly, portable-atomic relies critical-section on targets where native atomic instructions are not available, like thumbv6m-none-eabi, and it can be enabled with the critical-section feature flag.

since it's a dependency of the embassy-rp example, you should definitely report to the maintainer. meanwhile, I think you can workaround the error by adding portable-atomic as a dependency and enable the critical-section feature, e.g.;

$ cargo add portable-atomic --features=critical-section

Hi,

This did indeed work around the problem. Will inform the embassy_rp maintainer. Thank you!

Best regards,

Fredrik

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.