From 0ab43f0563448d419f459bdde77d05b680573737 Mon Sep 17 00:00:00 2001 From: YuhanLiin Date: Mon, 31 Oct 2022 23:42:43 -0400 Subject: [PATCH 01/11] Enable atomic API generation outside MSP430 --- src/generate/device.rs | 10 +++++----- .../{generic_msp430_atomic.rs => generic_atomic.rs} | 0 2 files changed, 5 insertions(+), 5 deletions(-) rename src/generate/{generic_msp430_atomic.rs => generic_atomic.rs} (100%) diff --git a/src/generate/device.rs b/src/generate/device.rs index aa5601bb..0545b30c 100644 --- a/src/generate/device.rs +++ b/src/generate/device.rs @@ -147,13 +147,13 @@ pub fn render(d: &Device, config: &Config, device_x: &mut String) -> Result Result Date: Mon, 31 Oct 2022 23:47:22 -0400 Subject: [PATCH 02/11] Update docs --- src/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 6b7f9142..9099d1d6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -122,21 +122,18 @@ //! - [`msp430-rt`](https://crates.io/crates/msp430-rt) v0.4.x //! - [`vcell`](https://crates.io/crates/vcell) v0.1.x //! -//! If the `--nightly` flag is provided to `svd2rust`, then `portable-atomic` v0.3.15 is also needed. -//! Furthermore the "device" feature of `msp430-rt` must be enabled when the `rt` feature is +//! The "device" feature of `msp430-rt` must be enabled when the `rt` feature is //! enabled. The `Cargo.toml` of the device crate will look like this: //! //! ``` toml //! [dependencies] //! critical-section = { version = "1.0", optional = true } //! msp430 = "0.4.0" -//! portable-atomic = "0.3.15" # Only when using the --nightly flag //! msp430-rt = { version = "0.4.0", optional = true } //! vcell = "0.1.0" //! //! [features] //! rt = ["msp430-rt/device"] -//! unstable = ["portable-atomic"] //! ``` //! //! ## Other targets @@ -492,13 +489,16 @@ //! The `--nightly` flag can be passed to `svd2rust` to enable features in the generated api that are only available to a nightly //! compiler. The following features are gated by the `--nightly` flag: //! -//! ### MSP430 +//! ### Atomics //! //! Extends the register API with operations to atomically set, clear, and toggle specific bits. //! The atomic operations allow limited modification of register bits without read-modify-write //! sequences. As such, they can be concurrently called on different bits in the same register //! without data races. //! +//! `portable-atomic` v0.3.15 must be added to the dependencies, with default features off if +//! possible to disable the `fallback` feature. +//! //! Usage examples: //! //! ```ignore From 9389237065d4d1f7ed4e0246ae7600923e890606 Mon Sep 17 00:00:00 2001 From: YuhanLiin Date: Mon, 31 Oct 2022 23:53:56 -0400 Subject: [PATCH 03/11] Modify svd2rust-regress with nightly changes --- ci/svd2rust-regress/src/svd_test.rs | 8 +++----- ci/svd2rust-regress/src/tests.rs | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/ci/svd2rust-regress/src/svd_test.rs b/ci/svd2rust-regress/src/svd_test.rs index b82ca4f4..d398314d 100644 --- a/ci/svd2rust-regress/src/svd_test.rs +++ b/ci/svd2rust-regress/src/svd_test.rs @@ -7,7 +7,8 @@ use std::process::{Command, Output}; const CRATES_ALL: &[&str] = &["critical-section = \"1.0\"", "vcell = \"0.1.2\""]; const CRATES_MSP430: &[&str] = &["msp430 = \"0.4.0\"", "msp430-rt = \"0.4.0\""]; -const CRATES_MSP430_NIGHTLY: &[&str] = &["portable-atomic = \"0.3.15\""]; +const CRATES_NIGHTLY: &[&str] = + &["portable-atomic = { version = \"0.3.15\", default-features = false }"]; const CRATES_CORTEX_M: &[&str] = &["cortex-m = \"0.7.6\"", "cortex-m-rt = \"0.6.13\""]; const CRATES_RISCV: &[&str] = &["riscv = \"0.9.0\"", "riscv-rt = \"0.9.0\""]; const CRATES_XTENSALX: &[&str] = &["xtensa-lx-rt = \"0.9.0\"", "xtensa-lx = \"0.6.0\""]; @@ -137,10 +138,7 @@ pub fn test( XtensaLX => CRATES_XTENSALX.iter(), }) .chain(if nightly { - match &t.arch { - Msp430 => CRATES_MSP430_NIGHTLY.iter(), - _ => [].iter(), - } + CRATES_NIGHTLY.iter() } else { [].iter() }) diff --git a/ci/svd2rust-regress/src/tests.rs b/ci/svd2rust-regress/src/tests.rs index 58fce01a..ed73e42c 100644 --- a/ci/svd2rust-regress/src/tests.rs +++ b/ci/svd2rust-regress/src/tests.rs @@ -4195,7 +4195,7 @@ pub const TESTS: &[&TestCase] = &[ mfgr: TexasInstruments, chip: "msp430fr2355", svd_url: Some( - "https://raw.githubusercontent.com/YuhanLiin/msp430fr2355/rt-up/msp430fr2355.svd", + "https://raw.githubusercontent.com/YuhanLiin/msp430fr2355/master/msp430fr2355.svd", ), should_pass: true, run_when: Always, From bbc3ce6777ec71bac64251709e466d04e8782f8a Mon Sep 17 00:00:00 2001 From: YuhanLiin Date: Tue, 1 Nov 2022 00:15:45 -0400 Subject: [PATCH 04/11] Add nightly tests to every chip in CI --- .github/workflows/ci.yml | 9 ++++++++- ci/script.sh | 8 ++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 586a8a83..cdad59d2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,22 +53,28 @@ jobs: - { rust: stable, vendor: Freescale, options: all } - { rust: stable, vendor: Freescale, options: "" } - { rust: stable, vendor: Fujitsu, options: "" } + - { rust: stable, vendor: Fujitsu, options: "--nightly" } - { rust: stable, vendor: GD32, options: all } - { rust: stable, vendor: GD32, options: "" } - { rust: stable, vendor: Holtek, options: all } - { rust: stable, vendor: Holtek, options: "" } - { rust: stable, vendor: Microchip, options: "" } + - { rust: stable, vendor: Microchip, options: "--nightly" } - { rust: stable, vendor: Nordic, options: all } - { rust: stable, vendor: Nordic, options: "" } - { rust: stable, vendor: Nuvoton, options: "" } + - { rust: stable, vendor: Nuvoton, options: "--nightly" } - { rust: stable, vendor: NXP, options: all } - { rust: stable, vendor: NXP, options: "" } - { rust: stable, vendor: RISC-V, options: "" } + - { rust: stable, vendor: RISC-V, options: "--nightly" } - { rust: stable, vendor: SiliconLabs, options: all } - { rust: stable, vendor: SiliconLabs, options: "" } - { rust: stable, vendor: Spansion, options: "" } + - { rust: stable, vendor: Spansion, options: "--nightly" } - { rust: stable, vendor: STMicro, options: "" } - - { rust: stable, vendor: STM32-patched, options: "--strict --const_generic --derive_more --pascal_enum_values --max_cluster_size" } + - { rust: stable, vendor: STMicro, options: "--nightly" } + - { rust: stable, vendor: STM32-patched, options: "--strict --const_generic --derive_more --pascal_enum_values --max_cluster_size --nightly" } - { rust: stable, vendor: Toshiba, options: all } - { rust: stable, vendor: Toshiba, options: "" } # Test MSRV @@ -76,6 +82,7 @@ jobs: # Use nightly for architectures which don't support stable - { rust: nightly, vendor: MSP430, options: "--nightly" } - { rust: nightly, vendor: MSP430, options: "" } + - { rust: nightly, vendor: Espressif, options: "--nightly" } - { rust: nightly, vendor: Espressif, options: "" } steps: diff --git a/ci/script.sh b/ci/script.sh index 5b19943b..66d845bb 100755 --- a/ci/script.sh +++ b/ci/script.sh @@ -31,7 +31,7 @@ main() { case $OPTIONS in all) - options="--const_generic --strict --derive_more" + options="--const_generic --strict --derive_more --nightly" ;; *) options=$OPTIONS @@ -46,6 +46,9 @@ main() { if [[ "$options" == *"--derive_more"* ]]; then echo 'derive_more = "0.99"' >> $td/Cargo.toml fi + if [[ "$options" == *"--nightly"* ]]; then + echo 'portable-atomic = { version = "0.3.15", default-features = false }' >> $td/Cargo.toml + fi echo '[profile.dev]' >> $td/Cargo.toml echo 'incremental = false' >> $td/Cargo.toml @@ -465,9 +468,6 @@ main() { echo '[dependencies.msp430]' >> $td/Cargo.toml echo 'version = "0.4.0"' >> $td/Cargo.toml - echo '[dependencies.portable-atomic]' >> $td/Cargo.toml - echo 'version = "0.3.15"' >> $td/Cargo.toml - # Test MSP430 test_svd_for_target msp430 https://raw.githubusercontent.com/pftbest/msp430g2553/v0.3.0-svd/msp430g2553.svd test_svd_for_target msp430 https://raw.githubusercontent.com/YuhanLiin/msp430fr2355/master/msp430fr2355.svd From 7a0a5d40c0172317be3dd23e9b169ef991821ee9 Mon Sep 17 00:00:00 2001 From: YuhanLiin Date: Tue, 1 Nov 2022 00:20:19 -0400 Subject: [PATCH 05/11] Fix build error --- src/generate/device.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/generate/device.rs b/src/generate/device.rs index 0545b30c..51e28b2e 100644 --- a/src/generate/device.rs +++ b/src/generate/device.rs @@ -152,7 +152,7 @@ pub fn render(d: &Device, config: &Config, device_x: &mut String) -> Result Result Date: Tue, 1 Nov 2022 00:21:58 -0400 Subject: [PATCH 06/11] update CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cfb2e766..b64aea4c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Test patched STM32 - simplify ci strategy - Fix generated code for MSP430 atomics +- Generate atomic register code for non-MSP430 targets ## [v0.27.1] - 2022-10-25 From c5e0b55c8360d4b01e7f21ddc7519ebc1786bbd1 Mon Sep 17 00:00:00 2001 From: YuhanLiin Date: Tue, 1 Nov 2022 20:20:16 -0400 Subject: [PATCH 07/11] Change nightly flag to atomics --- .github/workflows/ci.yml | 18 +++++++++--------- CHANGELOG.md | 1 + ci/script.sh | 4 ++-- ci/svd2rust-regress/src/main.rs | 8 ++++---- ci/svd2rust-regress/src/svd_test.rs | 12 ++++++------ src/generate/device.rs | 4 ++-- src/lib.rs | 15 +++++---------- src/main.rs | 6 +++--- src/util.rs | 4 ++-- 9 files changed, 34 insertions(+), 38 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cdad59d2..221e5b94 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,36 +53,36 @@ jobs: - { rust: stable, vendor: Freescale, options: all } - { rust: stable, vendor: Freescale, options: "" } - { rust: stable, vendor: Fujitsu, options: "" } - - { rust: stable, vendor: Fujitsu, options: "--nightly" } + - { rust: stable, vendor: Fujitsu, options: "--atomics" } - { rust: stable, vendor: GD32, options: all } - { rust: stable, vendor: GD32, options: "" } - { rust: stable, vendor: Holtek, options: all } - { rust: stable, vendor: Holtek, options: "" } - { rust: stable, vendor: Microchip, options: "" } - - { rust: stable, vendor: Microchip, options: "--nightly" } + - { rust: stable, vendor: Microchip, options: "--atomics" } - { rust: stable, vendor: Nordic, options: all } - { rust: stable, vendor: Nordic, options: "" } - { rust: stable, vendor: Nuvoton, options: "" } - - { rust: stable, vendor: Nuvoton, options: "--nightly" } + - { rust: stable, vendor: Nuvoton, options: "--atomics" } - { rust: stable, vendor: NXP, options: all } - { rust: stable, vendor: NXP, options: "" } - { rust: stable, vendor: RISC-V, options: "" } - - { rust: stable, vendor: RISC-V, options: "--nightly" } + - { rust: stable, vendor: RISC-V, options: "--atomics" } - { rust: stable, vendor: SiliconLabs, options: all } - { rust: stable, vendor: SiliconLabs, options: "" } - { rust: stable, vendor: Spansion, options: "" } - - { rust: stable, vendor: Spansion, options: "--nightly" } + - { rust: stable, vendor: Spansion, options: "--atomics" } - { rust: stable, vendor: STMicro, options: "" } - - { rust: stable, vendor: STMicro, options: "--nightly" } - - { rust: stable, vendor: STM32-patched, options: "--strict --const_generic --derive_more --pascal_enum_values --max_cluster_size --nightly" } + - { rust: stable, vendor: STMicro, options: "--atomics" } + - { rust: stable, vendor: STM32-patched, options: "--strict --const_generic --derive_more --pascal_enum_values --max_cluster_size --atomics" } - { rust: stable, vendor: Toshiba, options: all } - { rust: stable, vendor: Toshiba, options: "" } # Test MSRV - { rust: 1.60.0, vendor: Nordic, options: "" } # Use nightly for architectures which don't support stable - - { rust: nightly, vendor: MSP430, options: "--nightly" } + - { rust: nightly, vendor: MSP430, options: "--atomics" } - { rust: nightly, vendor: MSP430, options: "" } - - { rust: nightly, vendor: Espressif, options: "--nightly" } + - { rust: nightly, vendor: Espressif, options: "--atomics" } - { rust: nightly, vendor: Espressif, options: "" } steps: diff --git a/CHANGELOG.md b/CHANGELOG.md index b64aea4c..22eef4c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - simplify ci strategy - Fix generated code for MSP430 atomics - Generate atomic register code for non-MSP430 targets +- Change --nightly flag to --atomics ## [v0.27.1] - 2022-10-25 diff --git a/ci/script.sh b/ci/script.sh index 66d845bb..1b697412 100755 --- a/ci/script.sh +++ b/ci/script.sh @@ -31,7 +31,7 @@ main() { case $OPTIONS in all) - options="--const_generic --strict --derive_more --nightly" + options="--const_generic --strict --derive_more --atomics" ;; *) options=$OPTIONS @@ -46,7 +46,7 @@ main() { if [[ "$options" == *"--derive_more"* ]]; then echo 'derive_more = "0.99"' >> $td/Cargo.toml fi - if [[ "$options" == *"--nightly"* ]]; then + if [[ "$options" == *"--atomics"* ]]; then echo 'portable-atomic = { version = "0.3.15", default-features = false }' >> $td/Cargo.toml fi echo '[profile.dev]' >> $td/Cargo.toml diff --git a/ci/svd2rust-regress/src/main.rs b/ci/svd2rust-regress/src/main.rs index 2ae4ec90..597fb46a 100644 --- a/ci/svd2rust-regress/src/main.rs +++ b/ci/svd2rust-regress/src/main.rs @@ -29,9 +29,9 @@ struct Opt { bin_path: Option, // TODO: Consider using the same strategy cargo uses for passing args to rustc via `--` - /// Run svd2rust with `--nightly` - #[structopt(long = "nightly")] - nightly: bool, + /// Run svd2rust with `--atomics` + #[structopt(long = "atomics")] + atomics: bool, /// Filter by chip name, case sensitive, may be combined with other filters #[structopt(short = "c", long = "chip", raw(validator = "validate_chips"))] @@ -240,7 +240,7 @@ fn main() { tests.par_iter().for_each(|t| { let start = Instant::now(); - match svd_test::test(t, &bin_path, rustfmt_bin_path, opt.nightly, opt.verbose) { + match svd_test::test(t, &bin_path, rustfmt_bin_path, opt.atomics, opt.verbose) { Ok(s) => { if let Some(stderrs) = s { let mut buf = String::new(); diff --git a/ci/svd2rust-regress/src/svd_test.rs b/ci/svd2rust-regress/src/svd_test.rs index d398314d..81e077ae 100644 --- a/ci/svd2rust-regress/src/svd_test.rs +++ b/ci/svd2rust-regress/src/svd_test.rs @@ -7,7 +7,7 @@ use std::process::{Command, Output}; const CRATES_ALL: &[&str] = &["critical-section = \"1.0\"", "vcell = \"0.1.2\""]; const CRATES_MSP430: &[&str] = &["msp430 = \"0.4.0\"", "msp430-rt = \"0.4.0\""]; -const CRATES_NIGHTLY: &[&str] = +const CRATES_ATOMICS: &[&str] = &["portable-atomic = { version = \"0.3.15\", default-features = false }"]; const CRATES_CORTEX_M: &[&str] = &["cortex-m = \"0.7.6\"", "cortex-m-rt = \"0.6.13\""]; const CRATES_RISCV: &[&str] = &["riscv = \"0.9.0\"", "riscv-rt = \"0.9.0\""]; @@ -85,7 +85,7 @@ pub fn test( t: &TestCase, bin_path: &PathBuf, rustfmt_bin_path: Option<&PathBuf>, - nightly: bool, + atomics: bool, verbosity: u8, ) -> Result>> { let user = match std::env::var("USER") { @@ -137,8 +137,8 @@ pub fn test( Msp430 => CRATES_MSP430.iter(), XtensaLX => CRATES_XTENSALX.iter(), }) - .chain(if nightly { - CRATES_NIGHTLY.iter() + .chain(if atomics { + CRATES_ATOMICS.iter() } else { [].iter() }) @@ -177,8 +177,8 @@ pub fn test( XtensaLX => "xtensa-lx", }; let mut svd2rust_bin = Command::new(bin_path); - if nightly { - svd2rust_bin.arg("--nightly"); + if atomics { + svd2rust_bin.arg("--atomics"); } let output = svd2rust_bin diff --git a/src/generate/device.rs b/src/generate/device.rs index 51e28b2e..eaa70c5e 100644 --- a/src/generate/device.rs +++ b/src/generate/device.rs @@ -152,7 +152,7 @@ pub fn render(d: &Device, config: &Config, device_x: &mut String) -> Result Result Result<()> { .value_name("ARCH"), ) .arg( - Arg::new("nightly") - .long("nightly") + Arg::new("atomics") + .long("atomics") .action(ArgAction::SetTrue) - .help("Enable features only available to nightly rustc"), + .help("Generate atomic register modification API"), ) .arg( Arg::new("const_generic") diff --git a/src/util.rs b/src/util.rs index 76047352..6f96d64c 100644 --- a/src/util.rs +++ b/src/util.rs @@ -27,7 +27,7 @@ pub struct Config { #[cfg_attr(feature = "serde", serde(default))] pub target: Target, #[cfg_attr(feature = "serde", serde(default))] - pub nightly: bool, + pub atomics: bool, #[cfg_attr(feature = "serde", serde(default))] pub generic_mod: bool, #[cfg_attr(feature = "serde", serde(default))] @@ -68,7 +68,7 @@ impl Default for Config { fn default() -> Self { Self { target: Target::default(), - nightly: false, + atomics: false, generic_mod: false, make_mod: false, const_generic: false, From 6cb9fa44e00e95f0a4ca0d90beb7399d48196225 Mon Sep 17 00:00:00 2001 From: YuhanLiin Date: Tue, 1 Nov 2022 20:24:55 -0400 Subject: [PATCH 08/11] Add atomic support for signed ints and 32-bit ints --- src/generate/generic_atomic.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/generate/generic_atomic.rs b/src/generate/generic_atomic.rs index 12e9e87d..6348c2b7 100644 --- a/src/generate/generic_atomic.rs +++ b/src/generate/generic_atomic.rs @@ -1,5 +1,5 @@ mod atomic { - use portable_atomic::{AtomicU16, AtomicU8, Ordering}; + use portable_atomic::Ordering; pub trait AtomicOperations { unsafe fn atomic_or(ptr: *mut Self, val: Self); @@ -24,8 +24,17 @@ mod atomic { } }; } - impl_atomics!(u8, AtomicU8); - impl_atomics!(u16, AtomicU16); + + impl_atomics!(u8, portable_atomic::AtomicU8); + impl_atomics!(i8, portable_atomic::AtomicI8); + impl_atomics!(u16, portable_atomic::AtomicU16); + impl_atomics!(i16, portable_atomic::AtomicI16); + + // Exclude 16-bit archs from 32-bit atomics + #[cfg(not(target_pointer_width = "16"))] + impl_atomics!(u32, portable_atomic::AtomicU32); + #[cfg(not(target_pointer_width = "16"))] + impl_atomics!(i32, portable_atomic::AtomicI32); } use atomic::AtomicOperations; From 74ad83900acb48b7cf7a04495652338250d1556e Mon Sep 17 00:00:00 2001 From: YuhanLiin Date: Tue, 1 Nov 2022 21:58:09 -0400 Subject: [PATCH 09/11] Remove signed atomics and add 64bit atomics for RISCV --- src/generate/generic_atomic.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/generate/generic_atomic.rs b/src/generate/generic_atomic.rs index 6348c2b7..7d9639db 100644 --- a/src/generate/generic_atomic.rs +++ b/src/generate/generic_atomic.rs @@ -26,15 +26,15 @@ mod atomic { } impl_atomics!(u8, portable_atomic::AtomicU8); - impl_atomics!(i8, portable_atomic::AtomicI8); impl_atomics!(u16, portable_atomic::AtomicU16); - impl_atomics!(i16, portable_atomic::AtomicI16); // Exclude 16-bit archs from 32-bit atomics #[cfg(not(target_pointer_width = "16"))] impl_atomics!(u32, portable_atomic::AtomicU32); - #[cfg(not(target_pointer_width = "16"))] - impl_atomics!(i32, portable_atomic::AtomicI32); + + // Enable 64-bit atomics for 64-bit RISCV + #[cfg(any(target_pointer_width = "64", target_has_atomic = "64"))] + impl_atomics!(u64, portable_atomic::AtomicU64); } use atomic::AtomicOperations; From 4b479d065bf0c77d007365fbefcfba1af311f745 Mon Sep 17 00:00:00 2001 From: YuhanLiin Date: Thu, 3 Nov 2022 17:34:58 -0400 Subject: [PATCH 10/11] Document lack of support for RISCV without atomic --- src/lib.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index b294f4c2..de6af1ac 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -489,10 +489,11 @@ //! The `--atomics` flag can be passed to `svd2rust` to extends the register API with operations to //! atomically set, clear, and toggle specific bits. The atomic operations allow limited //! modification of register bits without read-modify-write sequences. As such, they can be -//! concurrently called on different bits in the same register without data races. +//! concurrently called on different bits in the same register without data races. This flag won't +//! work for RISCV chips without the atomic extension. //! -//! `portable-atomic` v0.3.15 must be added to the dependencies, with default features off if -//! possible to disable the `fallback` feature. +//! `portable-atomic` v0.3.15 must be added to the dependencies, with default features off to +//! disable the `fallback` feature. //! //! Usage examples: //! From c97573ad8e3dad35b0374a6f53eeecde296d87ac Mon Sep 17 00:00:00 2001 From: YuhanLiin Date: Sat, 24 Dec 2022 21:45:18 -0500 Subject: [PATCH 11/11] Bump portable-atomic to 0.3.16 and stop using fetch_* methods --- ci/script.sh | 2 +- ci/svd2rust-regress/src/svd_test.rs | 2 +- src/generate/generic_atomic.rs | 6 +++--- src/lib.rs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ci/script.sh b/ci/script.sh index 1b697412..8d86d40a 100755 --- a/ci/script.sh +++ b/ci/script.sh @@ -47,7 +47,7 @@ main() { echo 'derive_more = "0.99"' >> $td/Cargo.toml fi if [[ "$options" == *"--atomics"* ]]; then - echo 'portable-atomic = { version = "0.3.15", default-features = false }' >> $td/Cargo.toml + echo 'portable-atomic = { version = "0.3.16", default-features = false }' >> $td/Cargo.toml fi echo '[profile.dev]' >> $td/Cargo.toml echo 'incremental = false' >> $td/Cargo.toml diff --git a/ci/svd2rust-regress/src/svd_test.rs b/ci/svd2rust-regress/src/svd_test.rs index 81e077ae..4c5368af 100644 --- a/ci/svd2rust-regress/src/svd_test.rs +++ b/ci/svd2rust-regress/src/svd_test.rs @@ -8,7 +8,7 @@ use std::process::{Command, Output}; const CRATES_ALL: &[&str] = &["critical-section = \"1.0\"", "vcell = \"0.1.2\""]; const CRATES_MSP430: &[&str] = &["msp430 = \"0.4.0\"", "msp430-rt = \"0.4.0\""]; const CRATES_ATOMICS: &[&str] = - &["portable-atomic = { version = \"0.3.15\", default-features = false }"]; + &["portable-atomic = { version = \"0.3.16\", default-features = false }"]; const CRATES_CORTEX_M: &[&str] = &["cortex-m = \"0.7.6\"", "cortex-m-rt = \"0.6.13\""]; const CRATES_RISCV: &[&str] = &["riscv = \"0.9.0\"", "riscv-rt = \"0.9.0\""]; const CRATES_XTENSALX: &[&str] = &["xtensa-lx-rt = \"0.9.0\"", "xtensa-lx = \"0.6.0\""]; diff --git a/src/generate/generic_atomic.rs b/src/generate/generic_atomic.rs index 7d9639db..c9f5380a 100644 --- a/src/generate/generic_atomic.rs +++ b/src/generate/generic_atomic.rs @@ -11,15 +11,15 @@ mod atomic { ($U:ty, $Atomic:ty) => { impl AtomicOperations for $U { unsafe fn atomic_or(ptr: *mut Self, val: Self) { - (*(ptr as *const $Atomic)).fetch_or(val, Ordering::SeqCst); + (*(ptr as *const $Atomic)).or(val, Ordering::SeqCst); } unsafe fn atomic_and(ptr: *mut Self, val: Self) { - (*(ptr as *const $Atomic)).fetch_and(val, Ordering::SeqCst); + (*(ptr as *const $Atomic)).and(val, Ordering::SeqCst); } unsafe fn atomic_xor(ptr: *mut Self, val: Self) { - (*(ptr as *const $Atomic)).fetch_xor(val, Ordering::SeqCst); + (*(ptr as *const $Atomic)).xor(val, Ordering::SeqCst); } } }; diff --git a/src/lib.rs b/src/lib.rs index de6af1ac..2f1a90e7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -492,7 +492,7 @@ //! concurrently called on different bits in the same register without data races. This flag won't //! work for RISCV chips without the atomic extension. //! -//! `portable-atomic` v0.3.15 must be added to the dependencies, with default features off to +//! `portable-atomic` v0.3.16 must be added to the dependencies, with default features off to //! disable the `fallback` feature. //! //! Usage examples: