aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2024-10-13 22:20:00 +0000
committerGitHub <[email protected]>2024-10-13 22:20:00 +0000
commitc84495ef2eb99580fea5392b2b3aff5ad66043a0 (patch)
tree12f265a48ac95cef8c91b0fb2ce7443dd6328988
parent4eb820ab6c50a0bd84f22439dab305289b3ba4a1 (diff)
parent9a45d776d870582cda3db0db233e3f5aea15d34e (diff)
Merge pull request #3416 from embassy-rs/update-nightly-324
Update nighlty, fix warnings.
-rw-r--r--embassy-net-driver-channel/src/lib.rs10
-rw-r--r--embassy-net-driver/src/lib.rs6
-rw-r--r--embassy-net-enc28j60/src/lib.rs6
-rw-r--r--embassy-net-tuntap/src/lib.rs10
-rw-r--r--embassy-net/src/driver_util.rs10
-rw-r--r--embassy-net/src/tcp.rs5
-rw-r--r--embassy-rp/src/lib.rs6
-rw-r--r--embassy-rp/src/multicore.rs4
-rw-r--r--embassy-stm32-wpan/src/lib.rs1
-rw-r--r--embassy-stm32-wpan/src/mac/commands.rs2
-rw-r--r--embassy-stm32-wpan/src/mac/driver.rs10
-rw-r--r--embassy-stm32/src/eth/mod.rs10
-rw-r--r--embassy-stm32/src/low_power.rs3
-rw-r--r--embassy-stm32/src/rcc/mod.rs10
-rw-r--r--examples/stm32h7/src/bin/sai.rs10
-rw-r--r--examples/stm32h7/src/bin/spi_bdma.rs7
-rw-r--r--rust-toolchain-nightly.toml2
-rw-r--r--tests/nrf/src/bin/buffered_uart_spam.rs2
-rw-r--r--tests/stm32/src/bin/usart_rx_ringbuffered.rs3
19 files changed, 82 insertions, 35 deletions
diff --git a/embassy-net-driver-channel/src/lib.rs b/embassy-net-driver-channel/src/lib.rs
index 7ad4d449e..6390502a8 100644
--- a/embassy-net-driver-channel/src/lib.rs
+++ b/embassy-net-driver-channel/src/lib.rs
@@ -326,8 +326,14 @@ pub struct Device<'d, const MTU: usize> {
326} 326}
327 327
328impl<'d, const MTU: usize> embassy_net_driver::Driver for Device<'d, MTU> { 328impl<'d, const MTU: usize> embassy_net_driver::Driver for Device<'d, MTU> {
329 type RxToken<'a> = RxToken<'a, MTU> where Self: 'a ; 329 type RxToken<'a>
330 type TxToken<'a> = TxToken<'a, MTU> where Self: 'a ; 330 = RxToken<'a, MTU>
331 where
332 Self: 'a;
333 type TxToken<'a>
334 = TxToken<'a, MTU>
335 where
336 Self: 'a;
331 337
332 fn receive(&mut self, cx: &mut Context) -> Option<(Self::RxToken<'_>, Self::TxToken<'_>)> { 338 fn receive(&mut self, cx: &mut Context) -> Option<(Self::RxToken<'_>, Self::TxToken<'_>)> {
333 if self.rx.poll_receive(cx).is_ready() && self.tx.poll_send(cx).is_ready() { 339 if self.rx.poll_receive(cx).is_ready() && self.tx.poll_send(cx).is_ready() {
diff --git a/embassy-net-driver/src/lib.rs b/embassy-net-driver/src/lib.rs
index 87f9f6ed1..4c847718d 100644
--- a/embassy-net-driver/src/lib.rs
+++ b/embassy-net-driver/src/lib.rs
@@ -83,10 +83,12 @@ pub trait Driver {
83} 83}
84 84
85impl<T: ?Sized + Driver> Driver for &mut T { 85impl<T: ?Sized + Driver> Driver for &mut T {
86 type RxToken<'a> = T::RxToken<'a> 86 type RxToken<'a>
87 = T::RxToken<'a>
87 where 88 where
88 Self: 'a; 89 Self: 'a;
89 type TxToken<'a> = T::TxToken<'a> 90 type TxToken<'a>
91 = T::TxToken<'a>
90 where 92 where
91 Self: 'a; 93 Self: 'a;
92 94
diff --git a/embassy-net-enc28j60/src/lib.rs b/embassy-net-enc28j60/src/lib.rs
index dda35f498..c1f32719a 100644
--- a/embassy-net-enc28j60/src/lib.rs
+++ b/embassy-net-enc28j60/src/lib.rs
@@ -635,11 +635,13 @@ where
635 S: SpiDevice, 635 S: SpiDevice,
636 O: OutputPin, 636 O: OutputPin,
637{ 637{
638 type RxToken<'a> = RxToken<'a> 638 type RxToken<'a>
639 = RxToken<'a>
639 where 640 where
640 Self: 'a; 641 Self: 'a;
641 642
642 type TxToken<'a> = TxToken<'a, S, O> 643 type TxToken<'a>
644 = TxToken<'a, S, O>
643 where 645 where
644 Self: 'a; 646 Self: 'a;
645 647
diff --git a/embassy-net-tuntap/src/lib.rs b/embassy-net-tuntap/src/lib.rs
index 56f55fba1..2ff23f462 100644
--- a/embassy-net-tuntap/src/lib.rs
+++ b/embassy-net-tuntap/src/lib.rs
@@ -152,8 +152,14 @@ impl TunTapDevice {
152} 152}
153 153
154impl Driver for TunTapDevice { 154impl Driver for TunTapDevice {
155 type RxToken<'a> = RxToken where Self: 'a; 155 type RxToken<'a>
156 type TxToken<'a> = TxToken<'a> where Self: 'a; 156 = RxToken
157 where
158 Self: 'a;
159 type TxToken<'a>
160 = TxToken<'a>
161 where
162 Self: 'a;
157 163
158 fn receive(&mut self, cx: &mut Context) -> Option<(Self::RxToken<'_>, Self::TxToken<'_>)> { 164 fn receive(&mut self, cx: &mut Context) -> Option<(Self::RxToken<'_>, Self::TxToken<'_>)> {
159 let mut buf = vec![0; self.device.get_ref().mtu]; 165 let mut buf = vec![0; self.device.get_ref().mtu];
diff --git a/embassy-net/src/driver_util.rs b/embassy-net/src/driver_util.rs
index b2af1d499..f51641425 100644
--- a/embassy-net/src/driver_util.rs
+++ b/embassy-net/src/driver_util.rs
@@ -18,8 +18,14 @@ impl<'d, 'c, T> phy::Device for DriverAdapter<'d, 'c, T>
18where 18where
19 T: Driver, 19 T: Driver,
20{ 20{
21 type RxToken<'a> = RxTokenAdapter<T::RxToken<'a>> where Self: 'a; 21 type RxToken<'a>
22 type TxToken<'a> = TxTokenAdapter<T::TxToken<'a>> where Self: 'a; 22 = RxTokenAdapter<T::RxToken<'a>>
23 where
24 Self: 'a;
25 type TxToken<'a>
26 = TxTokenAdapter<T::TxToken<'a>>
27 where
28 Self: 'a;
23 29
24 fn receive(&mut self, _timestamp: Instant) -> Option<(Self::RxToken<'_>, Self::TxToken<'_>)> { 30 fn receive(&mut self, _timestamp: Instant) -> Option<(Self::RxToken<'_>, Self::TxToken<'_>)> {
25 self.inner 31 self.inner
diff --git a/embassy-net/src/tcp.rs b/embassy-net/src/tcp.rs
index 1bd582b65..043062e06 100644
--- a/embassy-net/src/tcp.rs
+++ b/embassy-net/src/tcp.rs
@@ -712,7 +712,10 @@ pub mod client {
712 for TcpClient<'d, N, TX_SZ, RX_SZ> 712 for TcpClient<'d, N, TX_SZ, RX_SZ>
713 { 713 {
714 type Error = Error; 714 type Error = Error;
715 type Connection<'m> = TcpConnection<'m, N, TX_SZ, RX_SZ> where Self: 'm; 715 type Connection<'m>
716 = TcpConnection<'m, N, TX_SZ, RX_SZ>
717 where
718 Self: 'm;
716 719
717 async fn connect<'a>(&'a self, remote: core::net::SocketAddr) -> Result<Self::Connection<'a>, Self::Error> { 720 async fn connect<'a>(&'a self, remote: core::net::SocketAddr) -> Result<Self::Connection<'a>, Self::Error> {
718 let addr: crate::IpAddress = match remote.ip() { 721 let addr: crate::IpAddress = match remote.ip() {
diff --git a/embassy-rp/src/lib.rs b/embassy-rp/src/lib.rs
index 7ac18c1f8..f56cfba27 100644
--- a/embassy-rp/src/lib.rs
+++ b/embassy-rp/src/lib.rs
@@ -480,7 +480,7 @@ pub fn install_core0_stack_guard() -> Result<(), ()> {
480 480
481#[cfg(all(feature = "rp2040", not(feature = "_test")))] 481#[cfg(all(feature = "rp2040", not(feature = "_test")))]
482#[inline(always)] 482#[inline(always)]
483fn install_stack_guard(stack_bottom: *mut usize) -> Result<(), ()> { 483unsafe fn install_stack_guard(stack_bottom: *mut usize) -> Result<(), ()> {
484 let core = unsafe { cortex_m::Peripherals::steal() }; 484 let core = unsafe { cortex_m::Peripherals::steal() };
485 485
486 // Fail if MPU is already configured 486 // Fail if MPU is already configured
@@ -508,7 +508,7 @@ fn install_stack_guard(stack_bottom: *mut usize) -> Result<(), ()> {
508 508
509#[cfg(all(feature = "_rp235x", not(feature = "_test")))] 509#[cfg(all(feature = "_rp235x", not(feature = "_test")))]
510#[inline(always)] 510#[inline(always)]
511fn install_stack_guard(stack_bottom: *mut usize) -> Result<(), ()> { 511unsafe fn install_stack_guard(stack_bottom: *mut usize) -> Result<(), ()> {
512 let core = unsafe { cortex_m::Peripherals::steal() }; 512 let core = unsafe { cortex_m::Peripherals::steal() };
513 513
514 // Fail if MPU is already configured 514 // Fail if MPU is already configured
@@ -528,7 +528,7 @@ fn install_stack_guard(stack_bottom: *mut usize) -> Result<(), ()> {
528// so the compile fails when we try to use ARMv8 peripherals. 528// so the compile fails when we try to use ARMv8 peripherals.
529#[cfg(feature = "_test")] 529#[cfg(feature = "_test")]
530#[inline(always)] 530#[inline(always)]
531fn install_stack_guard(_stack_bottom: *mut usize) -> Result<(), ()> { 531unsafe fn install_stack_guard(_stack_bottom: *mut usize) -> Result<(), ()> {
532 Ok(()) 532 Ok(())
533} 533}
534 534
diff --git a/embassy-rp/src/multicore.rs b/embassy-rp/src/multicore.rs
index 81de84907..ea0a29a36 100644
--- a/embassy-rp/src/multicore.rs
+++ b/embassy-rp/src/multicore.rs
@@ -58,7 +58,7 @@ const RESUME_TOKEN: u32 = !0xDEADBEEF;
58static IS_CORE1_INIT: AtomicBool = AtomicBool::new(false); 58static IS_CORE1_INIT: AtomicBool = AtomicBool::new(false);
59 59
60#[inline(always)] 60#[inline(always)]
61fn core1_setup(stack_bottom: *mut usize) { 61unsafe fn core1_setup(stack_bottom: *mut usize) {
62 if install_stack_guard(stack_bottom).is_err() { 62 if install_stack_guard(stack_bottom).is_err() {
63 // currently only happens if the MPU was already set up, which 63 // currently only happens if the MPU was already set up, which
64 // would indicate that the core is already in use from outside 64 // would indicate that the core is already in use from outside
@@ -148,7 +148,7 @@ where
148 entry: *mut ManuallyDrop<F>, 148 entry: *mut ManuallyDrop<F>,
149 stack_bottom: *mut usize, 149 stack_bottom: *mut usize,
150 ) -> ! { 150 ) -> ! {
151 core1_setup(stack_bottom); 151 unsafe { core1_setup(stack_bottom) };
152 152
153 let entry = unsafe { ManuallyDrop::take(&mut *entry) }; 153 let entry = unsafe { ManuallyDrop::take(&mut *entry) };
154 154
diff --git a/embassy-stm32-wpan/src/lib.rs b/embassy-stm32-wpan/src/lib.rs
index f9560d235..fb34d4ba0 100644
--- a/embassy-stm32-wpan/src/lib.rs
+++ b/embassy-stm32-wpan/src/lib.rs
@@ -2,6 +2,7 @@
2#![allow(async_fn_in_trait)] 2#![allow(async_fn_in_trait)]
3#![doc = include_str!("../README.md")] 3#![doc = include_str!("../README.md")]
4// #![warn(missing_docs)] 4// #![warn(missing_docs)]
5#![allow(static_mut_refs)] // TODO: Fix
5 6
6// This must go FIRST so that all the other modules see its macros. 7// This must go FIRST so that all the other modules see its macros.
7mod fmt; 8mod fmt;
diff --git a/embassy-stm32-wpan/src/mac/commands.rs b/embassy-stm32-wpan/src/mac/commands.rs
index c97c609c3..82b9d2772 100644
--- a/embassy-stm32-wpan/src/mac/commands.rs
+++ b/embassy-stm32-wpan/src/mac/commands.rs
@@ -371,7 +371,7 @@ pub struct DataRequest {
371} 371}
372 372
373impl DataRequest { 373impl DataRequest {
374 pub fn set_buffer<'a>(&'a mut self, buf: &'a [u8]) -> &mut Self { 374 pub fn set_buffer<'a>(&'a mut self, buf: &'a [u8]) -> &'a mut Self {
375 self.msdu_ptr = buf as *const _ as *const u8; 375 self.msdu_ptr = buf as *const _ as *const u8;
376 self.msdu_length = buf.len() as u8; 376 self.msdu_length = buf.len() as u8;
377 377
diff --git a/embassy-stm32-wpan/src/mac/driver.rs b/embassy-stm32-wpan/src/mac/driver.rs
index 5b9d5daf4..41cca09e3 100644
--- a/embassy-stm32-wpan/src/mac/driver.rs
+++ b/embassy-stm32-wpan/src/mac/driver.rs
@@ -23,8 +23,14 @@ impl<'d> Driver<'d> {
23impl<'d> embassy_net_driver::Driver for Driver<'d> { 23impl<'d> embassy_net_driver::Driver for Driver<'d> {
24 // type RxToken<'a> = RxToken<'a, 'd> where Self: 'a; 24 // type RxToken<'a> = RxToken<'a, 'd> where Self: 'a;
25 // type TxToken<'a> = TxToken<'a, 'd> where Self: 'a; 25 // type TxToken<'a> = TxToken<'a, 'd> where Self: 'a;
26 type RxToken<'a> = RxToken<'d> where Self: 'a; 26 type RxToken<'a>
27 type TxToken<'a> = TxToken<'d> where Self: 'a; 27 = RxToken<'d>
28 where
29 Self: 'a;
30 type TxToken<'a>
31 = TxToken<'d>
32 where
33 Self: 'a;
28 34
29 fn receive(&mut self, cx: &mut Context) -> Option<(Self::RxToken<'_>, Self::TxToken<'_>)> { 35 fn receive(&mut self, cx: &mut Context) -> Option<(Self::RxToken<'_>, Self::TxToken<'_>)> {
30 if self.runner.rx_channel.poll_ready_to_receive(cx).is_ready() 36 if self.runner.rx_channel.poll_ready_to_receive(cx).is_ready()
diff --git a/embassy-stm32/src/eth/mod.rs b/embassy-stm32/src/eth/mod.rs
index 6442176da..1b875b71a 100644
--- a/embassy-stm32/src/eth/mod.rs
+++ b/embassy-stm32/src/eth/mod.rs
@@ -74,8 +74,14 @@ impl<const TX: usize, const RX: usize> PacketQueue<TX, RX> {
74static WAKER: AtomicWaker = AtomicWaker::new(); 74static WAKER: AtomicWaker = AtomicWaker::new();
75 75
76impl<'d, T: Instance, P: PHY> embassy_net_driver::Driver for Ethernet<'d, T, P> { 76impl<'d, T: Instance, P: PHY> embassy_net_driver::Driver for Ethernet<'d, T, P> {
77 type RxToken<'a> = RxToken<'a, 'd> where Self: 'a; 77 type RxToken<'a>
78 type TxToken<'a> = TxToken<'a, 'd> where Self: 'a; 78 = RxToken<'a, 'd>
79 where
80 Self: 'a;
81 type TxToken<'a>
82 = TxToken<'a, 'd>
83 where
84 Self: 'a;
79 85
80 fn receive(&mut self, cx: &mut Context) -> Option<(Self::RxToken<'_>, Self::TxToken<'_>)> { 86 fn receive(&mut self, cx: &mut Context) -> Option<(Self::RxToken<'_>, Self::TxToken<'_>)> {
81 WAKER.register(cx.waker()); 87 WAKER.register(cx.waker());
diff --git a/embassy-stm32/src/low_power.rs b/embassy-stm32/src/low_power.rs
index f3e4c6994..2be1a42b7 100644
--- a/embassy-stm32/src/low_power.rs
+++ b/embassy-stm32/src/low_power.rs
@@ -51,6 +51,9 @@
51//! } 51//! }
52//! ``` 52//! ```
53 53
54// TODO: Usage of `static mut` here is unsound. Fix then remove this `allow`.`
55#![allow(static_mut_refs)]
56
54use core::arch::asm; 57use core::arch::asm;
55use core::marker::PhantomData; 58use core::marker::PhantomData;
56use core::sync::atomic::{compiler_fence, Ordering}; 59use core::sync::atomic::{compiler_fence, Ordering};
diff --git a/embassy-stm32/src/rcc/mod.rs b/embassy-stm32/src/rcc/mod.rs
index 8022a35a4..4f43d3748 100644
--- a/embassy-stm32/src/rcc/mod.rs
+++ b/embassy-stm32/src/rcc/mod.rs
@@ -86,7 +86,7 @@ pub(crate) unsafe fn set_freqs(freqs: Clocks) {
86#[cfg(not(feature = "_dual-core"))] 86#[cfg(not(feature = "_dual-core"))]
87/// Safety: Reads a mutable global. 87/// Safety: Reads a mutable global.
88pub(crate) unsafe fn get_freqs() -> &'static Clocks { 88pub(crate) unsafe fn get_freqs() -> &'static Clocks {
89 CLOCK_FREQS.assume_init_ref() 89 (*core::ptr::addr_of_mut!(CLOCK_FREQS)).assume_init_ref()
90} 90}
91 91
92#[cfg(feature = "_dual-core")] 92#[cfg(feature = "_dual-core")]
@@ -171,7 +171,9 @@ impl RccInfo {
171 // Use .get_mut instead of []-operator so that we control how bounds checks happen. 171 // Use .get_mut instead of []-operator so that we control how bounds checks happen.
172 // Otherwise, core::fmt will be pulled in here in order to format the integer in the 172 // Otherwise, core::fmt will be pulled in here in order to format the integer in the
173 // out-of-bounds error. 173 // out-of-bounds error.
174 if let Some(refcount) = unsafe { crate::_generated::REFCOUNTS.get_mut(refcount_idx) } { 174 if let Some(refcount) =
175 unsafe { (*core::ptr::addr_of_mut!(crate::_generated::REFCOUNTS)).get_mut(refcount_idx) }
176 {
175 *refcount += 1; 177 *refcount += 1;
176 if *refcount > 1 { 178 if *refcount > 1 {
177 return; 179 return;
@@ -235,7 +237,9 @@ impl RccInfo {
235 // Use .get_mut instead of []-operator so that we control how bounds checks happen. 237 // Use .get_mut instead of []-operator so that we control how bounds checks happen.
236 // Otherwise, core::fmt will be pulled in here in order to format the integer in the 238 // Otherwise, core::fmt will be pulled in here in order to format the integer in the
237 // out-of-bounds error. 239 // out-of-bounds error.
238 if let Some(refcount) = unsafe { crate::_generated::REFCOUNTS.get_mut(refcount_idx) } { 240 if let Some(refcount) =
241 unsafe { (*core::ptr::addr_of_mut!(crate::_generated::REFCOUNTS)).get_mut(refcount_idx) }
242 {
239 *refcount -= 1; 243 *refcount -= 1;
240 if *refcount > 0 { 244 if *refcount > 0 {
241 return; 245 return;
diff --git a/examples/stm32h7/src/bin/sai.rs b/examples/stm32h7/src/bin/sai.rs
index f6735e235..04d14bd6b 100644
--- a/examples/stm32h7/src/bin/sai.rs
+++ b/examples/stm32h7/src/bin/sai.rs
@@ -81,8 +81,9 @@ async fn main(_spawner: Spawner) {
81 rx_config.sync_output = false; 81 rx_config.sync_output = false;
82 82
83 let tx_buffer: &mut [u32] = unsafe { 83 let tx_buffer: &mut [u32] = unsafe {
84 TX_BUFFER.initialize_all_copied(0); 84 let buf = &mut *core::ptr::addr_of_mut!(TX_BUFFER);
85 let (ptr, len) = TX_BUFFER.get_ptr_len(); 85 buf.initialize_all_copied(0);
86 let (ptr, len) = buf.get_ptr_len();
86 core::slice::from_raw_parts_mut(ptr, len) 87 core::slice::from_raw_parts_mut(ptr, len)
87 }; 88 };
88 89
@@ -98,8 +99,9 @@ async fn main(_spawner: Spawner) {
98 ); 99 );
99 100
100 let rx_buffer: &mut [u32] = unsafe { 101 let rx_buffer: &mut [u32] = unsafe {
101 RX_BUFFER.initialize_all_copied(0); 102 let buf = &mut *core::ptr::addr_of_mut!(RX_BUFFER);
102 let (ptr, len) = RX_BUFFER.get_ptr_len(); 103 buf.initialize_all_copied(0);
104 let (ptr, len) = buf.get_ptr_len();
103 core::slice::from_raw_parts_mut(ptr, len) 105 core::slice::from_raw_parts_mut(ptr, len)
104 }; 106 };
105 107
diff --git a/examples/stm32h7/src/bin/spi_bdma.rs b/examples/stm32h7/src/bin/spi_bdma.rs
index 43fb6b41c..9166fe9b6 100644
--- a/examples/stm32h7/src/bin/spi_bdma.rs
+++ b/examples/stm32h7/src/bin/spi_bdma.rs
@@ -22,10 +22,11 @@ static mut RAM_D3: GroundedArrayCell<u8, 256> = GroundedArrayCell::uninit();
22#[embassy_executor::task] 22#[embassy_executor::task]
23async fn main_task(mut spi: spi::Spi<'static, Async>) { 23async fn main_task(mut spi: spi::Spi<'static, Async>) {
24 let (read_buffer, write_buffer) = unsafe { 24 let (read_buffer, write_buffer) = unsafe {
25 RAM_D3.initialize_all_copied(0); 25 let ram = &mut *core::ptr::addr_of_mut!(RAM_D3);
26 ram.initialize_all_copied(0);
26 ( 27 (
27 RAM_D3.get_subslice_mut_unchecked(0, 128), 28 ram.get_subslice_mut_unchecked(0, 128),
28 RAM_D3.get_subslice_mut_unchecked(128, 128), 29 ram.get_subslice_mut_unchecked(128, 128),
29 ) 30 )
30 }; 31 };
31 32
diff --git a/rust-toolchain-nightly.toml b/rust-toolchain-nightly.toml
index 0b10d7194..acab9d615 100644
--- a/rust-toolchain-nightly.toml
+++ b/rust-toolchain-nightly.toml
@@ -1,5 +1,5 @@
1[toolchain] 1[toolchain]
2channel = "nightly-2024-09-06" 2channel = "nightly-2024-10-13"
3components = [ "rust-src", "rustfmt", "llvm-tools", "miri" ] 3components = [ "rust-src", "rustfmt", "llvm-tools", "miri" ]
4targets = [ 4targets = [
5 "thumbv7em-none-eabi", 5 "thumbv7em-none-eabi",
diff --git a/tests/nrf/src/bin/buffered_uart_spam.rs b/tests/nrf/src/bin/buffered_uart_spam.rs
index e8fca452e..843313537 100644
--- a/tests/nrf/src/bin/buffered_uart_spam.rs
+++ b/tests/nrf/src/bin/buffered_uart_spam.rs
@@ -55,7 +55,7 @@ async fn main(_spawner: Spawner) {
55 let task = unsafe { Task::new_unchecked(NonNull::new_unchecked(&spam_peri.tasks_starttx as *const _ as _)) }; 55 let task = unsafe { Task::new_unchecked(NonNull::new_unchecked(&spam_peri.tasks_starttx as *const _ as _)) };
56 let mut spam_ppi = Ppi::new_one_to_one(p.PPI_CH2, event, task); 56 let mut spam_ppi = Ppi::new_one_to_one(p.PPI_CH2, event, task);
57 spam_ppi.enable(); 57 spam_ppi.enable();
58 let p = unsafe { TX_BUF.as_mut_ptr() }; 58 let p = unsafe { core::ptr::addr_of_mut!(TX_BUF) } as *mut u8;
59 spam_peri.txd.ptr.write(|w| unsafe { w.ptr().bits(p as u32) }); 59 spam_peri.txd.ptr.write(|w| unsafe { w.ptr().bits(p as u32) });
60 spam_peri.txd.maxcnt.write(|w| unsafe { w.maxcnt().bits(NSPAM as _) }); 60 spam_peri.txd.maxcnt.write(|w| unsafe { w.maxcnt().bits(NSPAM as _) });
61 spam_peri.tasks_starttx.write(|w| unsafe { w.bits(1) }); 61 spam_peri.tasks_starttx.write(|w| unsafe { w.bits(1) });
diff --git a/tests/stm32/src/bin/usart_rx_ringbuffered.rs b/tests/stm32/src/bin/usart_rx_ringbuffered.rs
index 98c7ef312..83c0887ac 100644
--- a/tests/stm32/src/bin/usart_rx_ringbuffered.rs
+++ b/tests/stm32/src/bin/usart_rx_ringbuffered.rs
@@ -43,8 +43,7 @@ async fn main(spawner: Spawner) {
43 let usart = Uart::new(usart, rx, tx, irq, tx_dma, rx_dma, config).unwrap(); 43 let usart = Uart::new(usart, rx, tx, irq, tx_dma, rx_dma, config).unwrap();
44 let (tx, rx) = usart.split(); 44 let (tx, rx) = usart.split();
45 static mut DMA_BUF: [u8; DMA_BUF_SIZE] = [0; DMA_BUF_SIZE]; 45 static mut DMA_BUF: [u8; DMA_BUF_SIZE] = [0; DMA_BUF_SIZE];
46 let dma_buf = unsafe { DMA_BUF.as_mut() }; 46 let rx = rx.into_ring_buffered(unsafe { &mut *core::ptr::addr_of_mut!(DMA_BUF) });
47 let rx = rx.into_ring_buffered(dma_buf);
48 47
49 info!("Spawning tasks"); 48 info!("Spawning tasks");
50 spawner.spawn(transmit_task(tx)).unwrap(); 49 spawner.spawn(transmit_task(tx)).unwrap();