Skip to content

Commit c5e0b55

Browse files
committed
Change nightly flag to atomics
1 parent 58278ee commit c5e0b55

File tree

9 files changed

+34
-38
lines changed

9 files changed

+34
-38
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,36 +53,36 @@ jobs:
5353
- { rust: stable, vendor: Freescale, options: all }
5454
- { rust: stable, vendor: Freescale, options: "" }
5555
- { rust: stable, vendor: Fujitsu, options: "" }
56-
- { rust: stable, vendor: Fujitsu, options: "--nightly" }
56+
- { rust: stable, vendor: Fujitsu, options: "--atomics" }
5757
- { rust: stable, vendor: GD32, options: all }
5858
- { rust: stable, vendor: GD32, options: "" }
5959
- { rust: stable, vendor: Holtek, options: all }
6060
- { rust: stable, vendor: Holtek, options: "" }
6161
- { rust: stable, vendor: Microchip, options: "" }
62-
- { rust: stable, vendor: Microchip, options: "--nightly" }
62+
- { rust: stable, vendor: Microchip, options: "--atomics" }
6363
- { rust: stable, vendor: Nordic, options: all }
6464
- { rust: stable, vendor: Nordic, options: "" }
6565
- { rust: stable, vendor: Nuvoton, options: "" }
66-
- { rust: stable, vendor: Nuvoton, options: "--nightly" }
66+
- { rust: stable, vendor: Nuvoton, options: "--atomics" }
6767
- { rust: stable, vendor: NXP, options: all }
6868
- { rust: stable, vendor: NXP, options: "" }
6969
- { rust: stable, vendor: RISC-V, options: "" }
70-
- { rust: stable, vendor: RISC-V, options: "--nightly" }
70+
- { rust: stable, vendor: RISC-V, options: "--atomics" }
7171
- { rust: stable, vendor: SiliconLabs, options: all }
7272
- { rust: stable, vendor: SiliconLabs, options: "" }
7373
- { rust: stable, vendor: Spansion, options: "" }
74-
- { rust: stable, vendor: Spansion, options: "--nightly" }
74+
- { rust: stable, vendor: Spansion, options: "--atomics" }
7575
- { rust: stable, vendor: STMicro, options: "" }
76-
- { rust: stable, vendor: STMicro, options: "--nightly" }
77-
- { rust: stable, vendor: STM32-patched, options: "--strict --const_generic --derive_more --pascal_enum_values --max_cluster_size --nightly" }
76+
- { rust: stable, vendor: STMicro, options: "--atomics" }
77+
- { rust: stable, vendor: STM32-patched, options: "--strict --const_generic --derive_more --pascal_enum_values --max_cluster_size --atomics" }
7878
- { rust: stable, vendor: Toshiba, options: all }
7979
- { rust: stable, vendor: Toshiba, options: "" }
8080
# Test MSRV
8181
- { rust: 1.60.0, vendor: Nordic, options: "" }
8282
# Use nightly for architectures which don't support stable
83-
- { rust: nightly, vendor: MSP430, options: "--nightly" }
83+
- { rust: nightly, vendor: MSP430, options: "--atomics" }
8484
- { rust: nightly, vendor: MSP430, options: "" }
85-
- { rust: nightly, vendor: Espressif, options: "--nightly" }
85+
- { rust: nightly, vendor: Espressif, options: "--atomics" }
8686
- { rust: nightly, vendor: Espressif, options: "" }
8787

8888
steps:

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1212
- simplify ci strategy
1313
- Fix generated code for MSP430 atomics
1414
- Generate atomic register code for non-MSP430 targets
15+
- Change --nightly flag to --atomics
1516

1617
## [v0.27.1] - 2022-10-25
1718

