stm32/ipcc: refactor examples and tests
This commit is contained in:
parent
37e104a6b3
commit
09d52638b5
@ -4,8 +4,7 @@
|
|||||||
|
|
||||||
use defmt::*;
|
use defmt::*;
|
||||||
use embassy_executor::Spawner;
|
use embassy_executor::Spawner;
|
||||||
use embassy_stm32::ipcc::Config;
|
use embassy_stm32::tl_mbox::{Config, TlMbox};
|
||||||
use embassy_stm32::tl_mbox::TlMbox;
|
|
||||||
use embassy_stm32::{bind_interrupts, tl_mbox};
|
use embassy_stm32::{bind_interrupts, tl_mbox};
|
||||||
use embassy_time::{Duration, Timer};
|
use embassy_time::{Duration, Timer};
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
@ -41,16 +40,16 @@ async fn main(_spawner: Spawner) {
|
|||||||
Note: extended stack versions are not supported at this time. Do not attempt to install a stack with "extended" in the name.
|
Note: extended stack versions are not supported at this time. Do not attempt to install a stack with "extended" in the name.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
let _p = embassy_stm32::init(Default::default());
|
let p = embassy_stm32::init(Default::default());
|
||||||
info!("Hello World!");
|
info!("Hello World!");
|
||||||
|
|
||||||
let config = Config::default();
|
let config = Config::default();
|
||||||
let mbox = TlMbox::init(Irqs, config);
|
let mbox = TlMbox::new(p.IPCC, Irqs, config);
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
let wireless_fw_info = mbox.wireless_fw_info();
|
let wireless_fw_info = mbox.wireless_fw_info();
|
||||||
match wireless_fw_info {
|
match wireless_fw_info {
|
||||||
None => error!("not yet initialized"),
|
None => info!("not yet initialized"),
|
||||||
Some(fw_info) => {
|
Some(fw_info) => {
|
||||||
let version_major = fw_info.version_major();
|
let version_major = fw_info.version_major();
|
||||||
let version_minor = fw_info.version_minor();
|
let version_minor = fw_info.version_minor();
|
||||||
@ -68,6 +67,9 @@ async fn main(_spawner: Spawner) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer::after(Duration::from_millis(500)).await;
|
Timer::after(Duration::from_millis(50)).await;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
info!("Test OK");
|
||||||
|
cortex_m::asm::bkpt();
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,7 @@
|
|||||||
|
|
||||||
use defmt::*;
|
use defmt::*;
|
||||||
use embassy_executor::Spawner;
|
use embassy_executor::Spawner;
|
||||||
use embassy_stm32::ipcc::Config;
|
use embassy_stm32::tl_mbox::{Config, TlMbox};
|
||||||
use embassy_stm32::tl_mbox::TlMbox;
|
|
||||||
use embassy_stm32::{bind_interrupts, tl_mbox};
|
use embassy_stm32::{bind_interrupts, tl_mbox};
|
||||||
use {defmt_rtt as _, panic_probe as _};
|
use {defmt_rtt as _, panic_probe as _};
|
||||||
|
|
||||||
@ -40,11 +39,11 @@ async fn main(_spawner: Spawner) {
|
|||||||
Note: extended stack versions are not supported at this time. Do not attempt to install a stack with "extended" in the name.
|
Note: extended stack versions are not supported at this time. Do not attempt to install a stack with "extended" in the name.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
let _p = embassy_stm32::init(Default::default());
|
let p = embassy_stm32::init(Default::default());
|
||||||
info!("Hello World!");
|
info!("Hello World!");
|
||||||
|
|
||||||
let config = Config::default();
|
let config = Config::default();
|
||||||
let mbox = TlMbox::init(Irqs, config);
|
let mbox = TlMbox::new(p.IPCC, Irqs, config);
|
||||||
|
|
||||||
info!("waiting for coprocessor to boot");
|
info!("waiting for coprocessor to boot");
|
||||||
let event_box = mbox.read().await;
|
let event_box = mbox.read().await;
|
||||||
@ -94,5 +93,6 @@ async fn main(_spawner: Spawner) {
|
|||||||
payload[3..]
|
payload[3..]
|
||||||
);
|
);
|
||||||
|
|
||||||
loop {}
|
info!("Test OK");
|
||||||
|
cortex_m::asm::bkpt();
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,10 @@ build-std = ["core"]
|
|||||||
build-std-features = ["panic_immediate_abort"]
|
build-std-features = ["panic_immediate_abort"]
|
||||||
|
|
||||||
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
|
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
|
||||||
runner = "teleprobe client run --target bluepill-stm32f103c8 --elf"
|
#runner = "teleprobe client run --target bluepill-stm32f103c8 --elf"
|
||||||
#runner = "teleprobe local run --chip STM32F103C8 --elf"
|
#runner = "teleprobe local run --chip STM32F103C8 --elf"
|
||||||
|
#runner = "teleprobe local run --chip STM32WB55RG --elf"
|
||||||
|
runner = "probe-run --chip STM32WB55RG"
|
||||||
|
|
||||||
rustflags = [
|
rustflags = [
|
||||||
# Code-size optimizations.
|
# Code-size optimizations.
|
||||||
@ -14,7 +16,7 @@ rustflags = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[build]
|
[build]
|
||||||
target = "thumbv7m-none-eabi"
|
target = "thumbv7em-none-eabi"
|
||||||
|
|
||||||
[env]
|
[env]
|
||||||
DEFMT_LOG = "trace"
|
DEFMT_LOG = "trace"
|
||||||
|
@ -12,7 +12,7 @@ stm32g071rb = ["embassy-stm32/stm32g071rb", "not-gpdma"] # Nucleo
|
|||||||
stm32c031c6 = ["embassy-stm32/stm32c031c6", "not-gpdma"] # Nucleo
|
stm32c031c6 = ["embassy-stm32/stm32c031c6", "not-gpdma"] # Nucleo
|
||||||
stm32g491re = ["embassy-stm32/stm32g491re", "not-gpdma"] # Nucleo
|
stm32g491re = ["embassy-stm32/stm32g491re", "not-gpdma"] # Nucleo
|
||||||
stm32h755zi = ["embassy-stm32/stm32h755zi-cm7", "not-gpdma"] # Nucleo
|
stm32h755zi = ["embassy-stm32/stm32h755zi-cm7", "not-gpdma"] # Nucleo
|
||||||
stm32wb55rg = ["embassy-stm32/stm32wb55rg", "not-gpdma"] # Nucleo
|
stm32wb55rg = ["embassy-stm32/stm32wb55rg", "not-gpdma", "ble"] # Nucleo
|
||||||
stm32h563zi = ["embassy-stm32/stm32h563zi"] # Nucleo
|
stm32h563zi = ["embassy-stm32/stm32h563zi"] # Nucleo
|
||||||
stm32u585ai = ["embassy-stm32/stm32u585ai"] # IoT board
|
stm32u585ai = ["embassy-stm32/stm32u585ai"] # IoT board
|
||||||
|
|
||||||
@ -45,8 +45,8 @@ chrono = { version = "^0.4", default-features = false, optional = true}
|
|||||||
# BEGIN TESTS
|
# BEGIN TESTS
|
||||||
# Generated by gen_test.py. DO NOT EDIT.
|
# Generated by gen_test.py. DO NOT EDIT.
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "ble"
|
name = "tl_mbox"
|
||||||
path = "src/bin/ble.rs"
|
path = "src/bin/tl_mbox.rs"
|
||||||
required-features = [ "ble",]
|
required-features = [ "ble",]
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
|
@ -9,17 +9,22 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||||||
println!("cargo:rustc-link-arg-bins=--nmagic");
|
println!("cargo:rustc-link-arg-bins=--nmagic");
|
||||||
|
|
||||||
// too little RAM to run from RAM.
|
// too little RAM to run from RAM.
|
||||||
if cfg!(any(feature = "stm32f103c8", feature = "stm32c031c6")) {
|
if cfg!(any(
|
||||||
|
feature = "stm32f103c8",
|
||||||
|
feature = "stm32c031c6",
|
||||||
|
feature = "stm32wb55rg"
|
||||||
|
)) {
|
||||||
println!("cargo:rustc-link-arg-bins=-Tlink.x");
|
println!("cargo:rustc-link-arg-bins=-Tlink.x");
|
||||||
println!("cargo:rerun-if-changed=link.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 {
|
} else {
|
||||||
println!("cargo:rustc-link-arg-bins=-Tlink_ram.x");
|
println!("cargo:rustc-link-arg-bins=-Tlink_ram.x");
|
||||||
println!("cargo:rerun-if-changed=link_ram.x");
|
println!("cargo:rerun-if-changed=link_ram.x");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if cfg!(feature = "stm32wb55rg") {
|
||||||
|
println!("cargo:rustc-link-arg-bins=-Ttl_mbox.x");
|
||||||
|
}
|
||||||
|
|
||||||
println!("cargo:rustc-link-arg-bins=-Tdefmt.x");
|
println!("cargo:rustc-link-arg-bins=-Tdefmt.x");
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -7,8 +7,7 @@
|
|||||||
#[path = "../example_common.rs"]
|
#[path = "../example_common.rs"]
|
||||||
mod example_common;
|
mod example_common;
|
||||||
use embassy_executor::Spawner;
|
use embassy_executor::Spawner;
|
||||||
use embassy_stm32::ipcc::Config;
|
use embassy_stm32::tl_mbox::{Config, TlMbox};
|
||||||
use embassy_stm32::tl_mbox::TlMbox;
|
|
||||||
use embassy_stm32::{bind_interrupts, tl_mbox};
|
use embassy_stm32::{bind_interrupts, tl_mbox};
|
||||||
use embassy_time::{Duration, Timer};
|
use embassy_time::{Duration, Timer};
|
||||||
use example_common::*;
|
use example_common::*;
|
||||||
@ -20,11 +19,11 @@ bind_interrupts!(struct Irqs{
|
|||||||
|
|
||||||
#[embassy_executor::main]
|
#[embassy_executor::main]
|
||||||
async fn main(_spawner: Spawner) {
|
async fn main(_spawner: Spawner) {
|
||||||
let _p = embassy_stm32::init(config());
|
let p = embassy_stm32::init(config());
|
||||||
info!("Hello World!");
|
info!("Hello World!");
|
||||||
|
|
||||||
let config = Config::default();
|
let config = Config::default();
|
||||||
let mbox = TlMbox::init(Irqs, config);
|
let mbox = TlMbox::new(p.IPCC, Irqs, config);
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
let wireless_fw_info = mbox.wireless_fw_info();
|
let wireless_fw_info = mbox.wireless_fw_info();
|
Loading…
Reference in New Issue
Block a user