Skip to content

Commit 9ddcccf

Browse files
committed
Add memory.x to dependent crates via build.rs
Include an exact copy of the `build.rs` script as found in the `f3` crate[1]. Including this build script spares binary crates from having to include `memory.x`, instead using it implicitly when making use of the BSP crate. [1]: https://github.com/japaric/f3/blob/master/build.rs
1 parent c96499e commit 9ddcccf

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

build.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
use std::env;
2+
use std::fs::File;
3+
use std::io::Write;
4+
use std::path::PathBuf;
5+
6+
fn main() {
7+
// Put the linker script somewhere the linker can find it
8+
let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap());
9+
File::create(out.join("memory.x"))
10+
.unwrap()
11+
.write_all(include_bytes!("memory.x"))
12+
.unwrap();
13+
println!("cargo:rustc-link-search={}", out.display());
14+
15+
println!("cargo:rerun-if-changed=build.rs");
16+
println!("cargo:rerun-if-changed=memory.x");
17+
}

0 commit comments

Comments
 (0)