diff --git a/CHANGELOG.md b/CHANGELOG.md index e600f0cd..2cff6792 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/). - Fix escaping <> and & characters in doc attributes - Add `interrupt_link_section` config parameter for controlling the `#[link_section = "..."]` attribute of `__INTERRUPTS` - Add option to implement Debug for readable registers (#716) +- Add `atomics-feature` ## [v0.28.0] - 2022-12-25 diff --git a/src/generate/device.rs b/src/generate/device.rs index a7738af0..804fe676 100644 --- a/src/generate/device.rs +++ b/src/generate/device.rs @@ -153,6 +153,9 @@ pub fn render(d: &Device, config: &Config, device_x: &mut String) -> Result Result Result<()> { .action(ArgAction::SetTrue) .help("Generate atomic register modification API"), ) + .arg( + Arg::new("atomics_feature") + .long("atomics_feature") + .help("add feature gating for atomic register modification API") + .action(ArgAction::Set) + .value_name("FEATURE"), + ) .arg( Arg::new("const_generic") .long("const_generic") diff --git a/src/util.rs b/src/util.rs index aba3cab5..513a6951 100644 --- a/src/util.rs +++ b/src/util.rs @@ -30,6 +30,8 @@ pub struct Config { #[cfg_attr(feature = "serde", serde(default))] pub atomics: bool, #[cfg_attr(feature = "serde", serde(default))] + pub atomics_feature: Option, + #[cfg_attr(feature = "serde", serde(default))] pub generic_mod: bool, #[cfg_attr(feature = "serde", serde(default))] pub make_mod: bool, @@ -111,6 +113,7 @@ impl Default for Config { Self { target: Target::default(), atomics: false, + atomics_feature: None, generic_mod: false, make_mod: false, const_generic: false,