diff options
| author | JuliDi <[email protected]> | 2023-07-28 16:38:02 +0200 |
|---|---|---|
| committer | JuliDi <[email protected]> | 2023-07-28 16:38:02 +0200 |
| commit | 937a63ce28beee87ae78756ecf8377f465b8cf9d (patch) | |
| tree | 5d3e687610d5e976f2c9f532fa7fb866e0187bba /examples/stm32f7/build.rs | |
| parent | b57ba84da5f287d7c2d4899c485b2732ff2745a2 (diff) | |
remove memory.x files for other stm32 examples
Diffstat (limited to 'examples/stm32f7/build.rs')
| -rw-r--r-- | examples/stm32f7/build.rs | 40 |
1 files changed, 1 insertions, 39 deletions
diff --git a/examples/stm32f7/build.rs b/examples/stm32f7/build.rs index 2b5d412a9..8cd32d7ed 100644 --- a/examples/stm32f7/build.rs +++ b/examples/stm32f7/build.rs | |||
| @@ -1,43 +1,5 @@ | |||
| 1 | //! adapted from https://github.com/stm32-rs/stm32f7xx-hal/blob/master/build.rs | 1 | fn main() { |
| 2 | use std::fs::File; | ||
| 3 | use std::io::prelude::*; | ||
| 4 | use std::path::PathBuf; | ||
| 5 | use std::{env, io}; | ||
| 6 | |||
| 7 | #[derive(Debug)] | ||
| 8 | enum Error { | ||
| 9 | Env(env::VarError), | ||
| 10 | Io(io::Error), | ||
| 11 | } | ||
| 12 | |||
| 13 | impl From<env::VarError> for Error { | ||
| 14 | fn from(error: env::VarError) -> Self { | ||
| 15 | Self::Env(error) | ||
| 16 | } | ||
| 17 | } | ||
| 18 | |||
| 19 | impl From<io::Error> for Error { | ||
| 20 | fn from(error: io::Error) -> Self { | ||
| 21 | Self::Io(error) | ||
| 22 | } | ||
| 23 | } | ||
| 24 | |||
| 25 | fn main() -> Result<(), Error> { | ||
| 26 | println!("cargo:rerun-if-changed=build.rs"); | ||
| 27 | println!("cargo:rerun-if-changed=memory.x"); | ||
| 28 | |||
| 29 | let out_dir = env::var("OUT_DIR")?; | ||
| 30 | let out_dir = PathBuf::from(out_dir); | ||
| 31 | |||
| 32 | let memory_x = include_bytes!("memory.x").as_ref(); | ||
| 33 | File::create(out_dir.join("memory.x"))?.write_all(memory_x)?; | ||
| 34 | |||
| 35 | // Tell Cargo where to find the file. | ||
| 36 | println!("cargo:rustc-link-search={}", out_dir.display()); | ||
| 37 | |||
| 38 | println!("cargo:rustc-link-arg-bins=--nmagic"); | 2 | println!("cargo:rustc-link-arg-bins=--nmagic"); |
| 39 | println!("cargo:rustc-link-arg-bins=-Tlink.x"); | 3 | println!("cargo:rustc-link-arg-bins=-Tlink.x"); |
| 40 | println!("cargo:rustc-link-arg-bins=-Tdefmt.x"); | 4 | println!("cargo:rustc-link-arg-bins=-Tdefmt.x"); |
| 41 | |||
| 42 | Ok(()) | ||
| 43 | } | 5 | } |
