embassy/tests/stm32/build.rs

23 lines
713 B
Rust
Raw Permalink Normal View History

2021-11-24 03:18:30 +01:00
use std::error::Error;
use std::path::PathBuf;
use std::{env, fs};
fn main() -> Result<(), Box<dyn Error>> {
let out = PathBuf::from(env::var("OUT_DIR").unwrap());
fs::write(out.join("link_ram.x"), include_bytes!("link_ram.x")).unwrap();
println!("cargo:rustc-link-search={}", out.display());
println!("cargo:rerun-if-changed=link_ram.x");
println!("cargo:rustc-link-arg-bins=--nmagic");
2023-04-11 13:37:10 +02:00
// too little RAM to run from RAM.
#[cfg(any(feature = "stm32c031c6"))]
println!("cargo:rustc-link-arg-bins=-Tlink.x");
#[cfg(not(any(feature = "stm32c031c6")))]
2021-11-24 03:18:30 +01:00
println!("cargo:rustc-link-arg-bins=-Tlink_ram.x");
2023-04-11 13:37:10 +02:00
2021-11-24 03:18:30 +01:00
println!("cargo:rustc-link-arg-bins=-Tdefmt.x");
Ok(())
}