aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32h755cm4
diff options
context:
space:
mode:
authorDion Dokter <[email protected]>2024-07-08 16:54:06 +0200
committerDion Dokter <[email protected]>2024-07-08 16:54:06 +0200
commit203297b56912c05d2dd6a009ffeb433fb2ffbea6 (patch)
treefa1708215925ad861d68dc8454069c11ae5c861c /examples/stm32h755cm4
parentb1ea90a87e5ce6b16bbc155ad30d6d3473a998bb (diff)
Make clocks repr C.
Add shared data. Modify freq functions to use shared data. Modify examples to use new init/
Diffstat (limited to 'examples/stm32h755cm4')
-rw-r--r--examples/stm32h755cm4/.cargo/config.toml2
-rw-r--r--examples/stm32h755cm4/memory.x2
-rw-r--r--examples/stm32h755cm4/src/bin/blinky.rs16
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]
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}