stm32/tests: add stm32u0 hil.

This commit is contained in:
Dario Nieuwenhuis 2024-05-13 16:20:52 +02:00
parent 3c52ef60b1
commit 7089e5b586
4 changed files with 32 additions and 1 deletions

1
ci.sh
View File

@ -248,6 +248,7 @@ cargo batch \
--- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32h7s3l8 --out-dir out/tests/stm32h7s3l8 \
--- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32f091rc --out-dir out/tests/stm32f091rc \
--- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32h503rb --out-dir out/tests/stm32h503rb \
--- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32u083rc --out-dir out/tests/stm32u083rc \
--- build --release --manifest-path tests/rp/Cargo.toml --target thumbv6m-none-eabi --out-dir out/tests/rpi-pico \
--- build --release --manifest-path tests/nrf52840/Cargo.toml --target thumbv7em-none-eabi --out-dir out/tests/nrf52840-dk \
--- build --release --manifest-path tests/nrf51422/Cargo.toml --target thumbv6m-none-eabi --out-dir out/tests/nrf51-dk \

View File

@ -33,6 +33,7 @@ stm32wl55jc = ["embassy-stm32/stm32wl55jc-cm4", "not-gpdma", "rng", "chrono"]
stm32f091rc = ["embassy-stm32/stm32f091rc", "cm0", "not-gpdma", "chrono"]
stm32h503rb = ["embassy-stm32/stm32h503rb", "rng", "stop"]
stm32h7s3l8 = ["embassy-stm32/stm32h7s3l8", "rng", "cordic", "hash"] # TODO: fdcan crashes, cryp dma hangs.
stm32u083rc = ["embassy-stm32/stm32u083rc", "cm0", "rng", "chrono"]
cryp = []
hash = []

View File

@ -23,12 +23,17 @@ bind_interrupts!(struct Irqs {
bind_interrupts!(struct Irqs {
RNG_LPUART1 => rng::InterruptHandler<peripherals::RNG>;
});
#[cfg(any(feature = "stm32u083rc"))]
bind_interrupts!(struct Irqs {
RNG_CRYP => rng::InterruptHandler<peripherals::RNG>;
});
#[cfg(not(any(
feature = "stm32l4a6zg",
feature = "stm32l073rz",
feature = "stm32h755zi",
feature = "stm32h753zi",
feature = "stm32f429zi"
feature = "stm32f429zi",
feature = "stm32u083rc"
)))]
bind_interrupts!(struct Irqs {
RNG => rng::InterruptHandler<peripherals::RNG>;

View File

@ -62,6 +62,8 @@ teleprobe_meta::target!(b"nucleo-stm32f091rc");
teleprobe_meta::target!(b"nucleo-stm32h503rb");
#[cfg(feature = "stm32h7s3l8")]
teleprobe_meta::target!(b"nucleo-stm32h7s3l8");
#[cfg(feature = "stm32u083rc")]
teleprobe_meta::target!(b"nucleo-stm32u083rc");
macro_rules! define_peris {
($($name:ident = $peri:ident,)* $(@irq $irq_name:ident = $irq_code:tt,)*) => {
@ -258,6 +260,12 @@ define_peris!(
SPI = SPI1, SPI_SCK = PA5, SPI_MOSI = PB5, 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 = "stm32u083rc")]
define_peris!(
UART = USART1, UART_TX = PA9, UART_RX = PA10, UART_TX_DMA = DMA1_CH1, UART_RX_DMA = DMA1_CH2,
SPI = SPI1, SPI_SCK = PA5, SPI_MOSI = PA7, SPI_MISO = PA6, SPI_TX_DMA = DMA1_CH1, SPI_RX_DMA = DMA1_CH2,
@irq UART = {USART1 => embassy_stm32::usart::InterruptHandler<embassy_stm32::peripherals::USART1>;},
);
pub fn config() -> Config {
#[allow(unused_mut)]
@ -673,5 +681,21 @@ pub fn config() -> Config {
config.rcc.voltage_scale = VoltageScale::HIGH;
config.rcc.mux.spi1sel = mux::Spi123sel::PLL1_Q;
}
#[cfg(any(feature = "stm32u083rc"))]
{
config.rcc.hsi = true;
config.rcc.pll = Some(Pll {
source: PllSource::HSI, // 16 MHz
prediv: PllPreDiv::DIV1,
mul: PllMul::MUL7,
divp: None,
divq: None,
divr: Some(PllRDiv::DIV2), // 56 MHz
});
config.rcc.sys = Sysclk::PLL1_R;
config.rcc.hsi48 = Some(Hsi48Config { sync_from_usb: true }); // needed for USB
config.rcc.mux.clk48sel = mux::Clk48sel::HSI48; // USB uses ICLK
}
config
}