summaryrefslogtreecommitdiff
path: root/stm32-metapac-gen/src/assets/build.rs
blob: 13050315eb048715d2e564e1d33e93c02e6cb922 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use std::env;

fn main() {
    let _chip_name = env::vars_os()
        .map(|(a, _)| a.to_string_lossy().to_string())
        .find(|x| x.starts_with("CARGO_FEATURE_STM32"))
        .expect("No stm32xx Cargo feature enabled")
        .strip_prefix("CARGO_FEATURE_")
        .unwrap()
        .to_ascii_lowercase();

    // Put `memory.x` in our output directory and ensure it's
    // on the linker search path.
    let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap());
    //File::create(out.join("memory.x"))
        //.unwrap()
        //.write_all(include_bytes!("memory.x"))
        //.unwrap();

    #[cfg(feature = "rt")]
    println!("cargo:rustc-link-search=src/chips/{}", _chip_name);

    println!("cargo:rerun-if-changed=build.rs");
}