aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32l1
diff options
context:
space:
mode:
authorGreg V <[email protected]>2022-01-14 22:55:39 +0300
committerGreg V <[email protected]>2022-01-14 22:59:57 +0300
commit9fb2b5fa86e0a1b79a3c24a4b415e1c0dbed52cf (patch)
treee4e556a1ac2a4827709f40cb3ac92fa23126e4a5 /examples/stm32l1
parent9fcc2076293971299788d71b353c58665da26161 (diff)
examples/stm32l1: remove memory.x, use the crate-provided one
Diffstat (limited to 'examples/stm32l1')
-rw-r--r--examples/stm32l1/build.rs30
-rw-r--r--examples/stm32l1/memory.x5
2 files changed, 0 insertions, 35 deletions
diff --git a/examples/stm32l1/build.rs b/examples/stm32l1/build.rs
index 30691aa97..8cd32d7ed 100644
--- a/examples/stm32l1/build.rs
+++ b/examples/stm32l1/build.rs
@@ -1,34 +1,4 @@
1//! This build script copies the `memory.x` file from the crate root into
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() { 1fn 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
32 println!("cargo:rustc-link-arg-bins=--nmagic"); 2 println!("cargo:rustc-link-arg-bins=--nmagic");
33 println!("cargo:rustc-link-arg-bins=-Tlink.x"); 3 println!("cargo:rustc-link-arg-bins=-Tlink.x");
34 println!("cargo:rustc-link-arg-bins=-Tdefmt.x"); 4 println!("cargo:rustc-link-arg-bins=-Tdefmt.x");
diff --git a/examples/stm32l1/memory.x b/examples/stm32l1/memory.x
deleted file mode 100644
index c94d395c8..000000000
--- a/examples/stm32l1/memory.x
+++ /dev/null
@@ -1,5 +0,0 @@
1MEMORY
2{
3 FLASH : ORIGIN = 0x08000000, LENGTH = 128K
4 RAM : ORIGIN = 0x20000000, LENGTH = 32K
5}