Skip to content

Commit 4b89fd0

Browse files
author
Johannes Draaijer
committed
Make sure this fits in 32K and don't wfi, it breaks defmt
1 parent e97cf5d commit 4b89fd0

File tree

3 files changed

+9
-23
lines changed

3 files changed

+9
-23
lines changed

examples/arp.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use core::cell::RefCell;
1414
use core::default::Default;
1515
use cortex_m_rt::{entry, exception};
1616

17-
use cortex_m::asm;
1817
use cortex_m::interrupt::Mutex;
1918
use stm32_eth::{
2019
mac::{phy::BarePhy, Phy},
@@ -43,8 +42,9 @@ fn main() -> ! {
4342

4443
let (eth_pins, mdio, mdc) = common::setup_pins(gpio);
4544

46-
let mut rx_ring: [RingEntry<_>; 16] = Default::default();
47-
let mut tx_ring: [RingEntry<_>; 8] = Default::default();
45+
let mut rx_ring: [RingEntry<_>; 2] = Default::default();
46+
let mut tx_ring: [RingEntry<_>; 2] = Default::default();
47+
4848
let (mut eth_dma, eth_mac) = stm32_eth::new(
4949
ethernet.mac,
5050
ethernet.mmc,
@@ -118,10 +118,6 @@ fn main() -> ! {
118118
cortex_m::interrupt::free(|cs| {
119119
let mut eth_pending = ETH_PENDING.borrow(cs).borrow_mut();
120120
*eth_pending = false;
121-
122-
if !*eth_pending {
123-
asm::wfi();
124-
}
125121
});
126122
}
127123
}

examples/ip.rs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
use defmt_rtt as _;
1010
use panic_probe as _;
1111

12-
use cortex_m::asm;
1312
use cortex_m_rt::{entry, exception};
1413
use stm32_eth::stm32::{interrupt, CorePeripherals, Peripherals, SYST};
1514

@@ -43,7 +42,7 @@ fn main() -> ! {
4342

4443
let (eth_pins, _mdio, _mdc) = common::setup_pins(gpio);
4544

46-
let mut rx_ring: [RingEntry<_>; 8] = Default::default();
45+
let mut rx_ring: [RingEntry<_>; 2] = Default::default();
4746
let mut tx_ring: [RingEntry<_>; 2] = Default::default();
4847
let (mut eth_dma, _eth_mac) = stm32_eth::new(
4948
ethernet.mac,
@@ -71,8 +70,8 @@ fn main() -> ! {
7170
.neighbor_cache(neighbor_cache)
7271
.finalize();
7372

74-
let mut server_rx_buffer = [0; 2048];
75-
let mut server_tx_buffer = [0; 2048];
73+
let mut server_rx_buffer = [0; 512];
74+
let mut server_tx_buffer = [0; 512];
7675
let server_socket = TcpSocket::new(
7776
TcpSocketBuffer::new(&mut server_rx_buffer[..]),
7877
TcpSocketBuffer::new(&mut server_tx_buffer[..]),
@@ -101,16 +100,7 @@ fn main() -> ! {
101100
}
102101
}
103102
}
104-
Ok(false) => {
105-
// Sleep if no ethernet work is pending
106-
cortex_m::interrupt::free(|cs| {
107-
let eth_pending = ETH_PENDING.borrow(cs).borrow_mut();
108-
if !*eth_pending {
109-
asm::wfi();
110-
// Awaken by interrupt
111-
}
112-
});
113-
}
103+
Ok(false) => {}
114104
Err(e) =>
115105
// Ignore malformed packets
116106
{

examples/rtic-echo.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ mod app {
5656
}
5757

5858
#[init(local = [
59-
rx_ring: [RxRingEntry; 4] = [RxRingEntry::new(),RxRingEntry::new(),RxRingEntry::new(),RxRingEntry::new()],
60-
tx_ring: [TxRingEntry; 4] = [TxRingEntry::new(),TxRingEntry::new(),TxRingEntry::new(),TxRingEntry::new()],
59+
rx_ring: [RxRingEntry; 2] = [RxRingEntry::new(),RxRingEntry::new()],
60+
tx_ring: [TxRingEntry; 2] = [TxRingEntry::new(),TxRingEntry::new()],
6161
storage: NetworkStorage = NetworkStorage::new(),
6262
dma: core::mem::MaybeUninit<EthernetDMA<'static, 'static>> = core::mem::MaybeUninit::uninit(),
6363
])]

0 commit comments

Comments
 (0)