If the embassy feature is enabled, ensure that a time driver implementation is available (#608)
This commit is contained in:
parent
c0ef68115f
commit
8a958e92bc
@ -1,4 +1,8 @@
|
|||||||
use std::{env, fs, path::PathBuf};
|
use std::{
|
||||||
|
env,
|
||||||
|
fs,
|
||||||
|
path::{Path, PathBuf},
|
||||||
|
};
|
||||||
|
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
|
||||||
@ -144,13 +148,20 @@ fn main() {
|
|||||||
println!("cargo:rustc-cfg={peripheral}");
|
println!("cargo:rustc-cfg={peripheral}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// check PSRAM features are only given if the target supports PSRAM
|
// Check PSRAM features are only given if the target supports PSRAM
|
||||||
if !&device.peripherals.contains(&String::from("psram"))
|
if !&device.peripherals.contains(&String::from("psram"))
|
||||||
&& (cfg!(feature = "psram_2m") || cfg!(feature = "psram_4m") || cfg!(feature = "psram_8m"))
|
&& (cfg!(feature = "psram_2m") || cfg!(feature = "psram_4m") || cfg!(feature = "psram_8m"))
|
||||||
{
|
{
|
||||||
panic!("The target does not support PSRAM");
|
panic!("The target does not support PSRAM");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the `embassy` feature is enabled, ensure that a time driver implementation
|
||||||
|
// is available
|
||||||
|
#[cfg(feature = "embassy")]
|
||||||
|
{
|
||||||
|
assert_unique_used_features!("embassy-time-systick", "embassy-time-timg0");
|
||||||
|
}
|
||||||
|
|
||||||
// Place all linker scripts in `OUT_DIR`, and instruct Cargo how to find these
|
// Place all linker scripts in `OUT_DIR`, and instruct Cargo how to find these
|
||||||
// files:
|
// files:
|
||||||
let out = PathBuf::from(env::var_os("OUT_DIR").unwrap());
|
let out = PathBuf::from(env::var_os("OUT_DIR").unwrap());
|
||||||
@ -169,10 +180,7 @@ fn main() {
|
|||||||
gen_efuse_table(device_name, out);
|
gen_efuse_table(device_name, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn copy_dir_all(
|
fn copy_dir_all(src: impl AsRef<Path>, dst: impl AsRef<Path>) -> std::io::Result<()> {
|
||||||
src: impl AsRef<std::path::Path>,
|
|
||||||
dst: impl AsRef<std::path::Path>,
|
|
||||||
) -> std::io::Result<()> {
|
|
||||||
fs::create_dir_all(&dst)?;
|
fs::create_dir_all(&dst)?;
|
||||||
for entry in fs::read_dir(src)? {
|
for entry in fs::read_dir(src)? {
|
||||||
let entry = entry?;
|
let entry = entry?;
|
||||||
@ -186,10 +194,10 @@ fn copy_dir_all(
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn gen_efuse_table(device_name: &str, out_dir: impl AsRef<std::path::Path>) {
|
fn gen_efuse_table(device_name: &str, out_dir: impl AsRef<Path>) {
|
||||||
use std::io::{BufRead, Write};
|
use std::io::{BufRead, Write};
|
||||||
|
|
||||||
let src_path = std::path::PathBuf::from(format!("src/soc/{device_name}/efuse.csv"));
|
let src_path = PathBuf::from(format!("src/soc/{device_name}/efuse.csv"));
|
||||||
let out_path = out_dir.as_ref().join("efuse_fields.rs");
|
let out_path = out_dir.as_ref().join("efuse_fields.rs");
|
||||||
|
|
||||||
println!("cargo:rerun-if-changed={}", src_path.display());
|
println!("cargo:rerun-if-changed={}", src_path.display());
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user