diff options
| author | Felipe Balbi <[email protected]> | 2025-11-17 16:34:11 -0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-11-17 16:34:11 -0800 |
| commit | 62e297c130ac26afe4d7d5752bb79709bd370e39 (patch) | |
| tree | 23d51eaf7d8b366c07f0d19a44f86ed2a1c76fde /examples | |
| parent | bf3ae8e4d69ef2e2ecfdf0b48734d9c91637eb16 (diff) | |
Allow writing binary to flash (#20)
Turns out probe-rs works out of the box.
Signed-off-by: Felipe Balbi <[email protected]>
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/.cargo/config.toml | 2 | ||||
| -rw-r--r-- | examples/Cargo.toml | 4 | ||||
| -rw-r--r-- | examples/memory.x | 4 | ||||
| -rw-r--r-- | examples/src/bin/blink.rs | 4 |
4 files changed, 11 insertions, 3 deletions
diff --git a/examples/.cargo/config.toml b/examples/.cargo/config.toml index ecb11be64..aedc55b06 100644 --- a/examples/.cargo/config.toml +++ b/examples/.cargo/config.toml | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | [target.thumbv8m.main-none-eabihf] | 1 | [target.thumbv8m.main-none-eabihf] |
| 2 | runner = 'probe-rs run --chip MCXA276 --preverify --verify' | 2 | runner = 'probe-rs run --chip MCXA276 --preverify --verify --protocol swd --speed 12000' |
| 3 | 3 | ||
| 4 | rustflags = [ | 4 | rustflags = [ |
| 5 | "-C", "linker=flip-link", | 5 | "-C", "linker=flip-link", |
diff --git a/examples/Cargo.toml b/examples/Cargo.toml index 6b100de42..d03d3d95c 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml | |||
| @@ -19,3 +19,7 @@ embassy-time-driver = "0.2.1" | |||
| 19 | embedded-io-async = "0.6.1" | 19 | embedded-io-async = "0.6.1" |
| 20 | heapless = "0.9.2" | 20 | heapless = "0.9.2" |
| 21 | panic-probe = { version = "1.0", features = ["print-defmt"] } | 21 | panic-probe = { version = "1.0", features = ["print-defmt"] } |
| 22 | |||
| 23 | [profile.release] | ||
| 24 | lto = true # better optimizations | ||
| 25 | debug = 2 # enough information for defmt/rtt locations | ||
diff --git a/examples/memory.x b/examples/memory.x index f4263a412..315ced58a 100644 --- a/examples/memory.x +++ b/examples/memory.x | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | MEMORY | 1 | MEMORY |
| 2 | { | 2 | { |
| 3 | FLASH : ORIGIN = 0x20000000, LENGTH = 64K | 3 | FLASH : ORIGIN = 0x00000000, LENGTH = 1M |
| 4 | RAM : ORIGIN = 0x20010000, LENGTH = 64K | 4 | RAM : ORIGIN = 0x20000000, LENGTH = 128K |
| 5 | } | 5 | } |
diff --git a/examples/src/bin/blink.rs b/examples/src/bin/blink.rs index d8a57c546..c36fc9421 100644 --- a/examples/src/bin/blink.rs +++ b/examples/src/bin/blink.rs | |||
| @@ -27,6 +27,8 @@ async fn main(_spawner: Spawner) { | |||
| 27 | init_ostimer0(hal::pac()); | 27 | init_ostimer0(hal::pac()); |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | defmt::info!("Blink example"); | ||
| 31 | |||
| 30 | // Initialize embassy-time global driver backed by OSTIMER0 | 32 | // Initialize embassy-time global driver backed by OSTIMER0 |
| 31 | hal::ostimer::time_driver::init(hal::config::Config::default().time_interrupt_priority, 1_000_000); | 33 | hal::ostimer::time_driver::init(hal::config::Config::default().time_interrupt_priority, 1_000_000); |
| 32 | 34 | ||
| @@ -42,6 +44,8 @@ async fn main(_spawner: Spawner) { | |||
| 42 | // With pauses between letters and words | 44 | // With pauses between letters and words |
| 43 | 45 | ||
| 44 | loop { | 46 | loop { |
| 47 | defmt::info!("SOS"); | ||
| 48 | |||
| 45 | // S: three short blinks | 49 | // S: three short blinks |
| 46 | for _ in 0..3 { | 50 | for _ in 0..3 { |
| 47 | led.set_low(); | 51 | led.set_low(); |
