From d1dfaa190518df6adc66ab0716236bac3fe5f894 Mon Sep 17 00:00:00 2001 From: xoviat Date: Sun, 21 May 2023 20:18:26 -0500 Subject: [PATCH] stm32/ipcc: fix hil test --- examples/stm32wb/memory.x | 2 +- tests/stm32/build.rs | 3 +++ tests/stm32/memory_ble.x | 23 +++++++++++++++++++++++ tests/stm32/src/bin/ble.rs | 8 +++----- 4 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 tests/stm32/memory_ble.x diff --git a/examples/stm32wb/memory.x b/examples/stm32wb/memory.x index 5a07b7d1..e1f0530b 100644 --- a/examples/stm32wb/memory.x +++ b/examples/stm32wb/memory.x @@ -11,7 +11,7 @@ MEMORY } /* - Memory size for STM32WB55xC with 512K FLASH + Memory size for STM32WB55xG with 512K FLASH MEMORY { diff --git a/tests/stm32/build.rs b/tests/stm32/build.rs index 7ae31177..ca76b70b 100644 --- a/tests/stm32/build.rs +++ b/tests/stm32/build.rs @@ -12,6 +12,9 @@ fn main() -> Result<(), Box> { if cfg!(any(feature = "stm32f103c8", feature = "stm32c031c6")) { println!("cargo:rustc-link-arg-bins=-Tlink.x"); println!("cargo:rerun-if-changed=link.x"); + } else if cfg!(feature = "stm32wb55rg") { + println!("cargo:rustc-link-arg-bins=-Tlink.x"); + fs::write(out.join("memory.x"), include_bytes!("memory_ble.x")).unwrap(); } else { println!("cargo:rustc-link-arg-bins=-Tlink_ram.x"); println!("cargo:rerun-if-changed=link_ram.x"); diff --git a/tests/stm32/memory_ble.x b/tests/stm32/memory_ble.x new file mode 100644 index 00000000..4332e2c7 --- /dev/null +++ b/tests/stm32/memory_ble.x @@ -0,0 +1,23 @@ +/* + Memory size for STM32WB55xG with 512K FLASH +*/ + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 512K + RAM (xrw) : ORIGIN = 0x20000008, LENGTH = 0x2FFF8 + RAM_SHARED (xrw) : ORIGIN = 0x20030000, LENGTH = 10K +} + +/* Place stack at the end of SRAM1 */ +_stack_start = ORIGIN(RAM) + LENGTH(RAM); + +/* + * Scatter the mailbox interface memory sections in shared memory + */ +SECTIONS { + TL_REF_TABLE (NOLOAD) : { *(TL_REF_TABLE) } >RAM_SHARED + + MB_MEM1 (NOLOAD) : { *(MB_MEM1) } >RAM_SHARED + MB_MEM2 (NOLOAD) : { _sMB_MEM2 = . ; *(MB_MEM2) ; _eMB_MEM2 = . ; } >RAM_SHARED +} diff --git a/tests/stm32/src/bin/ble.rs b/tests/stm32/src/bin/ble.rs index 0f711fda..aedf9a38 100644 --- a/tests/stm32/src/bin/ble.rs +++ b/tests/stm32/src/bin/ble.rs @@ -7,6 +7,7 @@ #[path = "../example_common.rs"] mod example_common; use embassy_executor::Spawner; +use embassy_stm32::interrupt; use embassy_stm32::ipcc::{Config, Ipcc}; use embassy_stm32::tl_mbox::TlMbox; use embassy_time::{Duration, Timer}; @@ -20,9 +21,6 @@ async fn main(_spawner: Spawner) { let config = Config::default(); let mut ipcc = Ipcc::new(p.IPCC, config); - let config = Config::default(); - let mut ipcc = Ipcc::new(p.IPCC, config); - let rx_irq = interrupt::take!(IPCC_C1_RX); let tx_irq = interrupt::take!(IPCC_C1_TX); @@ -31,7 +29,7 @@ async fn main(_spawner: Spawner) { loop { let wireless_fw_info = mbox.wireless_fw_info(); match wireless_fw_info { - None => error!("not yet initialized"), + None => {} Some(fw_info) => { let version_major = fw_info.version_major(); let version_minor = fw_info.version_minor(); @@ -49,7 +47,7 @@ async fn main(_spawner: Spawner) { } } - Timer::after(Duration::from_millis(500)).await; + Timer::after(Duration::from_millis(50)).await; } info!("Test OK");