Skip to content

Commit

Permalink
Merge pull request #3 from rotty/include-memory-x
Browse files Browse the repository at this point in the history
Add `memory.x` to dependent crates via `build.rs`
  • Loading branch information
therealprof authored Jan 17, 2020
2 parents c96499e + 9ddcccf commit 05ccb45
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
use std::env;
use std::fs::File;
use std::io::Write;
use std::path::PathBuf;

fn main() {
// Put the linker script somewhere the linker can find it
let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap());
File::create(out.join("memory.x"))
.unwrap()
.write_all(include_bytes!("memory.x"))
.unwrap();
println!("cargo:rustc-link-search={}", out.display());

println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed=memory.x");
}

0 comments on commit 05ccb45

Please sign in to comment.