Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cfg symbols for SYSTIMER and USB_SERIAL_JTAG peripherals #195

Merged
merged 1 commit into from
Sep 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions esp-hal-common/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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");
}
}
6 changes: 3 additions & 3 deletions esp-hal-common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;

Expand Down