Skip to content

Commit dcb1590

Browse files
committed
blinky size
1 parent 94f9b27 commit dcb1590

File tree

3 files changed

+14
-16
lines changed

3 files changed

+14
-16
lines changed

examples/stm32f4/Cargo.toml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,23 @@ license = "MIT OR Apache-2.0"
66

77
[dependencies]
88
# Change stm32f429zi to your chip name, if necessary.
9-
embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = ["defmt", "stm32f429zi", "unstable-pac", "memory-x", "time-driver-tim4", "exti", "chrono"] }
10-
embassy-sync = { version = "0.7.0", path = "../../embassy-sync", features = ["defmt"] }
11-
embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "executor-interrupt", "defmt"] }
12-
embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
13-
embassy-usb = { version = "0.4.0", path = "../../embassy-usb", features = ["defmt" ] }
14-
embassy-net = { version = "0.7.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", ] }
9+
embassy-stm32 = { version = "0.2.0", path = "../../embassy-stm32", features = ["stm32f401re", "unstable-pac", "memory-x", "time-driver-tim4", "exti", "chrono", "rt"], default-features = false }
10+
embassy-sync = { version = "0.7.0", path = "../../embassy-sync", features = [] }
11+
embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "executor-interrupt"] }
12+
embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt-timestamp-uptime", "tick-hz-32_768"] }
13+
embassy-usb = { version = "0.4.0", path = "../../embassy-usb", features = [] }
14+
embassy-net = { version = "0.7.0", path = "../../embassy-net", features = ["tcp", "dhcpv4", "medium-ethernet", ] }
1515
embassy-net-wiznet = { version = "0.2.0", path = "../../embassy-net-wiznet", features = ["defmt"] }
1616
embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
1717

18-
defmt = "1.0.1"
19-
defmt-rtt = "1.0.0"
18+
panic-halt = "1.0"
2019

2120
cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] }
2221
cortex-m-rt = "0.7.0"
2322
embedded-hal = "0.2.6"
2423
embedded-hal-bus = { version = "0.2", features = ["async"] }
2524
embedded-io = { version = "0.6.0" }
2625
embedded-io-async = { version = "0.6.1" }
27-
panic-probe = { version = "1.0.0", features = ["print-defmt"] }
2826
futures-util = { version = "0.3.30", default-features = false }
2927
heapless = { version = "0.8", default-features = false }
3028
critical-section = "1.1"
@@ -36,4 +34,8 @@ static_cell = "2"
3634
chrono = { version = "^0.4", default-features = false}
3735

3836
[profile.release]
39-
debug = 2
37+
#opt-level = 1 # optimize for size
38+
opt-level = "s" # optimize for size
39+
codegen-units = 1 # better optimizations
40+
debug = true # symbols are nice and they don't increase the size on Flash
41+
lto = true # better optimizations

examples/stm32f4/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
fn main() {
22
println!("cargo:rustc-link-arg-bins=--nmagic");
33
println!("cargo:rustc-link-arg-bins=-Tlink.x");
4-
println!("cargo:rustc-link-arg-bins=-Tdefmt.x");
4+
// println!("cargo:rustc-link-arg-bins=-Tdefmt.x");
55
}

examples/stm32f4/src/bin/blinky.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
11
#![no_std]
22
#![no_main]
33

4-
use defmt::*;
54
use embassy_executor::Spawner;
65
use embassy_stm32::gpio::{Level, Output, Speed};
76
use embassy_time::Timer;
8-
use {defmt_rtt as _, panic_probe as _};
7+
use panic_halt as _;
98

109
#[embassy_executor::main]
1110
async fn main(_spawner: Spawner) {
1211
let p = embassy_stm32::init(Default::default());
13-
info!("Hello World!");
1412

1513
let mut led = Output::new(p.PB7, Level::High, Speed::Low);
1614

1715
loop {
18-
info!("high");
1916
led.set_high();
2017
Timer::after_millis(300).await;
2118

22-
info!("low");
2319
led.set_low();
2420
Timer::after_millis(300).await;
2521
}

0 commit comments

Comments
 (0)