diff options
| author | xoviat <[email protected]> | 2023-05-27 15:05:50 -0500 |
|---|---|---|
| committer | xoviat <[email protected]> | 2023-05-27 15:05:50 -0500 |
| commit | 09d52638b551a37c8b032ffb6daaa1abd2efa231 (patch) | |
| tree | 13f630e6ced8e55ade446fbf693e3745d0bed0f1 /tests | |
| parent | 37e104a6b380c3c7ec20346a44b11050476a6116 (diff) | |
stm32/ipcc: refactor examples and tests
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/stm32/.cargo/config.toml | 6 | ||||
| -rw-r--r-- | tests/stm32/Cargo.toml | 6 | ||||
| -rw-r--r-- | tests/stm32/build.rs | 13 | ||||
| -rw-r--r-- | tests/stm32/src/bin/tl_mbox.rs (renamed from tests/stm32/src/bin/ble.rs) | 7 |
4 files changed, 19 insertions, 13 deletions
diff --git a/tests/stm32/.cargo/config.toml b/tests/stm32/.cargo/config.toml index 29c4799a1..48588f0b7 100644 --- a/tests/stm32/.cargo/config.toml +++ b/tests/stm32/.cargo/config.toml | |||
| @@ -3,8 +3,10 @@ build-std = ["core"] | |||
| 3 | build-std-features = ["panic_immediate_abort"] | 3 | build-std-features = ["panic_immediate_abort"] |
| 4 | 4 | ||
| 5 | [target.'cfg(all(target_arch = "arm", target_os = "none"))'] | 5 | [target.'cfg(all(target_arch = "arm", target_os = "none"))'] |
| 6 | runner = "teleprobe client run --target bluepill-stm32f103c8 --elf" | 6 | #runner = "teleprobe client run --target bluepill-stm32f103c8 --elf" |
| 7 | #runner = "teleprobe local run --chip STM32F103C8 --elf" | 7 | #runner = "teleprobe local run --chip STM32F103C8 --elf" |
| 8 | #runner = "teleprobe local run --chip STM32WB55RG --elf" | ||
| 9 | runner = "probe-run --chip STM32WB55RG" | ||
| 8 | 10 | ||
| 9 | rustflags = [ | 11 | rustflags = [ |
| 10 | # Code-size optimizations. | 12 | # Code-size optimizations. |
| @@ -14,7 +16,7 @@ rustflags = [ | |||
| 14 | ] | 16 | ] |
| 15 | 17 | ||
| 16 | [build] | 18 | [build] |
| 17 | target = "thumbv7m-none-eabi" | 19 | target = "thumbv7em-none-eabi" |
| 18 | 20 | ||
| 19 | [env] | 21 | [env] |
| 20 | DEFMT_LOG = "trace" | 22 | DEFMT_LOG = "trace" |
diff --git a/tests/stm32/Cargo.toml b/tests/stm32/Cargo.toml index bd8d90abe..23b5f9caa 100644 --- a/tests/stm32/Cargo.toml +++ b/tests/stm32/Cargo.toml | |||
| @@ -12,7 +12,7 @@ stm32g071rb = ["embassy-stm32/stm32g071rb", "not-gpdma"] # Nucleo | |||
| 12 | stm32c031c6 = ["embassy-stm32/stm32c031c6", "not-gpdma"] # Nucleo | 12 | stm32c031c6 = ["embassy-stm32/stm32c031c6", "not-gpdma"] # Nucleo |
| 13 | stm32g491re = ["embassy-stm32/stm32g491re", "not-gpdma"] # Nucleo | 13 | stm32g491re = ["embassy-stm32/stm32g491re", "not-gpdma"] # Nucleo |
| 14 | stm32h755zi = ["embassy-stm32/stm32h755zi-cm7", "not-gpdma"] # Nucleo | 14 | stm32h755zi = ["embassy-stm32/stm32h755zi-cm7", "not-gpdma"] # Nucleo |
| 15 | stm32wb55rg = ["embassy-stm32/stm32wb55rg", "not-gpdma"] # Nucleo | 15 | stm32wb55rg = ["embassy-stm32/stm32wb55rg", "not-gpdma", "ble"] # Nucleo |
| 16 | stm32h563zi = ["embassy-stm32/stm32h563zi"] # Nucleo | 16 | stm32h563zi = ["embassy-stm32/stm32h563zi"] # Nucleo |
| 17 | stm32u585ai = ["embassy-stm32/stm32u585ai"] # IoT board | 17 | stm32u585ai = ["embassy-stm32/stm32u585ai"] # IoT board |
| 18 | 18 | ||
| @@ -45,8 +45,8 @@ chrono = { version = "^0.4", default-features = false, optional = true} | |||
| 45 | # BEGIN TESTS | 45 | # BEGIN TESTS |
| 46 | # Generated by gen_test.py. DO NOT EDIT. | 46 | # Generated by gen_test.py. DO NOT EDIT. |
| 47 | [[bin]] | 47 | [[bin]] |
| 48 | name = "ble" | 48 | name = "tl_mbox" |
| 49 | path = "src/bin/ble.rs" | 49 | path = "src/bin/tl_mbox.rs" |
| 50 | required-features = [ "ble",] | 50 | required-features = [ "ble",] |
| 51 | 51 | ||
| 52 | [[bin]] | 52 | [[bin]] |
diff --git a/tests/stm32/build.rs b/tests/stm32/build.rs index ca76b70bb..b4583147e 100644 --- a/tests/stm32/build.rs +++ b/tests/stm32/build.rs | |||
| @@ -9,17 +9,22 @@ fn main() -> Result<(), Box<dyn Error>> { | |||
| 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. | 11 | // too little RAM to run from RAM. |
| 12 | if cfg!(any(feature = "stm32f103c8", feature = "stm32c031c6")) { | 12 | if cfg!(any( |
| 13 | feature = "stm32f103c8", | ||
| 14 | feature = "stm32c031c6", | ||
| 15 | feature = "stm32wb55rg" | ||
| 16 | )) { | ||
| 13 | println!("cargo:rustc-link-arg-bins=-Tlink.x"); | 17 | println!("cargo:rustc-link-arg-bins=-Tlink.x"); |
| 14 | println!("cargo:rerun-if-changed=link.x"); | 18 | println!("cargo:rerun-if-changed=link.x"); |
| 15 | } else if cfg!(feature = "stm32wb55rg") { | ||
| 16 | println!("cargo:rustc-link-arg-bins=-Tlink.x"); | ||
| 17 | fs::write(out.join("memory.x"), include_bytes!("memory_ble.x")).unwrap(); | ||
| 18 | } else { | 19 | } else { |
| 19 | println!("cargo:rustc-link-arg-bins=-Tlink_ram.x"); | 20 | println!("cargo:rustc-link-arg-bins=-Tlink_ram.x"); |
| 20 | println!("cargo:rerun-if-changed=link_ram.x"); | 21 | println!("cargo:rerun-if-changed=link_ram.x"); |
| 21 | } | 22 | } |
| 22 | 23 | ||
| 24 | if cfg!(feature = "stm32wb55rg") { | ||
| 25 | println!("cargo:rustc-link-arg-bins=-Ttl_mbox.x"); | ||
| 26 | } | ||
| 27 | |||
| 23 | println!("cargo:rustc-link-arg-bins=-Tdefmt.x"); | 28 | println!("cargo:rustc-link-arg-bins=-Tdefmt.x"); |
| 24 | 29 | ||
| 25 | Ok(()) | 30 | Ok(()) |
diff --git a/tests/stm32/src/bin/ble.rs b/tests/stm32/src/bin/tl_mbox.rs index db5cc611d..626e7ac6f 100644 --- a/tests/stm32/src/bin/ble.rs +++ b/tests/stm32/src/bin/tl_mbox.rs | |||
| @@ -7,8 +7,7 @@ | |||
| 7 | #[path = "../example_common.rs"] | 7 | #[path = "../example_common.rs"] |
| 8 | mod example_common; | 8 | mod example_common; |
| 9 | use embassy_executor::Spawner; | 9 | use embassy_executor::Spawner; |
| 10 | use embassy_stm32::ipcc::Config; | 10 | use embassy_stm32::tl_mbox::{Config, TlMbox}; |
| 11 | use embassy_stm32::tl_mbox::TlMbox; | ||
| 12 | use embassy_stm32::{bind_interrupts, tl_mbox}; | 11 | use embassy_stm32::{bind_interrupts, tl_mbox}; |
| 13 | use embassy_time::{Duration, Timer}; | 12 | use embassy_time::{Duration, Timer}; |
| 14 | use example_common::*; | 13 | use example_common::*; |
| @@ -20,11 +19,11 @@ bind_interrupts!(struct Irqs{ | |||
| 20 | 19 | ||
| 21 | #[embassy_executor::main] | 20 | #[embassy_executor::main] |
| 22 | async fn main(_spawner: Spawner) { | 21 | async fn main(_spawner: Spawner) { |
| 23 | let _p = embassy_stm32::init(config()); | 22 | let p = embassy_stm32::init(config()); |
| 24 | info!("Hello World!"); | 23 | info!("Hello World!"); |
| 25 | 24 | ||
| 26 | let config = Config::default(); | 25 | let config = Config::default(); |
| 27 | let mbox = TlMbox::init(Irqs, config); | 26 | let mbox = TlMbox::new(p.IPCC, Irqs, config); |
| 28 | 27 | ||
| 29 | loop { | 28 | loop { |
| 30 | let wireless_fw_info = mbox.wireless_fw_info(); | 29 | let wireless_fw_info = mbox.wireless_fw_info(); |
