Compare commits

...

1 Commits

Author SHA1 Message Date
Dario Nieuwenhuis
eba55543be f0 blinky in 3084 bytes 2023-10-11 23:21:28 +02:00
4 changed files with 23 additions and 14 deletions

View File

@ -1,3 +1,18 @@
[unstable]
# enabling these breaks the float tests during linking, with intrinsics
# duplicated between embassy-rp and compilter_builtins
build-std = ["core"]
build-std-features = ["panic_immediate_abort"]
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
runner = "teleprobe client run"
#runner = "teleprobe local run --chip RP2040 --elf"
rustflags = [
# Code-size optimizations.
"-Z", "trap-unreachable=no",
]
[target.thumbv6m-none-eabi] [target.thumbv6m-none-eabi]
runner = 'probe-rs run --chip STM32F091RCTX' runner = 'probe-rs run --chip STM32F091RCTX'

View File

@ -8,16 +8,16 @@ license = "MIT OR Apache-2.0"
[dependencies] [dependencies]
# Change stm32f091rc to your chip name, if necessary. # Change stm32f091rc to your chip name, if necessary.
embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "memory-x", "stm32f091rc", "time-driver-any", "exti", "unstable-pac"] } embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "memory-x", "stm32f091rc", "time-driver-any", "unstable-pac"] }
cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] } cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] }
cortex-m-rt = "0.7.0" cortex-m-rt = "0.7.0"
defmt = "0.3" embassy-sync = { version = "0.3.0", path = "../../embassy-sync", features = [] }
defmt-rtt = "0.4" embassy-executor = { version = "0.3.0", path = "../../embassy-executor", features = ["nightly", "arch-cortex-m", "executor-thread", "integrated-timers"] }
panic-probe = "0.3" embassy-time = { version = "0.1.3", path = "../../embassy-time", features = [ "tick-hz-32_768"] }
embassy-sync = { version = "0.3.0", path = "../../embassy-sync", features = ["defmt"] }
embassy-executor = { version = "0.3.0", path = "../../embassy-executor", features = ["nightly", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] }
embassy-time = { version = "0.1.3", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
static_cell = { version = "1.1", features = ["nightly"]} static_cell = { version = "1.1", features = ["nightly"]}
panic-halt = "0.2.0"
[profile.release] [profile.release]
debug = 2 debug = 2
opt-level = 's'
lto = 'fat'

View File

@ -1,5 +1,4 @@
fn main() { fn main() {
println!("cargo:rustc-link-arg-bins=--nmagic"); println!("cargo:rustc-link-arg-bins=--nmagic");
println!("cargo:rustc-link-arg-bins=-Tlink.x"); println!("cargo:rustc-link-arg-bins=-Tlink.x");
println!("cargo:rustc-link-arg-bins=-Tdefmt.x");
} }

View File

@ -2,26 +2,21 @@
#![no_main] #![no_main]
#![feature(type_alias_impl_trait)] #![feature(type_alias_impl_trait)]
use defmt::*;
use embassy_executor::Spawner; use embassy_executor::Spawner;
use embassy_stm32::gpio::{Level, Output, Speed}; use embassy_stm32::gpio::{Level, Output, Speed};
use embassy_time::{Duration, Timer}; use embassy_time::{Duration, Timer};
use {defmt_rtt as _, panic_probe as _}; use panic_halt as _;
// main is itself an async function. // main is itself an async function.
#[embassy_executor::main] #[embassy_executor::main]
async fn main(_spawner: Spawner) { async fn main(_spawner: Spawner) {
let p = embassy_stm32::init(Default::default()); let p = embassy_stm32::init(Default::default());
info!("Hello World!");
//PA5 is the onboard LED on the Nucleo F091RC //PA5 is the onboard LED on the Nucleo F091RC
let mut led = Output::new(p.PA5, Level::High, Speed::Low); let mut led = Output::new(p.PA5, Level::High, Speed::Low);
loop { loop {
info!("high");
led.set_high(); led.set_high();
Timer::after(Duration::from_millis(300)).await; Timer::after(Duration::from_millis(300)).await;
info!("low");
led.set_low(); led.set_low();
Timer::after(Duration::from_millis(300)).await; Timer::after(Duration::from_millis(300)).await;
} }