-
Notifications
You must be signed in to change notification settings - Fork 284
Expand file tree
/
Copy pathbuild.rs
More file actions
35 lines (29 loc) · 1.25 KB
/
build.rs
File metadata and controls
35 lines (29 loc) · 1.25 KB
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
28
29
30
31
32
33
34
35
//! Set up linker scripts for the rp235x-hal examples
use std::fs::File;
use std::io::Write;
use std::path::PathBuf;
fn main() {
// Put the linker script somewhere the linker can find it
let out = PathBuf::from(std::env::var_os("OUT_DIR").unwrap());
println!("cargo:rustc-link-search={}", out.display());
// The file `memory.x` is loaded by cortex-m-rt's `link.x` script, which
// is what we specify in `.cargo/config.toml` for Arm builds
#[cfg(feature = "rp2040")]
let memory_x = include_bytes!("memory_rp2040.x");
#[cfg(feature = "rp235x")]
let memory_x = include_bytes!("memory_rp235x.x");
#[cfg(not(any(feature = "rp2040", feature = "rp235x")))]
compile_error!("No target feature enabled");
let mut f = File::create(out.join("memory.x")).unwrap();
f.write_all(memory_x).unwrap();
println!("cargo:rerun-if-changed=memory.x");
/*
// The file `rp235x_riscv.x` is what we specify in `.cargo/config.toml` for
// RISC-V builds
let rp235x_riscv_x = include_bytes!("rp235x_riscv.x");
let mut f = File::create(out.join("rp235x_riscv.x")).unwrap();
f.write_all(rp235x_riscv_x).unwrap();
println!("cargo:rerun-if-changed=rp235x_riscv.x");
*/
println!("cargo:rerun-if-changed=build.rs");
}