921780e6bf
- Move typelevel interrupts to a special-purpose mod: `embassy_xx::interrupt::typelevel`. - Reexport the PAC interrupt enum in `embassy_xx::interrupt`. This has a few advantages: - The `embassy_xx::interrupt` module is now more "standard". - It works with `cortex-m` functions for manipulating interrupts, for example. - It works with RTIC. - the interrupt enum allows holding value that can be "any interrupt at runtime", this can't be done with typelevel irqs. - When "const-generics on enums" is stable, we can remove the typelevel interrupts without disruptive changes to `embassy_xx::interrupt`.
44 lines
1.1 KiB
Rust
44 lines
1.1 KiB
Rust
//! adapted from https://github.com/stm32-rs/stm32f7xx-hal/blob/master/build.rs
|
|
use std::fs::File;
|
|
use std::io::prelude::*;
|
|
use std::path::PathBuf;
|
|
use std::{env, io};
|
|
|
|
#[derive(Debug)]
|
|
enum Error {
|
|
Env(env::VarError),
|
|
Io(io::Error),
|
|
}
|
|
|
|
impl From<env::VarError> for Error {
|
|
fn from(error: env::VarError) -> Self {
|
|
Self::Env(error)
|
|
}
|
|
}
|
|
|
|
impl From<io::Error> for Error {
|
|
fn from(error: io::Error) -> Self {
|
|
Self::Io(error)
|
|
}
|
|
}
|
|
|
|
fn main() -> Result<(), Error> {
|
|
println!("cargo:rerun-if-changed=build.rs");
|
|
println!("cargo:rerun-if-changed=memory.x");
|
|
|
|
let out_dir = env::var("OUT_DIR")?;
|
|
let out_dir = PathBuf::from(out_dir);
|
|
|
|
let memory_x = include_bytes!("memory.x").as_ref();
|
|
File::create(out_dir.join("memory.x"))?.write_all(memory_x)?;
|
|
|
|
// Tell Cargo where to find the file.
|
|
println!("cargo:rustc-link-search={}", out_dir.display());
|
|
|
|
println!("cargo:rustc-link-arg-bins=--nmagic");
|
|
println!("cargo:rustc-link-arg-bins=-Tlink.x");
|
|
println!("cargo:rustc-link-arg-bins=-Tdefmt.x");
|
|
|
|
Ok(())
|
|
}
|