diff --git a/Cargo.toml b/Cargo.toml index 2bf6c60..1619e44 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ documentation = "https://docs.rs/qingke" homepage = "https://github.com/ch32-rs/qingke" categories = ["embedded", "no-std", "hardware-support"] license = "MIT/Apache-2.0" -version = "0.4.0" # for rt and macros +version = "0.5.0" # for rt and macros edition = "2021" [package] @@ -37,6 +37,7 @@ defmt = { version = "0.3.8", optional = true } critical-section-impl = ["dep:critical-section"] defmt = ["dep:defmt"] v3 = [] +unsafe-trust-wch-atomics = [] [package.metadata.docs.rs] targets = ["riscv32imac-unknown-none-elf"] diff --git a/qingke-rt/Cargo.toml b/qingke-rt/Cargo.toml index cb83435..dd54c73 100644 --- a/qingke-rt/Cargo.toml +++ b/qingke-rt/Cargo.toml @@ -25,8 +25,8 @@ u-mode = [] highcode = [] [dependencies] -qingke-rt-macros = { path = "./macros", version = "0.4" } -qingke = { path = "../", version = "0.4", features = ["critical-section-impl"] } +qingke-rt-macros = { path = "./macros" } +qingke = { path = "../", features = ["critical-section-impl"] } [package.metadata.docs.rs] targets = ["riscv32imac-unknown-none-elf"] diff --git a/src/lib.rs b/src/lib.rs index 016770e..39eb191 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -11,5 +11,22 @@ pub mod register; // re-export pub use riscv; +#[cfg(all( + any( + target_has_atomic = "8", + // target_has_atomic = "16", + // target_has_atomic = "32", + // target_has_atomic = "64", + // target_has_atomic = "128", + // target_has_atomic = "ptr" + ), + not(feature = "unsafe-trust-wch-atomics") +))] +compile_error!( + "As tested on QingKe V4, most likely the atomics are broken, +please validate the atomic instruction on the hardware using +something like litmus test suite before trusting them." +); + #[cfg(feature = "critical-section-impl")] mod critical_section_impl;