Skip to content

Commit 252fa27

Browse files
committed
Change target_arch cfgs to chip features
This hopefully will allow the documentation's build to succeed on docs.rs, as it uses the `x86_64-unknown-linux-gnu` target by default
1 parent cfcadc8 commit 252fa27

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

esp-hal-common/src/lib.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
//! [esp32s3-hal]: https://github.com/esp-rs/esp-hal/tree/main/esp32s3-hal
1818
1919
#![no_std]
20-
#![cfg_attr(target_arch = "xtensa", feature(asm_experimental_arch))]
20+
#![cfg_attr(not(feature = "esp32c3"), feature(asm_experimental_arch))]
2121

2222
#[cfg(feature = "esp32")]
2323
pub use esp32 as pac;
@@ -38,8 +38,8 @@ pub mod efuse;
3838

3939
pub mod gpio;
4040
pub mod i2c;
41-
#[cfg_attr(target_arch = "riscv32", path = "interrupt/riscv.rs")]
42-
#[cfg_attr(target_arch = "xtensa", path = "interrupt/xtensa.rs")]
41+
#[cfg_attr(feature = "esp32c3", path = "interrupt/riscv.rs")]
42+
#[cfg_attr(not(feature = "esp32c3"), path = "interrupt/xtensa.rs")]
4343
pub mod interrupt;
4444
pub mod ledc;
4545
pub mod prelude;
@@ -90,12 +90,13 @@ pub enum Cpu {
9090
}
9191

9292
pub fn get_core() -> Cpu {
93-
#[cfg(all(target_arch = "xtensa", feature = "multi_core"))]
93+
#[cfg(all(not(feature = "esp32c3"), feature = "multi_core"))]
9494
match ((xtensa_lx::get_processor_id() >> 13) & 1) != 0 {
9595
false => Cpu::ProCpu,
9696
true => Cpu::AppCpu,
9797
}
98-
// #[cfg(all(target_arch = "riscv32", feature = "multi_core"))]
98+
99+
// #[cfg(all(feature = "esp32c3", feature = "multi_core"))]
99100
// TODO get hart_id
100101

101102
// single core always has ProCpu only
@@ -108,7 +109,7 @@ mod critical_section_impl {
108109

109110
critical_section::set_impl!(CriticalSection);
110111

111-
#[cfg(target_arch = "xtensa")]
112+
#[cfg(not(feature = "esp32c3"))]
112113
mod xtensa {
113114

114115
unsafe impl critical_section::Impl for super::CriticalSection {
@@ -139,7 +140,7 @@ mod critical_section_impl {
139140
}
140141
}
141142

142-
#[cfg(target_arch = "riscv32")]
143+
#[cfg(feature = "esp32c3")]
143144
mod riscv {
144145
unsafe impl critical_section::Impl for super::CriticalSection {
145146
unsafe fn acquire() -> critical_section::RawRestoreState {

0 commit comments

Comments
 (0)