Add cfg symbols for SYSTIMER and USB_SERIAL_JTAG peripherals

This commit is contained in:
Jesse Braham 2022-09-20 07:19:24 -07:00 committed by Jesse Braham
parent f0350d4ffb
commit 7889a992d7
2 changed files with 16 additions and 6 deletions

View File

@ -11,7 +11,7 @@ fn main() {
n => panic!("Exactly 1 chip must be enabled via its Cargo feature, {n} provided"),
}
// Inject a configuration symbol for the enabled chip
// Configuration symbol for the enabled chip
if esp32 {
println!("cargo:rustc-cfg=esp32");
} else if esp32c3 {
@ -22,17 +22,27 @@ fn main() {
println!("cargo:rustc-cfg=esp32s3");
}
// Inject a configuration symbol for the architecture of the enabled chip
// Configuration symbol for the architecture of the enabled chip
if esp32c3 {
println!("cargo:rustc-cfg=riscv");
} else {
println!("cargo:rustc-cfg=xtensa");
}
// Inject a configuration symbol to state the core count of the enabled chip
// Configuration symbol for the core count of the enabled chip
if esp32c3 || esp32s2 {
println!("cargo:rustc-cfg=single_core");
} else {
println!("cargo:rustc-cfg=multi_core");
}
// Configuration symbol for the SYSTIMER peripheral
if esp32c3 || esp32s2 || esp32s3 {
println!("cargo:rustc-cfg=has_systimer");
}
// Configuration symbol for the USB_SERIAL_JTAG peripheral
if esp32c3 || esp32s3 {
println!("cargo:rustc-cfg=has_usb_serial_jtag");
}
}

View File

@ -29,7 +29,7 @@ pub use esp32s2 as pac;
pub use esp32s3 as pac;
pub use procmacros as macros;
#[cfg(any(esp32c3, esp32s3))]
#[cfg(has_usb_serial_jtag)]
pub use self::usb_serial_jtag::UsbSerialJtag;
pub use self::{
delay::Delay,
@ -57,10 +57,10 @@ pub mod rtc_cntl;
pub mod serial;
pub mod spi;
pub mod system;
#[cfg(any(esp32c3, esp32s3, esp32s2))]
#[cfg(has_systimer)]
pub mod systimer;
pub mod timer;
#[cfg(any(esp32c3, esp32s3))]
#[cfg(has_usb_serial_jtag)]
pub mod usb_serial_jtag;
pub mod utils;