Merge branch 'fixup-bitrot'
This commit is contained in:
commit
04861a0578
|
@ -19,6 +19,10 @@ build = "core_generator/build.rs"
|
|||
|
||||
keywords = ["avr", "arduino", "uno"]
|
||||
|
||||
[build-dependencies]
|
||||
avr-mcu = "0.2"
|
||||
[dependencies]
|
||||
target-cpu-macro = "0.1"
|
||||
|
||||
[build-dependencies]
|
||||
avr-mcu = "0.3"
|
||||
target-cpu-fetch = "0.1"
|
||||
|
||||
|
|
|
@ -23,7 +23,11 @@ fn cores_path() -> PathBuf {
|
|||
}
|
||||
|
||||
fn core_module_name(mcu: &Mcu) -> String {
|
||||
mcu.device.name.to_lowercase().to_owned()
|
||||
normalize_device_name(&mcu.device.name)
|
||||
}
|
||||
|
||||
fn normalize_device_name(device_name: &str) -> String {
|
||||
device_name.to_lowercase().to_owned()
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
@ -31,15 +35,18 @@ fn main() {
|
|||
fs::create_dir_all(&cores_path()).expect("could not create cores directory");
|
||||
}
|
||||
|
||||
let current_mcu = if cfg!(arch = "avr") {
|
||||
let current_mcu = if avr_mcu::current::is_compiling_for_avr() {
|
||||
avr_mcu::current::mcu()
|
||||
.expect("no target cpu specified")
|
||||
} else {
|
||||
avr_mcu::microcontroller(DEFAULT_MCU_FOR_NON_AVR_DOCS)
|
||||
};
|
||||
let current_mcu_name = current_mcu.device.name.clone();
|
||||
|
||||
generate_config_module().unwrap();
|
||||
generate_cores(&[current_mcu]).unwrap();
|
||||
|
||||
println!("cargo:rustc-cfg=avr_mcu_{}", normalize_device_name(¤t_mcu_name));
|
||||
}
|
||||
|
||||
fn generate_cores(mcus: &[Mcu]) -> Result<(), io::Error> {
|
||||
|
@ -82,7 +89,7 @@ fn generate_cores_mod_rs(mcus: &[Mcu]) -> Result<(), io::Error> {
|
|||
writeln!(w, "/// The {}.", mcu.device.name)?;
|
||||
writeln!(w, "pub mod {};", module_name)?;
|
||||
|
||||
writeln!(w, "#[cfg(all(target_arch = \"avr\", target_cpu = \"{}\"))]", module_name)?;
|
||||
writeln!(w, "#[cfg(avr_mcu_{})]", module_name)?;
|
||||
writeln!(w, "pub use self::{} as current;", module_name)?;
|
||||
}
|
||||
writeln!(w)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#![no_std]
|
||||
#![no_main]
|
||||
|
||||
extern crate arduino;
|
||||
use arduino::cores::current;
|
||||
extern crate ruduino;
|
||||
use ruduino::cores::current;
|
||||
|
||||
// Some devices may have multiple SPI modules.
|
||||
// The ATmega328p only has one.
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#![feature(associated_type_defaults)]
|
||||
#![feature(lang_items)]
|
||||
#![feature(unwind_attributes)]
|
||||
#![feature(proc_macro_hygiene)]
|
||||
|
||||
#![no_std]
|
||||
|
||||
|
|
Loading…
Reference in New Issue