diff options
Diffstat (limited to 'examples/stm32h755cm4')
| -rw-r--r-- | examples/stm32h755cm4/.cargo/config.toml | 2 | ||||
| -rw-r--r-- | examples/stm32h755cm4/memory.x | 2 | ||||
| -rw-r--r-- | examples/stm32h755cm4/src/bin/blinky.rs | 16 |
3 files changed, 14 insertions, 6 deletions
diff --git a/examples/stm32h755cm4/.cargo/config.toml b/examples/stm32h755cm4/.cargo/config.toml index f9ae6f2e7..193e6bbc3 100644 --- a/examples/stm32h755cm4/.cargo/config.toml +++ b/examples/stm32h755cm4/.cargo/config.toml | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | [target.thumbv7em-none-eabihf] | 1 | [target.thumbv7em-none-eabihf] |
| 2 | runner = 'probe-rs run --chip STM32H755ZITx' | 2 | runner = 'probe-rs run --chip STM32H755ZITx --catch-hardfault --always-print-stacktrace' |
| 3 | 3 | ||
| 4 | [build] | 4 | [build] |
| 5 | target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU) | 5 | target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU) |
diff --git a/examples/stm32h755cm4/memory.x b/examples/stm32h755cm4/memory.x index f946b6210..538bac586 100644 --- a/examples/stm32h755cm4/memory.x +++ b/examples/stm32h755cm4/memory.x | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | MEMORY | 1 | MEMORY |
| 2 | { | 2 | { |
| 3 | FLASH : ORIGIN = 0x08100000, LENGTH = 1024K /* BANK_2 */ | 3 | FLASH : ORIGIN = 0x08100000, LENGTH = 1024K /* BANK_2 */ |
| 4 | RAM : ORIGIN = 0x30000000, LENGTH = 128K /* SRAM1 */ | 4 | RAM : ORIGIN = 0x10000000, LENGTH = 128K /* SRAM1 */ |
| 5 | RAM_D3 : ORIGIN = 0x38000000, LENGTH = 64K /* SRAM4 */ | 5 | RAM_D3 : ORIGIN = 0x38000000, LENGTH = 64K /* SRAM4 */ |
| 6 | } | 6 | } |
| 7 | 7 | ||
diff --git a/examples/stm32h755cm4/src/bin/blinky.rs b/examples/stm32h755cm4/src/bin/blinky.rs index 765be5ba1..52db326b0 100644 --- a/examples/stm32h755cm4/src/bin/blinky.rs +++ b/examples/stm32h755cm4/src/bin/blinky.rs | |||
| @@ -1,15 +1,23 @@ | |||
| 1 | #![no_std] | 1 | #![no_std] |
| 2 | #![no_main] | 2 | #![no_main] |
| 3 | 3 | ||
| 4 | use core::mem::MaybeUninit; | ||
| 5 | |||
| 4 | use defmt::*; | 6 | use defmt::*; |
| 5 | use embassy_executor::Spawner; | 7 | use embassy_executor::Spawner; |
| 6 | use embassy_stm32::gpio::{Level, Output, Speed}; | 8 | use embassy_stm32::{ |
| 9 | gpio::{Level, Output, Speed}, | ||
| 10 | SharedData, | ||
| 11 | }; | ||
| 7 | use embassy_time::Timer; | 12 | use embassy_time::Timer; |
| 8 | use {defmt_rtt as _, panic_probe as _}; | 13 | use {defmt_rtt as _, panic_probe as _}; |
| 9 | 14 | ||
| 15 | #[link_section = ".ram_d3"] | ||
| 16 | static SHARED_DATA: MaybeUninit<SharedData> = MaybeUninit::uninit(); | ||
| 17 | |||
| 10 | #[embassy_executor::main] | 18 | #[embassy_executor::main] |
| 11 | async fn main(_spawner: Spawner) { | 19 | async fn main(_spawner: Spawner) { |
| 12 | let p = embassy_stm32::init(Default::default()); | 20 | let p = embassy_stm32::init_secondary(&SHARED_DATA); |
| 13 | info!("Hello World!"); | 21 | info!("Hello World!"); |
| 14 | 22 | ||
| 15 | let mut led = Output::new(p.PE1, Level::High, Speed::Low); | 23 | let mut led = Output::new(p.PE1, Level::High, Speed::Low); |
| @@ -17,10 +25,10 @@ async fn main(_spawner: Spawner) { | |||
| 17 | loop { | 25 | loop { |
| 18 | info!("high"); | 26 | info!("high"); |
| 19 | led.set_high(); | 27 | led.set_high(); |
| 20 | Timer::after_millis(500).await; | 28 | Timer::after_millis(250).await; |
| 21 | 29 | ||
| 22 | info!("low"); | 30 | info!("low"); |
| 23 | led.set_low(); | 31 | led.set_low(); |
| 24 | Timer::after_millis(500).await; | 32 | Timer::after_millis(250).await; |
| 25 | } | 33 | } |
| 26 | } | 34 | } |
