Build stm32 and stm32-examples in test script.

Panic handler was missing, I had to add exaple_common.rs like in the nrf examples.
This commit is contained in:
Dario Nieuwenhuis 2021-01-14 00:53:05 +01:00
parent 0204d4e812
commit 24d6b9ed6c
4 changed files with 27 additions and 9 deletions

View File

@ -31,9 +31,3 @@ stm32f4xx-hal = { version = "0.8.3", features = ["rt", "stm32f405"], git = "htt
futures = { version = "0.3.8", default-features = false, features = ["async-await"] }
cortex-m-rtic = "0.5"
rtt-target = { version = "0.3", features = ["cortex-m"] }
[[bin]]
name = "serial"
path = "src/serial.rs"

View File

@ -3,7 +3,9 @@
#![feature(trait_alias)]
#![feature(type_alias_impl_trait)]
// extern crate panic_halt;
#[path = "../example_common.rs"]
mod example_common;
use example_common::{panic, *};
use cortex_m::singleton;
use cortex_m_rt::entry;
@ -45,7 +47,7 @@ async fn run(dp: stm32::Peripherals, cp: cortex_m::Peripherals) {
let buf = singleton!(: [u8; 30] = [0; 30]).unwrap();
buf[5] = 0x01;
serial.send(buf).await;
serial.send(buf).await.unwrap();
}
static EXECUTOR: Forever<Executor> = Forever::new();
@ -56,7 +58,7 @@ fn main() -> ! {
let cp = cortex_m::peripheral::Peripherals::take().unwrap();
let executor = EXECUTOR.put(Executor::new(cortex_m::asm::sev));
executor.spawn(run(dp, cp));
executor.spawn(run(dp, cp)).unwrap();
loop {
executor.run();

View File

@ -0,0 +1,17 @@
#![macro_use]
use defmt_rtt as _; // global logger
use panic_probe as _;
pub use defmt::*;
use core::sync::atomic::{AtomicUsize, Ordering};
#[defmt::timestamp]
fn timestamp() -> u64 {
static COUNT: AtomicUsize = AtomicUsize::new(0);
// NOTE(no-CAS) `timestamps` runs with interrupts disabled
let n = COUNT.load(Ordering::Relaxed);
COUNT.store(n + 1, Ordering::Relaxed);
n as u64
}

View File

@ -23,3 +23,8 @@ set -euxo pipefail
(cd embassy-nrf; cargo build --target thumbv7em-none-eabi --features 52840,log)
(cd embassy-nrf; cargo build --target thumbv7em-none-eabi --features 52840,defmt)
# embassy-stm32f4
(cd embassy-stm32f4-examples; cargo build --target thumbv7em-none-eabi --bins)
(cd embassy-stm32f4; cargo build --target thumbv7em-none-eabi --features stm32f405)
(cd embassy-stm32f4; cargo build --target thumbv7em-none-eabi --features stm32f405,defmt)