From 6ab1d5173bf093d682fa03f0b46f5f9025a42771 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rom=C3=A1n=20C=C3=A1rdenas?= Date: Fri, 6 Oct 2023 18:06:17 +0200 Subject: [PATCH 1/4] Use portable-atomic --- Cargo.toml | 4 +++- src/gpio.rs | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e30e4b4..ca7141c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,10 +13,12 @@ rust-version = "1.59" [dependencies] embedded-hal = { version = "0.2.6", features = ["unproven"] } nb = "1.0.0" -atomic-polyfill = "1.0.2" riscv = { version = "0.10.1", features = ["critical-section-single-hart"] } e310x = { version = "0.11.0", features = ["rt", "critical-section"] } +[target.'cfg(not(target_has_atomic = "32"))'.dependencies] +portable-atomic = { version = "1.4", default-features = false, features = ["unsafe-assume-single-core"] } + [features] g002 = ["e310x/g002"] virq = [] diff --git a/src/gpio.rs b/src/gpio.rs index 2be0d58..1061884 100644 --- a/src/gpio.rs +++ b/src/gpio.rs @@ -1,8 +1,12 @@ //! General Purpose I/O -use atomic_polyfill::{AtomicU32, Ordering}; use core::marker::PhantomData; +#[cfg(target_has_atomic = "32")] +use core::sync::atomic::{AtomicU32, Ordering}; +#[cfg(not(target_has_atomic = "32"))] +use portable_atomic::{AtomicU32, Ordering}; + /// GpioExt trait extends the GPIO0 peripheral. pub trait GpioExt { /// The parts to split the GPIO into. From 74541fa371ee1bd904b263cc7b4fdeb4dc1ef361 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rom=C3=A1n=20C=C3=A1rdenas?= Date: Fri, 6 Oct 2023 18:18:02 +0200 Subject: [PATCH 2/4] bump MSRV to 1.60 --- .github/workflows/ci.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5311dd0..432c595 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -11,8 +11,8 @@ jobs: continue-on-error: ${{ matrix.experimental || false }} strategy: matrix: - # All generated code should be running on stable now, MRSV is 1.59.0 - rust: [nightly, stable, 1.59.0] + # All generated code should be running on stable now, MRSV is 1.60.0 + rust: [nightly, stable, 1.60.0] include: # Nightly is only for reference and allowed to fail From 4675f42954adf0c575443d976a15d9c2d512f83c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rom=C3=A1n=20C=C3=A1rdenas?= Date: Fri, 6 Oct 2023 18:24:07 +0200 Subject: [PATCH 3/4] changelog --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bf2f875..fe081e8 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ This project is developed and maintained by the [RISC-V team][team]. ## Minimum Supported Rust Version (MSRV) -This crate is guaranteed to compile on stable Rust 1.59.0 and up. It *might* +This crate is guaranteed to compile on stable Rust 1.60.0 and up. It *might* compile with older versions but that may change in any new patch release. ## License From 902a4142e0682e52b8ba60553e23c336c730ec16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rom=C3=A1n=20C=C3=A1rdenas?= Date: Fri, 6 Oct 2023 18:24:24 +0200 Subject: [PATCH 4/4] changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d8845f3..aa47fb6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] -- Use `atomic-polyfill` to allow builds on riscv32imc-unknown-none-elf targets when needed. +- Use `portable-atomic` to allow builds on `riscv32imc-unknown-none-elf`` targets when needed. ## [v0.10.0] - 2023-03-28