This commit is contained in:
2025-06-27 16:41:18 +02:00
parent 1188995b80
commit ed701e8580
29 changed files with 3329 additions and 376 deletions

View File

@@ -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");
}