Skip to content

Commit bd7b276

Browse files
committed
Use asm::nop in empty loops
See rust-lang/rust#28728
1 parent aca0d52 commit bd7b276

File tree

13 files changed

+37
-13
lines changed

13 files changed

+37
-13
lines changed

.github/workflows/clippy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ jobs:
1919
- uses: actions-rs/clippy-check@v1
2020
with:
2121
token: ${{ secrets.GITHUB_TOKEN }}
22-
args: --examples --target thumbv7em-none-eabihf --features=rt,stm32h743v -- -A clippy::empty_loop
22+
args: --examples --target thumbv7em-none-eabihf --features=rt,stm32h743v

examples/dma.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,5 +104,7 @@ fn main() -> ! {
104104

105105
info!("Memory to Memory DMA completed successfully");
106106

107-
loop {}
107+
loop {
108+
cortex_m::asm::nop()
109+
}
108110
}

examples/fmc.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ const APP: () = {
213213

214214
assert_eq!(ram_slice[0], 1);
215215

216-
loop {}
216+
loop {
217+
cortex_m::asm::nop()
218+
}
217219
}
218220
};

examples/fractional-pll.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,7 @@ fn main() -> ! {
5151

5252
let _mco2_ck = ccdr.clocks.mco2_ck().unwrap().0;
5353

54-
loop {}
54+
loop {
55+
cortex_m::asm::nop()
56+
}
5557
}

examples/i2c4_bdma.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,5 +129,7 @@ fn I2C4_EV() {
129129

130130
assert_eq!(buffer[0], 0xBE);
131131

132-
loop {}
132+
loop {
133+
cortex_m::asm::nop()
134+
}
133135
}

examples/mco.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,7 @@ fn main() -> ! {
5959

6060
info!("MCO outputs running!");
6161

62-
loop {}
62+
loop {
63+
cortex_m::asm::nop()
64+
}
6365
}

examples/prec_kernel_clocks.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,7 @@ fn main() -> ! {
4949
// Can't change group clocks - ccdr.peripheral has been partially used
5050
//ccdr.peripheral.kernel_i2c123_clk_mux(I2c123ClkSel::HSI_KER);
5151

52-
loop {}
52+
loop {
53+
cortex_m::asm::nop()
54+
}
5355
}

examples/pwm.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,5 +78,7 @@ fn main() -> ! {
7878
pwm.set_duty(max / 2);
7979
pwm.enable();
8080

81-
loop {}
81+
loop {
82+
cortex_m::asm::nop()
83+
}
8284
}

examples/rcc.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,7 @@ fn main() -> ! {
3737
info!("sys_ck = {} MHz", ccdr.clocks.sys_ck().0 as f32 / 1e6);
3838
assert_eq!(ccdr.clocks.sys_ck().0, 100_000_000);
3939

40-
loop {}
40+
loop {
41+
cortex_m::asm::nop()
42+
}
4143
}

examples/sdmmc.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,5 +166,7 @@ fn main() -> ! {
166166

167167
info!("Done!");
168168

169-
loop {}
169+
loop {
170+
cortex_m::asm::nop()
171+
}
170172
}

examples/spi-dma.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,5 +176,7 @@ fn main() -> ! {
176176

177177
// We could re-use the stream or spi here
178178

179-
loop {}
179+
loop {
180+
cortex_m::asm::nop()
181+
}
180182
}

examples/vos0.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,7 @@ fn main() -> ! {
4141
info!("sys_ck = {} MHz", ccdr.clocks.sys_ck().0 as f32 / 1e6);
4242
assert_eq!(ccdr.clocks.sys_ck().0, 480_000_000);
4343

44-
loop {}
44+
loop {
45+
cortex_m::asm::nop()
46+
}
4547
}

examples/watchdog.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,7 @@ fn main() -> ! {
4545
// -> restart the chip
4646
watchdog.start(100.ms());
4747

48-
loop {}
48+
loop {
49+
cortex_m::asm::nop()
50+
}
4951
}

0 commit comments

Comments
 (0)