aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorxoviat <[email protected]>2023-05-27 15:03:25 -0500
committerxoviat <[email protected]>2023-05-27 15:03:25 -0500
commitc19967dcf24d5223de5fd9b390371dc24aeccc1d (patch)
treec6980e0dd40ff192fc4723f2b885103613bf524b /examples
parent66304a102d628f2e61f9e38bb95eb11a2663335d (diff)
stm32/ipcc: extract tl_mbox linker file to embassy-stm32
Diffstat (limited to 'examples')
-rw-r--r--examples/stm32wb/Cargo.toml2
-rw-r--r--examples/stm32wb/build.rs36
-rw-r--r--examples/stm32wb/memory.x35
3 files changed, 7 insertions, 66 deletions
diff --git a/examples/stm32wb/Cargo.toml b/examples/stm32wb/Cargo.toml
index 3c7e3e874..8cfac772a 100644
--- a/examples/stm32wb/Cargo.toml
+++ b/examples/stm32wb/Cargo.toml
@@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0"
8embassy-sync = { version = "0.2.0", path = "../../embassy-sync", features = ["defmt"] } 8embassy-sync = { version = "0.2.0", path = "../../embassy-sync", features = ["defmt"] }
9embassy-executor = { version = "0.2.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] } 9embassy-executor = { version = "0.2.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] }
10embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } 10embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
11embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32wb55rg", "time-driver-any", "exti"] } 11embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["nightly", "defmt", "stm32wb55rg", "time-driver-any", "memory-x", "exti"] }
12 12
13defmt = "0.3" 13defmt = "0.3"
14defmt-rtt = "0.4" 14defmt-rtt = "0.4"
diff --git a/examples/stm32wb/build.rs b/examples/stm32wb/build.rs
index 30691aa97..29b3a9b2a 100644
--- a/examples/stm32wb/build.rs
+++ b/examples/stm32wb/build.rs
@@ -1,35 +1,11 @@
1//! This build script copies the `memory.x` file from the crate root into 1use std::error::Error;
2//! a directory where the linker can always find it at build time.
3//! For many projects this is optional, as the linker always searches the
4//! project root directory -- wherever `Cargo.toml` is. However, if you
5//! are using a workspace or have a more complicated build setup, this
6//! build script becomes required. Additionally, by requesting that
7//! Cargo re-run the build script whenever `memory.x` is changed,
8//! updating `memory.x` ensures a rebuild of the application with the
9//! new memory settings.
10
11use std::env;
12use std::fs::File;
13use std::io::Write;
14use std::path::PathBuf;
15
16fn main() {
17 // Put `memory.x` in our output directory and ensure it's
18 // on the linker search path.
19 let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap());
20 File::create(out.join("memory.x"))
21 .unwrap()
22 .write_all(include_bytes!("memory.x"))
23 .unwrap();
24 println!("cargo:rustc-link-search={}", out.display());
25
26 // By default, Cargo will re-run a build script whenever
27 // any file in the project changes. By specifying `memory.x`
28 // here, we ensure the build script is only re-run when
29 // `memory.x` is changed.
30 println!("cargo:rerun-if-changed=memory.x");
31 2
3fn main() -> Result<(), Box<dyn Error>> {
32 println!("cargo:rustc-link-arg-bins=--nmagic"); 4 println!("cargo:rustc-link-arg-bins=--nmagic");
33 println!("cargo:rustc-link-arg-bins=-Tlink.x"); 5 println!("cargo:rustc-link-arg-bins=-Tlink.x");
6 println!("cargo:rerun-if-changed=link.x");
7 println!("cargo:rustc-link-arg-bins=-Ttl_mbox.x");
34 println!("cargo:rustc-link-arg-bins=-Tdefmt.x"); 8 println!("cargo:rustc-link-arg-bins=-Tdefmt.x");
9
10 Ok(())
35} 11}
diff --git a/examples/stm32wb/memory.x b/examples/stm32wb/memory.x
deleted file mode 100644
index e1f0530bd..000000000
--- a/examples/stm32wb/memory.x
+++ /dev/null
@@ -1,35 +0,0 @@
1/*
2 The size of this file must be exactly the same as in other memory_xx.x files.
3 Memory size for STM32WB55xC with 256K FLASH
4*/
5
6MEMORY
7{
8 FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 256K
9 RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 192K
10 RAM_SHARED (xrw) : ORIGIN = 0x20030000, LENGTH = 10K
11}
12
13/*
14 Memory size for STM32WB55xG with 512K FLASH
15
16 MEMORY
17 {
18 FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 512K
19 RAM (xrw) : ORIGIN = 0x20000008, LENGTH = 0x2FFF8
20 RAM_SHARED (xrw) : ORIGIN = 0x20030000, LENGTH = 10K
21 }
22*/
23
24/* Place stack at the end of SRAM1 */
25_stack_start = ORIGIN(RAM) + LENGTH(RAM);
26
27/*
28 * Scatter the mailbox interface memory sections in shared memory
29 */
30SECTIONS {
31 TL_REF_TABLE (NOLOAD) : { *(TL_REF_TABLE) } >RAM_SHARED
32
33 MB_MEM1 (NOLOAD) : { *(MB_MEM1) } >RAM_SHARED
34 MB_MEM2 (NOLOAD) : { _sMB_MEM2 = . ; *(MB_MEM2) ; _eMB_MEM2 = . ; } >RAM_SHARED
35}