aboutsummaryrefslogtreecommitdiffstats
path: root/build.rs
diff options
context:
space:
mode:
authorBrian Cully <bjc@kublai.com>2022-08-06 12:12:37 -0400
committerBrian Cully <bjc@kublai.com>2022-08-06 12:12:37 -0400
commit35248b205cd56633e52b9e634a942e7fd987db0b (patch)
tree37c9fd21e52e7cb0a7c547065a52d73d19d925b9 /build.rs
parent8f9bc49bb40e2972cf0c0bf1b61eb8127a9397df (diff)
downloadluchie-35248b205cd56633e52b9e634a942e7fd987db0b.tar.gz
luchie-35248b205cd56633e52b9e634a942e7fd987db0b.zip
Blinky on a hardware timer, with ‘wfi’ in between.
Diffstat (limited to 'build.rs')
-rw-r--r--build.rs18
1 files changed, 17 insertions, 1 deletions
diff --git a/build.rs b/build.rs
index ff3f6a1..5dd893a 100644
--- a/build.rs
+++ b/build.rs
@@ -1,3 +1,19 @@
+use std::env;
+use std::fs::File;
+use std::io::Write;
+use std::path::Path;
+
fn main() {
- println!("cargo:rerun-if-changed=device.lds")
+ let out_dir = env::var("OUT_DIR").expect("No out dir");
+ let dest_path = Path::new(&out_dir);
+ let mut f = File::create(&dest_path.join("memory.x"))
+ .expect("Could not create file");
+
+ f.write_all(include_bytes!("memory.x"))
+ .expect("Could not write file");
+
+ println!("cargo:rustc-link-search={}", dest_path.display());
+
+ println!("cargo:rerun-if-changed=memory.x");
+ println!("cargo:rerun-if-changed=build.rs");
}