Skip to content

Commit 05ccb45

Browse files
authored
Merge pull request #3 from rotty/include-memory-x
Add `memory.x` to dependent crates via `build.rs`
2 parents c96499e + 9ddcccf commit 05ccb45

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)