aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2023-10-03 01:42:46 +0200
committerDario Nieuwenhuis <[email protected]>2023-10-03 02:11:58 +0200
commitc0a6c78a146a6e0ec57a03e64ff83a3fa87b4bdd (patch)
tree202bc5e35334d67aa868ecfe7280843c5fa52a31
parent58280048e332fadd73dc8b48588b0112c61b8ff9 (diff)
stm32/hil: add f2, f3, f7, l49
-rwxr-xr-xci.sh4
-rw-r--r--tests/perf-client/src/lib.rs9
-rw-r--r--tests/stm32/Cargo.toml4
-rw-r--r--tests/stm32/src/bin/eth.rs16
-rw-r--r--tests/stm32/src/common.rs65
5 files changed, 91 insertions, 7 deletions
diff --git a/ci.sh b/ci.sh
index 318c6cc0f..f2a686c7c 100755
--- a/ci.sh
+++ b/ci.sh
@@ -191,6 +191,10 @@ cargo batch \
191 --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32l4a6zg --out-dir out/tests/stm32l4a6zg \ 191 --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32l4a6zg --out-dir out/tests/stm32l4a6zg \
192 --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32l4r5zi --out-dir out/tests/stm32l4r5zi \ 192 --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32l4r5zi --out-dir out/tests/stm32l4r5zi \
193 --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32l552ze --out-dir out/tests/stm32l552ze \ 193 --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32l552ze --out-dir out/tests/stm32l552ze \
194 --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f767zi --out-dir out/tests/stm32f767zi \
195 --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32f207zg --out-dir out/tests/stm32f207zg \
196 --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f303ze --out-dir out/tests/stm32f303ze \
197 --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32l496zg --out-dir out/tests/stm32l496zg \
194 --- build --release --manifest-path tests/rp/Cargo.toml --target thumbv6m-none-eabi --out-dir out/tests/rpi-pico \ 198 --- build --release --manifest-path tests/rp/Cargo.toml --target thumbv6m-none-eabi --out-dir out/tests/rpi-pico \
195 --- build --release --manifest-path tests/nrf/Cargo.toml --target thumbv7em-none-eabi --out-dir out/tests/nrf52840-dk \ 199 --- build --release --manifest-path tests/nrf/Cargo.toml --target thumbv7em-none-eabi --out-dir out/tests/nrf52840-dk \
196 --- build --release --manifest-path tests/riscv32/Cargo.toml --target riscv32imac-unknown-none-elf \ 200 --- build --release --manifest-path tests/riscv32/Cargo.toml --target riscv32imac-unknown-none-elf \
diff --git a/tests/perf-client/src/lib.rs b/tests/perf-client/src/lib.rs
index a36147dbb..d709c7bd0 100644
--- a/tests/perf-client/src/lib.rs
+++ b/tests/perf-client/src/lib.rs
@@ -30,6 +30,7 @@ pub async fn run<D: Driver>(stack: &Stack<D>, expected: Expected) {
30} 30}
31 31
32const TEST_DURATION: usize = 10; 32const TEST_DURATION: usize = 10;
33const IO_BUFFER_SIZE: usize = 1024;
33const RX_BUFFER_SIZE: usize = 4096; 34const RX_BUFFER_SIZE: usize = 4096;
34const TX_BUFFER_SIZE: usize = 4096; 35const TX_BUFFER_SIZE: usize = 4096;
35const SERVER_ADDRESS: Ipv4Address = Ipv4Address::new(192, 168, 2, 2); 36const SERVER_ADDRESS: Ipv4Address = Ipv4Address::new(192, 168, 2, 2);
@@ -52,7 +53,7 @@ async fn test_download<D: Driver>(stack: &Stack<D>) -> usize {
52 } 53 }
53 info!("connected, testing..."); 54 info!("connected, testing...");
54 55
55 let mut rx_buf = [0; 4096]; 56 let mut rx_buf = [0; IO_BUFFER_SIZE];
56 let mut total: usize = 0; 57 let mut total: usize = 0;
57 with_timeout(Duration::from_secs(TEST_DURATION as _), async { 58 with_timeout(Duration::from_secs(TEST_DURATION as _), async {
58 loop { 59 loop {
@@ -92,7 +93,7 @@ async fn test_upload<D: Driver>(stack: &Stack<D>) -> usize {
92 } 93 }
93 info!("connected, testing..."); 94 info!("connected, testing...");
94 95
95 let buf = [0; 4096]; 96 let buf = [0; IO_BUFFER_SIZE];
96 let mut total: usize = 0; 97 let mut total: usize = 0;
97 with_timeout(Duration::from_secs(TEST_DURATION as _), async { 98 with_timeout(Duration::from_secs(TEST_DURATION as _), async {
98 loop { 99 loop {
@@ -134,8 +135,8 @@ async fn test_upload_download<D: Driver>(stack: &Stack<D>) -> usize {
134 135
135 let (mut reader, mut writer) = socket.split(); 136 let (mut reader, mut writer) = socket.split();
136 137
137 let tx_buf = [0; 4096]; 138 let tx_buf = [0; IO_BUFFER_SIZE];
138 let mut rx_buf = [0; 4096]; 139 let mut rx_buf = [0; IO_BUFFER_SIZE];
139 let mut total: usize = 0; 140 let mut total: usize = 0;
140 let tx_fut = async { 141 let tx_fut = async {
141 loop { 142 loop {
diff --git a/tests/stm32/Cargo.toml b/tests/stm32/Cargo.toml
index 2b01def5c..c1addcd99 100644
--- a/tests/stm32/Cargo.toml
+++ b/tests/stm32/Cargo.toml
@@ -20,6 +20,10 @@ stm32l152re = ["embassy-stm32/stm32l152re", "not-gpdma"] # Nucleo
20stm32l4a6zg = ["embassy-stm32/stm32l4a6zg", "not-gpdma"] # Nucleo 20stm32l4a6zg = ["embassy-stm32/stm32l4a6zg", "not-gpdma"] # Nucleo
21stm32l4r5zi = ["embassy-stm32/stm32l4r5zi", "not-gpdma"] # Nucleo 21stm32l4r5zi = ["embassy-stm32/stm32l4r5zi", "not-gpdma"] # Nucleo
22stm32l552ze = ["embassy-stm32/stm32l552ze", "not-gpdma"] # Nucleo 22stm32l552ze = ["embassy-stm32/stm32l552ze", "not-gpdma"] # Nucleo
23stm32f767zi = ["embassy-stm32/stm32f767zi", "not-gpdma", "eth"] # Nucleo
24stm32f207zg = ["embassy-stm32/stm32f207zg", "not-gpdma", "eth"] # Nucleo
25stm32f303ze = ["embassy-stm32/stm32f303ze", "not-gpdma"] # Nucleo
26stm32l496zg = ["embassy-stm32/stm32l496zg", "not-gpdma"] # Nucleo
23 27
24eth = [] 28eth = []
25sdmmc = [] 29sdmmc = []
diff --git a/tests/stm32/src/bin/eth.rs b/tests/stm32/src/bin/eth.rs
index 0b32b60b3..139192381 100644
--- a/tests/stm32/src/bin/eth.rs
+++ b/tests/stm32/src/bin/eth.rs
@@ -19,12 +19,12 @@ use {defmt_rtt as _, panic_probe as _};
19 19
20teleprobe_meta::timeout!(120); 20teleprobe_meta::timeout!(120);
21 21
22#[cfg(not(feature = "stm32h563zi"))] 22#[cfg(not(any(feature = "stm32h563zi", feature = "stm32f767zi", feature = "stm32f207zg")))]
23bind_interrupts!(struct Irqs { 23bind_interrupts!(struct Irqs {
24 ETH => eth::InterruptHandler; 24 ETH => eth::InterruptHandler;
25 HASH_RNG => rng::InterruptHandler<peripherals::RNG>; 25 HASH_RNG => rng::InterruptHandler<peripherals::RNG>;
26}); 26});
27#[cfg(feature = "stm32h563zi")] 27#[cfg(any(feature = "stm32h563zi", feature = "stm32f767zi", feature = "stm32f207zg"))]
28bind_interrupts!(struct Irqs { 28bind_interrupts!(struct Irqs {
29 ETH => eth::InterruptHandler; 29 ETH => eth::InterruptHandler;
30 RNG => rng::InterruptHandler<peripherals::RNG>; 30 RNG => rng::InterruptHandler<peripherals::RNG>;
@@ -56,11 +56,21 @@ async fn main(spawner: Spawner) {
56 let n = 2; 56 let n = 2;
57 #[cfg(feature = "stm32h563zi")] 57 #[cfg(feature = "stm32h563zi")]
58 let n = 3; 58 let n = 3;
59 #[cfg(feature = "stm32f767zi")]
60 let n = 4;
61 #[cfg(feature = "stm32f207zg")]
62 let n = 5;
59 63
60 let mac_addr = [0x00, n, 0xDE, 0xAD, 0xBE, 0xEF]; 64 let mac_addr = [0x00, n, 0xDE, 0xAD, 0xBE, 0xEF];
61 65
66 // F2 runs out of RAM
67 #[cfg(feature = "stm32f207zg")]
68 const PACKET_QUEUE_SIZE: usize = 2;
69 #[cfg(not(feature = "stm32f207zg"))]
70 const PACKET_QUEUE_SIZE: usize = 4;
71
62 let device = Ethernet::new( 72 let device = Ethernet::new(
63 make_static!(PacketQueue::<4, 4>::new()), 73 make_static!(PacketQueue::<PACKET_QUEUE_SIZE, PACKET_QUEUE_SIZE>::new()),
64 p.ETH, 74 p.ETH,
65 Irqs, 75 Irqs,
66 p.PA1, 76 p.PA1,
diff --git a/tests/stm32/src/common.rs b/tests/stm32/src/common.rs
index 6bf5c36ef..32ba03e4f 100644
--- a/tests/stm32/src/common.rs
+++ b/tests/stm32/src/common.rs
@@ -34,6 +34,14 @@ teleprobe_meta::target!(b"nucleo-stm32l4a6zg");
34teleprobe_meta::target!(b"nucleo-stm32l4r5zi"); 34teleprobe_meta::target!(b"nucleo-stm32l4r5zi");
35#[cfg(feature = "stm32l552ze")] 35#[cfg(feature = "stm32l552ze")]
36teleprobe_meta::target!(b"nucleo-stm32l552ze"); 36teleprobe_meta::target!(b"nucleo-stm32l552ze");
37#[cfg(feature = "stm32f767zi")]
38teleprobe_meta::target!(b"nucleo-stm32f767zi");
39#[cfg(feature = "stm32f207zg")]
40teleprobe_meta::target!(b"nucleo-stm32f207zg");
41#[cfg(feature = "stm32f303ze")]
42teleprobe_meta::target!(b"nucleo-stm32f303ze");
43#[cfg(feature = "stm32l496zg")]
44teleprobe_meta::target!(b"nucleo-stm32l496zg");
37 45
38macro_rules! define_peris { 46macro_rules! define_peris {
39 ($($name:ident = $peri:ident,)* $(@irq $irq_name:ident = $irq_code:tt,)*) => { 47 ($($name:ident = $peri:ident,)* $(@irq $irq_name:ident = $irq_code:tt,)*) => {
@@ -119,6 +127,12 @@ define_peris!(
119 SPI = SPI1, SPI_SCK = PA5, SPI_MOSI = PA7, SPI_MISO = PA6, SPI_TX_DMA = DMA1_CH1, SPI_RX_DMA = DMA1_CH2, 127 SPI = SPI1, SPI_SCK = PA5, SPI_MOSI = PA7, SPI_MISO = PA6, SPI_TX_DMA = DMA1_CH1, SPI_RX_DMA = DMA1_CH2,
120 @irq UART = {USART1 => embassy_stm32::usart::InterruptHandler<embassy_stm32::peripherals::USART1>;}, 128 @irq UART = {USART1 => embassy_stm32::usart::InterruptHandler<embassy_stm32::peripherals::USART1>;},
121); 129);
130#[cfg(feature = "stm32l496zg")]
131define_peris!(
132 UART = USART3, UART_TX = PD8, UART_RX = PD9, UART_TX_DMA = DMA1_CH2, UART_RX_DMA = DMA1_CH3,
133 SPI = SPI1, SPI_SCK = PA5, SPI_MOSI = PA7, SPI_MISO = PA6, SPI_TX_DMA = DMA1_CH3, SPI_RX_DMA = DMA1_CH2,
134 @irq UART = {USART3 => embassy_stm32::usart::InterruptHandler<embassy_stm32::peripherals::USART3>;},
135);
122#[cfg(feature = "stm32l4a6zg")] 136#[cfg(feature = "stm32l4a6zg")]
123define_peris!( 137define_peris!(
124 UART = USART3, UART_TX = PD8, UART_RX = PD9, UART_TX_DMA = DMA1_CH2, UART_RX_DMA = DMA1_CH3, 138 UART = USART3, UART_TX = PD8, UART_RX = PD9, UART_TX_DMA = DMA1_CH2, UART_RX_DMA = DMA1_CH3,
@@ -149,11 +163,57 @@ define_peris!(
149 SPI = SPI1, SPI_SCK = PA5, SPI_MOSI = PA7, SPI_MISO = PA6, SPI_TX_DMA = DMA1_CH1, SPI_RX_DMA = DMA1_CH2, 163 SPI = SPI1, SPI_SCK = PA5, SPI_MOSI = PA7, SPI_MISO = PA6, SPI_TX_DMA = DMA1_CH1, SPI_RX_DMA = DMA1_CH2,
150 @irq UART = {USART3 => embassy_stm32::usart::InterruptHandler<embassy_stm32::peripherals::USART3>;}, 164 @irq UART = {USART3 => embassy_stm32::usart::InterruptHandler<embassy_stm32::peripherals::USART3>;},
151); 165);
166#[cfg(feature = "stm32f767zi")]
167define_peris!(
168 UART = USART6, UART_TX = PG14, UART_RX = PG9, UART_TX_DMA = DMA2_CH6, UART_RX_DMA = DMA2_CH1,
169 SPI = SPI1, SPI_SCK = PA5, SPI_MOSI = PA7, SPI_MISO = PA6, SPI_TX_DMA = DMA2_CH3, SPI_RX_DMA = DMA2_CH2,
170 @irq UART = {USART6 => embassy_stm32::usart::InterruptHandler<embassy_stm32::peripherals::USART6>;},
171);
172#[cfg(feature = "stm32f207zg")]
173define_peris!(
174 UART = USART6, UART_TX = PG14, UART_RX = PG9, UART_TX_DMA = DMA2_CH6, UART_RX_DMA = DMA2_CH1,
175 SPI = SPI1, SPI_SCK = PA5, SPI_MOSI = PA7, SPI_MISO = PA6, SPI_TX_DMA = DMA2_CH3, SPI_RX_DMA = DMA2_CH2,
176 @irq UART = {USART6 => embassy_stm32::usart::InterruptHandler<embassy_stm32::peripherals::USART6>;},
177);
178#[cfg(feature = "stm32f303ze")]
179define_peris!(
180 UART = USART1, UART_TX = PC4, UART_RX = PC5, UART_TX_DMA = DMA1_CH4, UART_RX_DMA = DMA1_CH5,
181 SPI = SPI1, SPI_SCK = PA5, SPI_MOSI = PA7, SPI_MISO = PA6, SPI_TX_DMA = DMA1_CH3, SPI_RX_DMA = DMA1_CH2,
182 @irq UART = {USART1 => embassy_stm32::usart::InterruptHandler<embassy_stm32::peripherals::USART1>;},
183);
152 184
153pub fn config() -> Config { 185pub fn config() -> Config {
154 #[allow(unused_mut)] 186 #[allow(unused_mut)]
155 let mut config = Config::default(); 187 let mut config = Config::default();
156 188
189 #[cfg(feature = "stm32f207zg")]
190 {
191 use embassy_stm32::rcc::*;
192 // By default, HSE on the board comes from a 8 MHz clock signal (not a crystal)
193 config.rcc.hse = Some(HSEConfig {
194 frequency: Hertz(8_000_000),
195 source: HSESrc::Bypass,
196 });
197 // PLL uses HSE as the clock source
198 config.rcc.pll_mux = PLLSrc::HSE;
199 config.rcc.pll = PLLConfig {
200 // 8 MHz clock source / 8 = 1 MHz PLL input
201 pre_div: unwrap!(PLLPreDiv::try_from(8)),
202 // 1 MHz PLL input * 240 = 240 MHz PLL VCO
203 mul: unwrap!(PLLMul::try_from(240)),
204 // 240 MHz PLL VCO / 2 = 120 MHz main PLL output
205 main_div: PLLMainDiv::Div2,
206 // 240 MHz PLL VCO / 5 = 48 MHz PLL48 output
207 pll48_div: unwrap!(PLL48Div::try_from(5)),
208 };
209 // System clock comes from PLL (= the 120 MHz main PLL output)
210 config.rcc.mux = ClockSrc::PLL;
211 // 120 MHz / 4 = 30 MHz APB1 frequency
212 config.rcc.apb1_pre = APBPrescaler::DIV4;
213 // 120 MHz / 2 = 60 MHz APB2 frequency
214 config.rcc.apb2_pre = APBPrescaler::DIV2;
215 }
216
157 #[cfg(feature = "stm32f429zi")] 217 #[cfg(feature = "stm32f429zi")]
158 { 218 {
159 // TODO: stm32f429zi can do up to 180mhz, but that makes tests fail. 219 // TODO: stm32f429zi can do up to 180mhz, but that makes tests fail.
@@ -163,6 +223,11 @@ pub fn config() -> Config {
163 config.rcc.pclk2 = Some(Hertz(84_000_000)); 223 config.rcc.pclk2 = Some(Hertz(84_000_000));
164 } 224 }
165 225
226 #[cfg(feature = "stm32f767zi")]
227 {
228 config.rcc.sys_ck = Some(Hertz(200_000_000));
229 }
230
166 #[cfg(feature = "stm32h563zi")] 231 #[cfg(feature = "stm32h563zi")]
167 { 232 {
168 use embassy_stm32::rcc::*; 233 use embassy_stm32::rcc::*;