Add timer test, add g0, g4 tests.
This commit is contained in:
parent
693690cb5a
commit
dde6607aec
14
ci.sh
14
ci.sh
@ -57,7 +57,9 @@ cargo batch \
|
||||
--- build --release --manifest-path examples/stm32wb55/Cargo.toml --target thumbv7em-none-eabihf --out-dir out/examples/stm32wb55 \
|
||||
--- build --release --manifest-path examples/stm32wl55/Cargo.toml --target thumbv7em-none-eabihf --out-dir out/examples/stm32wl55 \
|
||||
--- build --release --manifest-path examples/wasm/Cargo.toml --target wasm32-unknown-unknown --out-dir out/examples/wasm \
|
||||
--- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7em-none-eabi --out-dir out/tests/stm32f4 \
|
||||
--- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32f429zi --out-dir out/tests/nucleo-stm32f429zi \
|
||||
--- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32g491re --out-dir out/tests/nucleo-stm32g491re \
|
||||
--- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32g071rb --out-dir out/tests/nucleo-stm32g071rb \
|
||||
|
||||
|
||||
function run_elf {
|
||||
@ -70,6 +72,7 @@ function run_elf {
|
||||
-H "Authorization: Bearer $TELEPROBE_TOKEN" \
|
||||
https://teleprobe.embassy.dev/targets/$1/run --data-binary @$2
|
||||
)
|
||||
echo
|
||||
echo HTTP Status code: $STATUSCODE
|
||||
test "$STATUSCODE" -eq 200
|
||||
}
|
||||
@ -83,6 +86,9 @@ if [[ -z "${TELEPROBE_TOKEN-}" ]]; then
|
||||
export TELEPROBE_TOKEN=$(curl -sS -H "Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL" | jq -r '.value')
|
||||
fi
|
||||
|
||||
|
||||
run_elf nucleo-stm32f429zi out/tests/stm32f4/gpio
|
||||
|
||||
for board in $(ls out/tests); do
|
||||
echo Running tests fo board: $board
|
||||
for elf in $(ls out/tests/$board); do
|
||||
run_elf $board out/tests/$board/$elf
|
||||
done
|
||||
done
|
||||
|
@ -4,7 +4,8 @@ build-std-features = ["panic_immediate_abort"]
|
||||
|
||||
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
|
||||
# replace STM32F429ZITx with your chip as listed in `probe-run --list-chips`
|
||||
runner = "probe-run --chip STM32F429ZITx"
|
||||
#runner = "teleprobe run --chip STM32G071RBTx --elf"
|
||||
runner = "./teleprobe.sh nucleo-stm32f429zi"
|
||||
|
||||
rustflags = [
|
||||
# Code-size optimizations.
|
||||
|
@ -5,10 +5,15 @@ name = "embassy-stm32-tests"
|
||||
version = "0.1.0"
|
||||
resolver = "2"
|
||||
|
||||
[features]
|
||||
stm32f429zi = ["embassy-stm32/stm32f429zi"]
|
||||
stm32g071rb = ["embassy-stm32/stm32g071rb"]
|
||||
stm32g491re = ["embassy-stm32/stm32g491re"]
|
||||
|
||||
[dependencies]
|
||||
embassy = { version = "0.1.0", path = "../../embassy", features = ["defmt"] }
|
||||
embassy-traits = { version = "0.1.0", path = "../../embassy-traits", features = ["defmt"] }
|
||||
embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32f429zi", "unstable-pac", "memory-x", "time-driver-tim2"] }
|
||||
embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "unstable-pac", "memory-x", "time-driver-tim2"] }
|
||||
|
||||
defmt = "0.3.0"
|
||||
defmt-rtt = "0.3.0"
|
||||
@ -19,10 +24,8 @@ embedded-hal = "0.2.6"
|
||||
panic-probe = { version = "0.3.0", features = ["print-defmt"] }
|
||||
|
||||
[profile.dev]
|
||||
codegen-units = 1
|
||||
debug = 2
|
||||
debug-assertions = true
|
||||
incremental = false
|
||||
opt-level = 's'
|
||||
overflow-checks = true
|
||||
|
||||
|
@ -15,6 +15,13 @@ use example_common::*;
|
||||
async fn main(_spawner: Spawner, p: Peripherals) {
|
||||
info!("Hello World!");
|
||||
|
||||
// Arduino pins D0 and D1
|
||||
// They're connected together with a 1K resistor.
|
||||
#[cfg(feature = "stm32g491re")]
|
||||
let (mut a, mut b) = (p.PC4, p.PC5);
|
||||
#[cfg(feature = "stm32g071rb")]
|
||||
let (mut a, mut b) = (p.PC4, p.PC5);
|
||||
#[cfg(feature = "stm32f429zi")]
|
||||
let (mut a, mut b) = (p.PG14, p.PG9);
|
||||
|
||||
// Test initial output
|
||||
|
27
tests/stm32/src/bin/timer.rs
Normal file
27
tests/stm32/src/bin/timer.rs
Normal file
@ -0,0 +1,27 @@
|
||||
#![no_std]
|
||||
#![no_main]
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
#[path = "../example_common.rs"]
|
||||
mod example_common;
|
||||
use defmt::assert;
|
||||
use embassy::executor::Spawner;
|
||||
use embassy::time::{Duration, Instant, Timer};
|
||||
use embassy_stm32::Peripherals;
|
||||
use example_common::*;
|
||||
|
||||
#[embassy::main]
|
||||
async fn main(_spawner: Spawner, _p: Peripherals) {
|
||||
info!("Hello World!");
|
||||
|
||||
let start = Instant::now();
|
||||
Timer::after(Duration::from_millis(100)).await;
|
||||
let end = Instant::now();
|
||||
let ms = (end - start).as_millis();
|
||||
info!("slept for {} ms", ms);
|
||||
assert!(ms >= 99);
|
||||
assert!(ms < 110);
|
||||
|
||||
info!("Test OK");
|
||||
cortex_m::asm::bkpt();
|
||||
}
|
Loading…
Reference in New Issue
Block a user