esp-hal/esp32c3-hal/build.rs
Björn Quentin 6d94b61268
Shared GPIO Implementation (#3)
* make esp32c3 examples run from flash / flashable
* use gpio3 for blinky
* direct boot in Cargo.toml
* have a shared gpio impl
* use PACs from their original locations again
2022-01-06 07:57:55 -08:00

28 lines
832 B
Rust

use std::{env, fs::File, io::Write, path::PathBuf};
fn main() {
// Put the linker script somewhere the linker can find it
let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap());
File::create(out.join("memory.x"))
.unwrap()
.write_all(include_bytes!("esp32c3-memory.x"))
.unwrap();
File::create(out.join("esp32c3-link.x"))
.unwrap()
.write_all(include_bytes!("esp32c3-link.x"))
.unwrap();
File::create(out.join("riscv-link.x"))
.unwrap()
.write_all(include_bytes!("riscv-link.x"))
.unwrap();
println!("cargo:rustc-link-search={}", out.display());
// Only re-run the build script when memory.x is changed,
// instead of when any part of the source code changes.
println!("cargo:rerun-if-changed=memory.x");
}