19 lines
693 B
Rust
19 lines
693 B
Rust
// I totally understand this and it's not copied from
|
|
// https://github.com/cyang812/rust_stm32f469i/blob/main/led_blinky/
|
|
// hehe
|
|
use std::env;
|
|
use std::fs;
|
|
use std::path::PathBuf;
|
|
|
|
fn main() {
|
|
let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap());
|
|
fs::write(out.join("memory.x"), include_bytes!("memory.x")).unwrap();
|
|
println!("cargo:rustc-link-search={}", out.display());
|
|
|
|
// Only link CCM script when the feature is enabled.
|
|
// Enable with: cargo build --features ccmram
|
|
if env::var_os("CARGO_FEATURE_CCMRAM").is_some() {
|
|
fs::write(out.join("ccmram.x"), include_bytes!("ccmram.x")).unwrap();
|
|
println!("cargo:rustc-link-arg=-Tccmram.x");
|
|
}
|
|
}
|