diff --git a/ci.sh b/ci.sh index 47bf5d66..f81b34c0 100755 --- a/ci.sh +++ b/ci.sh @@ -117,6 +117,7 @@ cargo batch \ --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f429zi --out-dir out/tests/nucleo-stm32f429zi \ --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32g491re --out-dir out/tests/nucleo-stm32g491re \ --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32g071rb --out-dir out/tests/nucleo-stm32g071rb \ + --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32c031c6 --out-dir out/tests/nucleo-stm32c031c6 \ --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32h755zi --out-dir out/tests/nucleo-stm32h755zi \ --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32wb55rg --out-dir out/tests/nucleo-stm32wb55rg \ --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32h563zi --out-dir out/tests/nucleo-stm32h563zi \ diff --git a/embassy-stm32/Cargo.toml b/embassy-stm32/Cargo.toml index a8ebacd2..51ca9ff7 100644 --- a/embassy-stm32/Cargo.toml +++ b/embassy-stm32/Cargo.toml @@ -58,7 +58,7 @@ sdio-host = "0.5.0" embedded-sdmmc = { git = "https://github.com/embassy-rs/embedded-sdmmc-rs", rev = "46d1b1c2ff13e31e282ec1e352421721694f126a", optional = true } critical-section = "1.1" atomic-polyfill = "1.0.1" -stm32-metapac = "5" +stm32-metapac = "6" vcell = "0.1.3" bxcan = "0.7.0" nb = "1.0.0" @@ -73,7 +73,7 @@ critical-section = { version = "1.1", features = ["std"] } [build-dependencies] proc-macro2 = "1.0.36" quote = "1.0.15" -stm32-metapac = { version = "5", default-features = false, features = ["metadata"]} +stm32-metapac = { version = "6", default-features = false, features = ["metadata"]} [features] default = ["stm32-metapac/rt"] diff --git a/tests/stm32/Cargo.toml b/tests/stm32/Cargo.toml index bd181f23..227eabe7 100644 --- a/tests/stm32/Cargo.toml +++ b/tests/stm32/Cargo.toml @@ -8,6 +8,7 @@ license = "MIT OR Apache-2.0" stm32f103c8 = ["embassy-stm32/stm32f103c8"] # Blue Pill stm32f429zi = ["embassy-stm32/stm32f429zi"] # Nucleo stm32g071rb = ["embassy-stm32/stm32g071rb"] # Nucleo +stm32c031c6 = ["embassy-stm32/stm32c031c6"] # Nucleo stm32g491re = ["embassy-stm32/stm32g491re"] # Nucleo stm32h755zi = ["embassy-stm32/stm32h755zi-cm7"] # Nucleo stm32wb55rg = ["embassy-stm32/stm32wb55rg"] # Nucleo @@ -18,7 +19,7 @@ stm32u585ai = ["embassy-stm32/stm32u585ai"] # IoT board embassy-sync = { version = "0.1.0", path = "../../embassy-sync", features = ["defmt"] } embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] } embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["defmt", "tick-hz-32_768"] } -embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "unstable-pac", "memory-x", "time-driver-tim2"] } +embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "unstable-pac", "memory-x", "time-driver-any"] } defmt = "0.3.0" defmt-rtt = "0.4" diff --git a/tests/stm32/build.rs b/tests/stm32/build.rs index 6f487224..3e67a739 100644 --- a/tests/stm32/build.rs +++ b/tests/stm32/build.rs @@ -9,7 +9,13 @@ fn main() -> Result<(), Box> { println!("cargo:rerun-if-changed=link_ram.x"); println!("cargo:rustc-link-arg-bins=--nmagic"); + + // too little RAM to run from RAM. + #[cfg(any(feature = "stm32c031c6"))] + println!("cargo:rustc-link-arg-bins=-Tlink.x"); + #[cfg(not(any(feature = "stm32c031c6")))] println!("cargo:rustc-link-arg-bins=-Tlink_ram.x"); + println!("cargo:rustc-link-arg-bins=-Tdefmt.x"); Ok(()) diff --git a/tests/stm32/src/bin/gpio.rs b/tests/stm32/src/bin/gpio.rs index 6a36df8c..8b99b08a 100644 --- a/tests/stm32/src/bin/gpio.rs +++ b/tests/stm32/src/bin/gpio.rs @@ -32,6 +32,8 @@ async fn main(_spawner: Spawner) { let (mut a, mut b) = (p.PD9, p.PD8); #[cfg(feature = "stm32h563zi")] let (mut a, mut b) = (p.PB6, p.PB7); + #[cfg(feature = "stm32c031c6")] + let (mut a, mut b) = (p.PB6, p.PB7); // Test initial output { diff --git a/tests/stm32/src/bin/spi.rs b/tests/stm32/src/bin/spi.rs index bf8098b1..0f5e563b 100644 --- a/tests/stm32/src/bin/spi.rs +++ b/tests/stm32/src/bin/spi.rs @@ -32,6 +32,8 @@ async fn main(_spawner: Spawner) { let (spi, sck, mosi, miso) = (p.SPI1, p.PE13, p.PE15, p.PE14); #[cfg(feature = "stm32h563zi")] let (spi, sck, mosi, miso) = (p.SPI4, p.PE12, p.PE14, p.PE13); + #[cfg(feature = "stm32c031c6")] + let (spi, sck, mosi, miso) = (p.SPI1, p.PA5, p.PA7, p.PA6); info!("asdfa;"); let mut spi = Spi::new( @@ -49,7 +51,7 @@ async fn main(_spawner: Spawner) { // Arduino pins D11 and D12 (MOSI-MISO) are connected together with a 1K resistor. // so we should get the data we sent back. - let mut buf = data; + let mut buf = [0; 9]; spi.blocking_transfer(&mut buf, &data).unwrap(); assert_eq!(buf, data); diff --git a/tests/stm32/src/bin/spi_dma.rs b/tests/stm32/src/bin/spi_dma.rs index b3dad813..74776ebf 100644 --- a/tests/stm32/src/bin/spi_dma.rs +++ b/tests/stm32/src/bin/spi_dma.rs @@ -31,6 +31,8 @@ async fn main(_spawner: Spawner) { let (spi, sck, mosi, miso, tx_dma, rx_dma) = (p.SPI1, p.PE13, p.PE15, p.PE14, p.GPDMA1_CH0, p.GPDMA1_CH1); #[cfg(feature = "stm32h563zi")] let (spi, sck, mosi, miso, tx_dma, rx_dma) = (p.SPI4, p.PE12, p.PE14, p.PE13, p.GPDMA1_CH0, p.GPDMA1_CH1); + #[cfg(feature = "stm32c031c6")] + let (spi, sck, mosi, miso, tx_dma, rx_dma) = (p.SPI1, p.PA5, p.PA7, p.PA6, p.DMA1_CH1, p.DMA1_CH2); let mut spi = Spi::new( spi, diff --git a/tests/stm32/src/bin/usart.rs b/tests/stm32/src/bin/usart.rs index 52409567..cca8c42e 100644 --- a/tests/stm32/src/bin/usart.rs +++ b/tests/stm32/src/bin/usart.rs @@ -34,6 +34,8 @@ async fn main(_spawner: Spawner) { let (tx, rx, usart, irq) = (p.PD8, p.PD9, p.USART3, interrupt::take!(USART3)); #[cfg(feature = "stm32h563zi")] let (tx, rx, usart, irq) = (p.PB6, p.PB7, p.LPUART1, interrupt::take!(LPUART1)); + #[cfg(feature = "stm32c031c6")] + let (tx, rx, usart, irq) = (p.PB6, p.PB7, p.USART1, interrupt::take!(USART1)); let config = Config::default(); let mut usart = Uart::new(usart, rx, tx, irq, NoDma, NoDma, config); diff --git a/tests/stm32/src/bin/usart_dma.rs b/tests/stm32/src/bin/usart_dma.rs index 3f70791c..d673df0f 100644 --- a/tests/stm32/src/bin/usart_dma.rs +++ b/tests/stm32/src/bin/usart_dma.rs @@ -71,6 +71,9 @@ async fn main(_spawner: Spawner) { p.GPDMA1_CH0, p.GPDMA1_CH1, ); + #[cfg(feature = "stm32c031c6")] + let (tx, rx, usart, irq, tx_dma, rx_dma) = + (p.PB6, p.PB7, p.USART1, interrupt::take!(USART1), p.DMA1_CH1, p.DMA1_CH2); let config = Config::default(); let mut usart = Uart::new(usart, rx, tx, irq, tx_dma, rx_dma, config);