tests/stm32: add stm32f091rc, stm32h503rb.

This commit is contained in:
Dario Nieuwenhuis 2024-02-17 02:36:48 +01:00
parent 9352621058
commit 0e80dc4cd9
4 changed files with 62 additions and 1 deletions

View File

@ -30,6 +30,8 @@ stm32u5a5zj = ["embassy-stm32/stm32u5a5zj", "chrono", "rng"]
stm32wb55rg = ["embassy-stm32/stm32wb55rg", "chrono", "not-gpdma", "ble", "mac" , "rng"]
stm32wba52cg = ["embassy-stm32/stm32wba52cg", "chrono", "rng", "hash"]
stm32wl55jc = ["embassy-stm32/stm32wl55jc-cm4", "not-gpdma", "rng", "chrono"]
stm32f091rc = ["embassy-stm32/stm32f091rc", "cm0", "not-gpdma", "chrono"]
stm32h503rb = ["embassy-stm32/stm32h503rb", "rng"]
hash = []
eth = ["embassy-executor/task-arena-size-16384"]

View File

@ -16,6 +16,8 @@ fn main() -> Result<(), Box<dyn Error>> {
feature = "stm32l073rz",
// wrong ram size in stm32-data
feature = "stm32wl55jc",
// no VTOR, so interrupts can't work when running from RAM
feature = "stm32f091rc",
)) {
println!("cargo:rustc-link-arg-bins=-Tlink.x");
println!("cargo:rerun-if-changed=link.x");

View File

@ -24,6 +24,7 @@ bind_interrupts!(struct Irqs {
feature = "stm32wba52cg",
feature = "stm32l552ze",
feature = "stm32h563zi",
feature = "stm32h503rb",
feature = "stm32u5a5zj",
feature = "stm32u585ai"
))]

View File

@ -54,6 +54,10 @@ teleprobe_meta::target!(b"nucleo-stm32l496zg");
teleprobe_meta::target!(b"nucleo-stm32wl55jc");
#[cfg(feature = "stm32wba52cg")]
teleprobe_meta::target!(b"nucleo-stm32wba52cg");
#[cfg(feature = "stm32f091rc")]
teleprobe_meta::target!(b"nucleo-stm32f091rc");
#[cfg(feature = "stm32h503rb")]
teleprobe_meta::target!(b"nucleo-stm32h503rb");
macro_rules! define_peris {
($($name:ident = $peri:ident,)* $(@irq $irq_name:ident = $irq_code:tt,)*) => {
@ -85,6 +89,12 @@ macro_rules! define_peris {
};
}
#[cfg(feature = "stm32f091rc")]
define_peris!(
UART = USART1, UART_TX = PA9, UART_RX = PA10, UART_TX_DMA = DMA1_CH4, UART_RX_DMA = DMA1_CH5,
SPI = SPI1, SPI_SCK = PA5, SPI_MOSI = PA7, SPI_MISO = PA6, SPI_TX_DMA = DMA1_CH3, SPI_RX_DMA = DMA1_CH2,
@irq UART = {USART1 => embassy_stm32::usart::InterruptHandler<embassy_stm32::peripherals::USART1>;},
);
#[cfg(feature = "stm32f103c8")]
define_peris!(
UART = USART1, UART_TX = PA9, UART_RX = PA10, UART_TX_DMA = DMA1_CH4, UART_RX_DMA = DMA1_CH5,
@ -157,6 +167,12 @@ define_peris!(
SPI = SPI4, SPI_SCK = PE12, SPI_MOSI = PE14, SPI_MISO = PE13, SPI_TX_DMA = GPDMA1_CH0, SPI_RX_DMA = GPDMA1_CH1,
@irq UART = {LPUART1 => embassy_stm32::usart::InterruptHandler<embassy_stm32::peripherals::LPUART1>;},
);
#[cfg(feature = "stm32h503rb")]
define_peris!(
UART = USART1, UART_TX = PB14, UART_RX = PB15, UART_TX_DMA = GPDMA1_CH0, UART_RX_DMA = GPDMA1_CH1,
SPI = SPI1, SPI_SCK = PA5, SPI_MOSI = PA7, SPI_MISO = PA6, SPI_TX_DMA = GPDMA1_CH0, SPI_RX_DMA = GPDMA1_CH1,
@irq UART = {USART1 => embassy_stm32::usart::InterruptHandler<embassy_stm32::peripherals::USART1>;},
);
#[cfg(feature = "stm32c031c6")]
define_peris!(
UART = USART1, UART_TX = PB6, UART_RX = PB7, UART_TX_DMA = DMA1_CH1, UART_RX_DMA = DMA1_CH2,
@ -247,6 +263,22 @@ pub fn config() -> Config {
config.rcc = embassy_stm32::rcc::WPAN_DEFAULT;
}
#[cfg(feature = "stm32f091rc")]
{
use embassy_stm32::rcc::*;
config.rcc.hse = Some(Hse {
freq: Hertz(8_000_000),
mode: HseMode::Bypass,
});
config.rcc.pll = Some(Pll {
src: PllSource::HSE,
prediv: PllPreDiv::DIV1,
mul: PllMul::MUL6,
});
config.rcc.sys = Sysclk::PLL1_P;
config.rcc.ahb_pre = AHBPrescaler::DIV1;
config.rcc.apb1_pre = APBPrescaler::DIV1;
}
#[cfg(feature = "stm32f103c8")]
{
use embassy_stm32::rcc::*;
@ -264,7 +296,6 @@ pub fn config() -> Config {
config.rcc.apb1_pre = APBPrescaler::DIV2;
config.rcc.apb2_pre = APBPrescaler::DIV1;
}
#[cfg(feature = "stm32f207zg")]
{
use embassy_stm32::rcc::*;
@ -400,6 +431,31 @@ pub fn config() -> Config {
config.rcc.voltage_scale = VoltageScale::Scale0;
}
#[cfg(feature = "stm32h503rb")]
{
use embassy_stm32::rcc::*;
config.rcc.hsi = None;
config.rcc.hsi48 = Some(Default::default()); // needed for RNG
config.rcc.hse = Some(Hse {
freq: Hertz(24_000_000),
mode: HseMode::Oscillator,
});
config.rcc.pll1 = Some(Pll {
source: PllSource::HSE,
prediv: PllPreDiv::DIV6,
mul: PllMul::MUL125,
divp: Some(PllDiv::DIV2),
divq: Some(PllDiv::DIV2),
divr: None,
});
config.rcc.ahb_pre = AHBPrescaler::DIV1;
config.rcc.apb1_pre = APBPrescaler::DIV1;
config.rcc.apb2_pre = APBPrescaler::DIV1;
config.rcc.apb3_pre = APBPrescaler::DIV1;
config.rcc.sys = Sysclk::PLL1_P;
config.rcc.voltage_scale = VoltageScale::Scale0;
}
#[cfg(any(feature = "stm32h755zi", feature = "stm32h753zi"))]
{
use embassy_stm32::rcc::*;