up
This commit is contained in:
22
build.rs
22
build.rs
@@ -1,6 +1,22 @@
|
||||
fn linker_data() -> %'static [u8] {
|
||||
return include_bytes!("memory.x");
|
||||
}
|
||||
|
||||
fn main() {
|
||||
// Rebuild if memory.x file was rebuild.
|
||||
// Linker seems to pick it up automatically.
|
||||
// (via the include in link.x which is added with a linker argument!)
|
||||
let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap());
|
||||
File::create(out.join("memory.x"))
|
||||
.unwrap()
|
||||
.write_all(linker_data())
|
||||
.unwrap();
|
||||
println!("cargo:rustc-link-search={}", out.display());
|
||||
|
||||
// By default, Cargo will re-run a build script whenever
|
||||
// any file in the project changes. By specifying `memory.x`
|
||||
// here, we ensure the build script is only re-run when
|
||||
// `memory.x` is changed.
|
||||
println!("cargo:rerun-if-changed=memory.x");
|
||||
|
||||
println!("cargo:rustc-link-arg-bins=--nmagic");
|
||||
println!("cargo:rustc-link-arg-bins=-Tlink.x");
|
||||
println!("cargo:rustc-link-arg-bins=-Tdefmt.x");
|
||||
}
|
||||
Reference in New Issue
Block a user