From 48ccd6dc236dbef9038846a21192fad13c6acc10 Mon Sep 17 00:00:00 2001 From: Roy Buitenhuis Date: Tue, 14 Mar 2023 11:43:33 +0100 Subject: [PATCH] Use atomic polyfill for core::sync::atomic. --- embassy-executor/src/arch/riscv32.rs | 3 ++- embassy-hal-common/Cargo.toml | 1 + embassy-hal-common/src/atomic_ring_buffer.rs | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/embassy-executor/src/arch/riscv32.rs b/embassy-executor/src/arch/riscv32.rs index e97a56cdad..2a4b006da5 100644 --- a/embassy-executor/src/arch/riscv32.rs +++ b/embassy-executor/src/arch/riscv32.rs @@ -1,6 +1,7 @@ use core::marker::PhantomData; use core::ptr; -use core::sync::atomic::{AtomicBool, Ordering}; + +use atomic_polyfill::{AtomicBool, Ordering}; use super::{raw, Spawner}; diff --git a/embassy-hal-common/Cargo.toml b/embassy-hal-common/Cargo.toml index e8617c02fc..172b1e063b 100644 --- a/embassy-hal-common/Cargo.toml +++ b/embassy-hal-common/Cargo.toml @@ -9,5 +9,6 @@ license = "MIT OR Apache-2.0" [dependencies] defmt = { version = "0.3", optional = true } log = { version = "0.4.14", optional = true } +atomic-polyfill = "1.0.2" num-traits = { version = "0.2.14", default-features = false } diff --git a/embassy-hal-common/src/atomic_ring_buffer.rs b/embassy-hal-common/src/atomic_ring_buffer.rs index afd3ce1de5..5e8620c329 100644 --- a/embassy-hal-common/src/atomic_ring_buffer.rs +++ b/embassy-hal-common/src/atomic_ring_buffer.rs @@ -1,5 +1,6 @@ use core::slice; -use core::sync::atomic::{AtomicPtr, AtomicUsize, Ordering}; + +use atomic_polyfill::{AtomicPtr, AtomicUsize, Ordering}; /// Atomic reusable ringbuffer ///