-
Notifications
You must be signed in to change notification settings - Fork 11
/
build.rs
27 lines (19 loc) · 901 Bytes
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use std::path::PathBuf;
use std::{env, fs};
fn main() {
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
println!("cargo:rustc-link-search={}", out_dir.display());
#[cfg(feature = "gd32vf103")]
fs::copy("src/chip/gd32vf103/memory.x", out_dir.join("memory.x")).unwrap();
#[cfg(feature = "stm32f4")]
fs::copy("src/chip/stm32f4/memory.x", out_dir.join("memory.x")).unwrap();
#[cfg(feature = "stm32f1")]
fs::copy("src/chip/stm32f1/memory.x", out_dir.join("memory.x")).unwrap();
#[cfg(feature = "rp2040")]
fs::copy("src/chip/rp2040/memory.x", out_dir.join("memory.x")).unwrap();
#[cfg(feature = "stm32h7")]
fs::copy("src/chip/stm32h7/memory.x", out_dir.join("memory.x")).unwrap();
#[cfg(feature = "cm32m4")]
fs::copy("src/chip/cm32m4/memory.x", out_dir.join("memory.x")).unwrap();
println!("cargo:rerun-if-changed=memory.x");
}