aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/stm32h755cm4/.cargo/config.toml2
-rw-r--r--examples/stm32h755cm4/memory.x2
-rw-r--r--examples/stm32h755cm4/src/bin/blinky.rs16
-rw-r--r--examples/stm32h755cm7/.cargo/config.toml2
-rw-r--r--examples/stm32h755cm7/src/bin/blinky.rs12
5 files changed, 25 insertions, 9 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]
2runner = 'probe-rs run --chip STM32H755ZITx' 2runner = 'probe-rs run --chip STM32H755ZITx --catch-hardfault --always-print-stacktrace'
3 3
4[build] 4[build]
5target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU) 5target = "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 @@
1MEMORY 1MEMORY
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
4use core::mem::MaybeUninit;
5
4use defmt::*; 6use defmt::*;
5use embassy_executor::Spawner; 7use embassy_executor::Spawner;
6use embassy_stm32::gpio::{Level, Output, Speed}; 8use embassy_stm32::{
9 gpio::{Level, Output, Speed},
10 SharedData,
11};
7use embassy_time::Timer; 12use embassy_time::Timer;
8use {defmt_rtt as _, panic_probe as _}; 13use {defmt_rtt as _, panic_probe as _};
9 14
15#[link_section = ".ram_d3"]
16static SHARED_DATA: MaybeUninit<SharedData> = MaybeUninit::uninit();
17
10#[embassy_executor::main] 18#[embassy_executor::main]
11async fn main(_spawner: Spawner) { 19async 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}
diff --git a/examples/stm32h755cm7/.cargo/config.toml b/examples/stm32h755cm7/.cargo/config.toml
index f9ae6f2e7..193e6bbc3 100644
--- a/examples/stm32h755cm7/.cargo/config.toml
+++ b/examples/stm32h755cm7/.cargo/config.toml
@@ -1,5 +1,5 @@
1[target.thumbv7em-none-eabihf] 1[target.thumbv7em-none-eabihf]
2runner = 'probe-rs run --chip STM32H755ZITx' 2runner = 'probe-rs run --chip STM32H755ZITx --catch-hardfault --always-print-stacktrace'
3 3
4[build] 4[build]
5target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU) 5target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU)
diff --git a/examples/stm32h755cm7/src/bin/blinky.rs b/examples/stm32h755cm7/src/bin/blinky.rs
index 396b8c718..f76395326 100644
--- a/examples/stm32h755cm7/src/bin/blinky.rs
+++ b/examples/stm32h755cm7/src/bin/blinky.rs
@@ -1,12 +1,20 @@
1#![no_std] 1#![no_std]
2#![no_main] 2#![no_main]
3 3
4use core::mem::MaybeUninit;
5
4use defmt::*; 6use defmt::*;
5use embassy_executor::Spawner; 7use embassy_executor::Spawner;
6use embassy_stm32::gpio::{Level, Output, Speed}; 8use embassy_stm32::{
9 gpio::{Level, Output, Speed},
10 SharedData,
11};
7use embassy_time::Timer; 12use embassy_time::Timer;
8use {defmt_rtt as _, panic_probe as _}; 13use {defmt_rtt as _, panic_probe as _};
9 14
15#[link_section = ".ram_d3"]
16static SHARED_DATA: MaybeUninit<SharedData> = MaybeUninit::uninit();
17
10#[embassy_executor::main] 18#[embassy_executor::main]
11async fn main(_spawner: Spawner) { 19async fn main(_spawner: Spawner) {
12 let mut config = embassy_stm32::Config::default(); 20 let mut config = embassy_stm32::Config::default();
@@ -31,7 +39,7 @@ async fn main(_spawner: Spawner) {
31 config.rcc.voltage_scale = VoltageScale::Scale1; 39 config.rcc.voltage_scale = VoltageScale::Scale1;
32 config.rcc.supply_config = SupplyConfig::DirectSMPS; 40 config.rcc.supply_config = SupplyConfig::DirectSMPS;
33 } 41 }
34 let p = embassy_stm32::init(config); 42 let p = embassy_stm32::init_primary(config, &SHARED_DATA);
35 info!("Hello World!"); 43 info!("Hello World!");
36 44
37 let mut led = Output::new(p.PB14, Level::High, Speed::Low); 45 let mut led = Output::new(p.PB14, Level::High, Speed::Low);