diff options
| author | Dario Nieuwenhuis <[email protected]> | 2023-10-17 14:58:53 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-10-17 14:58:53 +0000 |
| commit | d94b9fe6fb6adee82c1427e72450f77a0d0973c3 (patch) | |
| tree | 74b09c3924ad6cb756b5fda56ef7587865a9099d | |
| parent | 683d5c30669bbb788e60ee3dd31ce30ba14c2d69 (diff) | |
| parent | b47864046381cccdef186321fc0d46a1dd2a45be (diff) | |
Merge pull request #2082 from embassy-rs/stm32wl-hil
stm32/tests: add stm32wl hil.
| -rwxr-xr-x | ci.sh | 1 | ||||
| -rw-r--r-- | examples/stm32wl/src/bin/random.rs | 9 | ||||
| -rw-r--r-- | tests/stm32/Cargo.toml | 1 | ||||
| -rw-r--r-- | tests/stm32/build.rs | 4 | ||||
| -rw-r--r-- | tests/stm32/src/common.rs | 17 |
5 files changed, 26 insertions, 6 deletions
| @@ -204,6 +204,7 @@ cargo batch \ | |||
| 204 | --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32f207zg --out-dir out/tests/stm32f207zg \ | 204 | --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7m-none-eabi --features stm32f207zg --out-dir out/tests/stm32f207zg \ |
| 205 | --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f303ze --out-dir out/tests/stm32f303ze \ | 205 | --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f303ze --out-dir out/tests/stm32f303ze \ |
| 206 | --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32l496zg --out-dir out/tests/stm32l496zg \ | 206 | --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32l496zg --out-dir out/tests/stm32l496zg \ |
| 207 | --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32wl55jc --out-dir out/tests/stm32wl55jc \ | ||
| 207 | --- build --release --manifest-path tests/rp/Cargo.toml --target thumbv6m-none-eabi --out-dir out/tests/rpi-pico \ | 208 | --- build --release --manifest-path tests/rp/Cargo.toml --target thumbv6m-none-eabi --out-dir out/tests/rpi-pico \ |
| 208 | --- build --release --manifest-path tests/nrf/Cargo.toml --target thumbv7em-none-eabi --out-dir out/tests/nrf52840-dk \ | 209 | --- build --release --manifest-path tests/nrf/Cargo.toml --target thumbv7em-none-eabi --out-dir out/tests/nrf52840-dk \ |
| 209 | --- build --release --manifest-path tests/riscv32/Cargo.toml --target riscv32imac-unknown-none-elf \ | 210 | --- build --release --manifest-path tests/riscv32/Cargo.toml --target riscv32imac-unknown-none-elf \ |
diff --git a/examples/stm32wl/src/bin/random.rs b/examples/stm32wl/src/bin/random.rs index 7c7e8a4e6..70676c704 100644 --- a/examples/stm32wl/src/bin/random.rs +++ b/examples/stm32wl/src/bin/random.rs | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy_executor::Spawner; | 6 | use embassy_executor::Spawner; |
| 7 | use embassy_stm32::rcc::{ClockSrc, MSIRange}; | ||
| 7 | use embassy_stm32::rng::{self, Rng}; | 8 | use embassy_stm32::rng::{self, Rng}; |
| 8 | use embassy_stm32::{bind_interrupts, pac, peripherals}; | 9 | use embassy_stm32::{bind_interrupts, pac, peripherals}; |
| 9 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| @@ -15,12 +16,10 @@ bind_interrupts!(struct Irqs{ | |||
| 15 | #[embassy_executor::main] | 16 | #[embassy_executor::main] |
| 16 | async fn main(_spawner: Spawner) { | 17 | async fn main(_spawner: Spawner) { |
| 17 | let mut config = embassy_stm32::Config::default(); | 18 | let mut config = embassy_stm32::Config::default(); |
| 18 | config.rcc.mux = embassy_stm32::rcc::ClockSrc::HSE; | 19 | config.rcc.mux = ClockSrc::MSI(MSIRange::RANGE32M); |
| 19 | |||
| 20 | let p = embassy_stm32::init(config); | 20 | let p = embassy_stm32::init(config); |
| 21 | pac::RCC.ccipr().modify(|w| { | 21 | |
| 22 | w.set_rngsel(0b01); | 22 | pac::RCC.ccipr().modify(|w| w.set_rngsel(0b11)); // msi |
| 23 | }); | ||
| 24 | 23 | ||
| 25 | info!("Hello World!"); | 24 | info!("Hello World!"); |
| 26 | 25 | ||
diff --git a/tests/stm32/Cargo.toml b/tests/stm32/Cargo.toml index 77991ead3..b1b2f55c3 100644 --- a/tests/stm32/Cargo.toml +++ b/tests/stm32/Cargo.toml | |||
| @@ -24,6 +24,7 @@ stm32f767zi = ["embassy-stm32/stm32f767zi", "chrono", "not-gpdma", "eth", "rng"] | |||
| 24 | stm32f207zg = ["embassy-stm32/stm32f207zg", "chrono", "not-gpdma", "eth", "rng"] | 24 | stm32f207zg = ["embassy-stm32/stm32f207zg", "chrono", "not-gpdma", "eth", "rng"] |
| 25 | stm32f303ze = ["embassy-stm32/stm32f303ze", "chrono", "not-gpdma"] | 25 | stm32f303ze = ["embassy-stm32/stm32f303ze", "chrono", "not-gpdma"] |
| 26 | stm32l496zg = ["embassy-stm32/stm32l496zg", "not-gpdma", "rng"] | 26 | stm32l496zg = ["embassy-stm32/stm32l496zg", "not-gpdma", "rng"] |
| 27 | stm32wl55jc = ["embassy-stm32/stm32wl55jc-cm4", "not-gpdma", "rng", "chrono"] | ||
| 27 | 28 | ||
| 28 | eth = [] | 29 | eth = [] |
| 29 | rng = [] | 30 | rng = [] |
diff --git a/tests/stm32/build.rs b/tests/stm32/build.rs index 9aabf8541..c5d0e40d6 100644 --- a/tests/stm32/build.rs +++ b/tests/stm32/build.rs | |||
| @@ -8,12 +8,14 @@ fn main() -> Result<(), Box<dyn Error>> { | |||
| 8 | println!("cargo:rustc-link-search={}", out.display()); | 8 | println!("cargo:rustc-link-search={}", out.display()); |
| 9 | println!("cargo:rustc-link-arg-bins=--nmagic"); | 9 | println!("cargo:rustc-link-arg-bins=--nmagic"); |
| 10 | 10 | ||
| 11 | // too little RAM to run from RAM. | ||
| 12 | if cfg!(any( | 11 | if cfg!(any( |
| 12 | // too little RAM to run from RAM. | ||
| 13 | feature = "stm32f103c8", | 13 | feature = "stm32f103c8", |
| 14 | feature = "stm32c031c6", | 14 | feature = "stm32c031c6", |
| 15 | feature = "stm32wb55rg", | 15 | feature = "stm32wb55rg", |
| 16 | feature = "stm32l073rz", | 16 | feature = "stm32l073rz", |
| 17 | // wrong ram size in stm32-data | ||
| 18 | feature = "stm32wl55jc", | ||
| 17 | )) { | 19 | )) { |
| 18 | println!("cargo:rustc-link-arg-bins=-Tlink.x"); | 20 | println!("cargo:rustc-link-arg-bins=-Tlink.x"); |
| 19 | println!("cargo:rerun-if-changed=link.x"); | 21 | println!("cargo:rerun-if-changed=link.x"); |
diff --git a/tests/stm32/src/common.rs b/tests/stm32/src/common.rs index a802cdfcf..52edae3ac 100644 --- a/tests/stm32/src/common.rs +++ b/tests/stm32/src/common.rs | |||
| @@ -42,6 +42,8 @@ teleprobe_meta::target!(b"nucleo-stm32f207zg"); | |||
| 42 | teleprobe_meta::target!(b"nucleo-stm32f303ze"); | 42 | teleprobe_meta::target!(b"nucleo-stm32f303ze"); |
| 43 | #[cfg(feature = "stm32l496zg")] | 43 | #[cfg(feature = "stm32l496zg")] |
| 44 | teleprobe_meta::target!(b"nucleo-stm32l496zg"); | 44 | teleprobe_meta::target!(b"nucleo-stm32l496zg"); |
| 45 | #[cfg(feature = "stm32wl55jc")] | ||
| 46 | teleprobe_meta::target!(b"nucleo-stm32wl55jc"); | ||
| 45 | 47 | ||
| 46 | macro_rules! define_peris { | 48 | macro_rules! define_peris { |
| 47 | ($($name:ident = $peri:ident,)* $(@irq $irq_name:ident = $irq_code:tt,)*) => { | 49 | ($($name:ident = $peri:ident,)* $(@irq $irq_name:ident = $irq_code:tt,)*) => { |
| @@ -181,6 +183,12 @@ define_peris!( | |||
| 181 | SPI = SPI1, SPI_SCK = PA5, SPI_MOSI = PA7, SPI_MISO = PA6, SPI_TX_DMA = DMA1_CH3, SPI_RX_DMA = DMA1_CH2, | 183 | 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>;}, | 184 | @irq UART = {USART1 => embassy_stm32::usart::InterruptHandler<embassy_stm32::peripherals::USART1>;}, |
| 183 | ); | 185 | ); |
| 186 | #[cfg(feature = "stm32wl55jc")] | ||
| 187 | define_peris!( | ||
| 188 | UART = USART1, UART_TX = PB6, UART_RX = PB7, UART_TX_DMA = DMA1_CH4, UART_RX_DMA = DMA1_CH5, | ||
| 189 | SPI = SPI1, SPI_SCK = PA5, SPI_MOSI = PA7, SPI_MISO = PA6, SPI_TX_DMA = DMA1_CH3, SPI_RX_DMA = DMA1_CH2, | ||
| 190 | @irq UART = {USART1 => embassy_stm32::usart::InterruptHandler<embassy_stm32::peripherals::USART1>;}, | ||
| 191 | ); | ||
| 184 | 192 | ||
| 185 | pub fn config() -> Config { | 193 | pub fn config() -> Config { |
| 186 | #[allow(unused_mut)] | 194 | #[allow(unused_mut)] |
| @@ -299,6 +307,15 @@ pub fn config() -> Config { | |||
| 299 | }); | 307 | }); |
| 300 | } | 308 | } |
| 301 | 309 | ||
| 310 | #[cfg(feature = "stm32wl55jc")] | ||
| 311 | { | ||
| 312 | use embassy_stm32::rcc::*; | ||
| 313 | config.rcc.mux = ClockSrc::MSI(MSIRange::RANGE32M); | ||
| 314 | embassy_stm32::pac::RCC.ccipr().modify(|w| { | ||
| 315 | w.set_rngsel(0b11); // msi | ||
| 316 | }); | ||
| 317 | } | ||
| 318 | |||
| 302 | #[cfg(any(feature = "stm32l552ze"))] | 319 | #[cfg(any(feature = "stm32l552ze"))] |
| 303 | { | 320 | { |
| 304 | use embassy_stm32::rcc::*; | 321 | use embassy_stm32::rcc::*; |
