diff options
author | 2017-03-12 10:51:41 -0500 | |
---|---|---|
committer | 2017-03-12 10:52:18 -0500 | |
commit | 1f2c429ab7e5b12320dbc9616f8a24c0f0c41bf1 (patch) | |
tree | a8081fa244959763e3eabfdde29a6a85c88a311d /cortex-m-rt/build.rs | |
download | cortex-m-1f2c429ab7e5b12320dbc9616f8a24c0f0c41bf1.tar.gz cortex-m-1f2c429ab7e5b12320dbc9616f8a24c0f0c41bf1.tar.zst cortex-m-1f2c429ab7e5b12320dbc9616f8a24c0f0c41bf1.zip |
initial commit
Diffstat (limited to 'cortex-m-rt/build.rs')
-rw-r--r-- | cortex-m-rt/build.rs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/cortex-m-rt/build.rs b/cortex-m-rt/build.rs new file mode 100644 index 0000000..c52b434 --- /dev/null +++ b/cortex-m-rt/build.rs @@ -0,0 +1,29 @@ +#[cfg(feature = "linker-script")] +mod imp { + use std::env; + use std::fs::File; + use std::io::Write; + use std::path::PathBuf; + + pub 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("link.x")) + .unwrap() + .write_all(include_bytes!("link.x")) + .unwrap(); + println!("cargo:rustc-link-search={}", out.display()); + + println!("cargo:rerun-if-changed=build.rs"); + println!("cargo:rerun-if-changed=link.x"); + } +} + +#[cfg(not(feature = "linker-script"))] +mod imp { + pub fn main() {} +} + +fn main() { + imp::main(); +} |