ci/script.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ main() {
3131

3232
case $OPTIONS in
3333
all)
34-
options="--const_generic --strict --derive_more --nightly"
34+
options="--const_generic --strict --derive_more --atomics"
3535
;;
3636
*)
3737
options=$OPTIONS
@@ -46,7 +46,7 @@ main() {
4646
if [[ "$options" == *"--derive_more"* ]]; then
4747
echo 'derive_more = "0.99"' >> $td/Cargo.toml
4848
fi
49-
if [[ "$options" == *"--nightly"* ]]; then
49+
if [[ "$options" == *"--atomics"* ]]; then
5050
echo 'portable-atomic = { version = "0.3.15", default-features = false }' >> $td/Cargo.toml
5151
fi
5252
echo '[profile.dev]' >> $td/Cargo.toml

ci/svd2rust-regress/src/main.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ struct Opt {
2929
bin_path: Option<PathBuf>,
3030

3131
// TODO: Consider using the same strategy cargo uses for passing args to rustc via `--`
32-
/// Run svd2rust with `--nightly`
33-
#[structopt(long = "nightly")]
34-
nightly: bool,
32+
/// Run svd2rust with `--atomics`
33+
#[structopt(long = "atomics")]
34+
atomics: bool,
3535

3636
/// Filter by chip name, case sensitive, may be combined with other filters
3737
#[structopt(short = "c", long = "chip", raw(validator = "validate_chips"))]
@@ -240,7 +240,7 @@ fn main() {
240240
tests.par_iter().for_each(|t| {
241241
let start = Instant::now();
242242

243-
match svd_test::test(t, &bin_path, rustfmt_bin_path, opt.nightly, opt.verbose) {
243+
match svd_test::test(t, &bin_path, rustfmt_bin_path, opt.atomics, opt.verbose) {
244244
Ok(s) => {
245245
if let Some(stderrs) = s {
246246
let mut buf = String::new();

ci/svd2rust-regress/src/svd_test.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::process::{Command, Output};
77

88
const CRATES_ALL: &[&str] = &["critical-section = \"1.0\"", "vcell = \"0.1.2\""];
99
const CRATES_MSP430: &[&str] = &["msp430 = \"0.4.0\"", "msp430-rt = \"0.4.0\""];
10-
const CRATES_NIGHTLY: &[&str] =
10+
const CRATES_ATOMICS: &[&str] =
1111
&["portable-atomic = { version = \"0.3.15\", default-features = false }"];
1212
const CRATES_CORTEX_M: &[&str] = &["cortex-m = \"0.7.6\"", "cortex-m-rt = \"0.6.13\""];
1313
const CRATES_RISCV: &[&str] = &["riscv = \"0.9.0\"", "riscv-rt = \"0.9.0\""];
@@ -85,7 +85,7 @@ pub fn test(
8585
t: &TestCase,
8686
bin_path: &PathBuf,
8787
rustfmt_bin_path: Option<&PathBuf>,
88-
nightly: bool,
88+
atomics: bool,
8989
verbosity: u8,
9090
) -> Result<Option<Vec<PathBuf>>> {
9191
let user = match std::env::var("USER") {
@@ -137,8 +137,8 @@ pub fn test(
137137
Msp430 => CRATES_MSP430.iter(),
138138
XtensaLX => CRATES_XTENSALX.iter(),
139139
})
140-
.chain(if nightly {
141-
CRATES_NIGHTLY.iter()
140+
.chain(if atomics {
141+
CRATES_ATOMICS.iter()
142142
} else {
143143
[].iter()
144144
})
@@ -177,8 +177,8 @@ pub fn test(
177177
XtensaLX => "xtensa-lx",
178178
};
179179
let mut svd2rust_bin = Command::new(bin_path);
180-
if nightly {
181-
svd2rust_bin.arg("--nightly");
180+
if atomics {
181+
svd2rust_bin.arg("--atomics");
182182
}
183183

184184
let output = svd2rust_bin

src/generate/device.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ pub fn render(d: &Device, config: &Config, device_x: &mut String) -> Result<Toke
152152
if config.generic_mod {
153153
let mut file = File::create(config.output_dir.join("generic.rs"))?;
154154
writeln!(file, "{}", generic_file)?;
155-
if config.nightly {
155+
if config.atomics {
156156
writeln!(file, "\n{}", generic_atomic_file)?;
157157
}
158158
if config.const_generic {
@@ -169,7 +169,7 @@ pub fn render(d: &Device, config: &Config, device_x: &mut String) -> Result<Toke
169169
}
170170
} else {
171171
let mut tokens = syn::parse_file(generic_file)?.into_token_stream();
172-
if config.nightly {
172+
if config.atomics {
173173
syn::parse_file(generic_atomic_file)?.to_tokens(&mut tokens);
174174
}
175175
if config.const_generic {

src/lib.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -484,17 +484,12 @@
484484
//!
485485
//! [`interrupt`]: https://docs.rs/cortex-m-rt-macros/0.1/cortex_m_rt_macros/attr.interrupt.html
486486
//!
487-
//! ## the `--nightly` flag
487+
//! ## the `--atomics` flag
488488
//!
489-
//! The `--nightly` flag can be passed to `svd2rust` to enable features in the generated api that are only available to a nightly
490-
//! compiler. The following features are gated by the `--nightly` flag:
491-
//!
492-
//! ### Atomics
493-
//!
494-
//! Extends the register API with operations to atomically set, clear, and toggle specific bits.
495-
//! The atomic operations allow limited modification of register bits without read-modify-write
496-
//! sequences. As such, they can be concurrently called on different bits in the same register
497-
//! without data races.
489+
//! The `--atomics` flag can be passed to `svd2rust` to extends the register API with operations to
490+
//! atomically set, clear, and toggle specific bits. The atomic operations allow limited
491+
//! modification of register bits without read-modify-write sequences. As such, they can be
492+
//! concurrently called on different bits in the same register without data races.
498493
//!
499494
//! `portable-atomic` v0.3.15 must be added to the dependencies, with default features off if
500495
//! possible to disable the `fallback` feature.

src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ fn run() -> Result<()> {
6767
.value_name("ARCH"),
6868
)
6969
.arg(
70-
Arg::new("nightly")
71-
.long("nightly")
70+
Arg::new("atomics")
71+
.long("atomics")
7272
.action(ArgAction::SetTrue)
73-
.help("Enable features only available to nightly rustc"),
73+
.help("Generate atomic register modification API"),
7474
)
7575
.arg(
7676
Arg::new("const_generic")

src/util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub struct Config {
2727
#[cfg_attr(feature = "serde", serde(default))]
2828
pub target: Target,
2929
#[cfg_attr(feature = "serde", serde(default))]
30-
pub nightly: bool,
30+
pub atomics: bool,
3131
#[cfg_attr(feature = "serde", serde(default))]
3232
pub generic_mod: bool,
3333
#[cfg_attr(feature = "serde", serde(default))]
@@ -68,7 +68,7 @@ impl Default for Config {
6868
fn default() -> Self {
6969
Self {
7070
target: Target::default(),
71-
nightly: false,
71+
atomics: false,
7272
generic_mod: false,
7373
make_mod: false,
7474
const_generic: false,

0 commit comments

Comments
 (0)