Remove chip features from xtensa-lx-rt (#3598)

This commit is contained in:
Dániel Buga 2025-06-05 13:55:51 +02:00 committed by GitHub
parent 2b6cece356
commit c6153fa067
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 25 additions and 21 deletions

View File

@ -124,7 +124,6 @@ __usb_otg = [
esp32 = [
"dep:esp32",
"procmacros/rtc-slow",
"xtensa-lx-rt/esp32",
]
# Target the ESP32-C2.
esp32c2 = [
@ -154,7 +153,6 @@ esp32s2 = [
"portable-atomic/unsafe-assume-single-core",
"procmacros/has-ulp-core",
"procmacros/rtc-slow",
"xtensa-lx-rt/esp32s2",
"__usb_otg",
]
# Target the ESP32-S3.
@ -162,7 +160,6 @@ esp32s3 = [
"dep:esp32s3",
"procmacros/has-ulp-core",
"procmacros/rtc-slow",
"xtensa-lx-rt/esp32s3",
"__usb_otg",
]

View File

@ -81,7 +81,6 @@ impl Package {
| EspPrintln
| EspStorage
| EspWifi
| XtensaLxRt
)
}

View File

@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Removed
- The `esp32`, `esp32s2` and `esp32s3` features have been removed. (#3598)
## [v0.19.0] - 2025-06-03

View File

@ -35,13 +35,5 @@ toml = "0.8.20"
## Save and restore float registers for exceptions
float-save-restore = []
#! ### Chip Support Feature Flags
## Target the ESP32
esp32 = []
## Target the ESP32-S2
esp32s2 = []
## Target the ESP32-S3
esp32s3 = []
[lints.rust]
unexpected_cfgs = "allow"

View File

@ -26,6 +26,14 @@ enum Chip {
Esp32s3,
}
impl Chip {
const TARGET_TO_CHIP: &'static [(&'static str, Chip)] = &[
("xtensa-esp32-none-elf", Chip::Esp32),
("xtensa-esp32s2-none-elf", Chip::Esp32s2),
("xtensa-esp32s3-none-elf", Chip::Esp32s3),
];
}
/// The valid interrupt types declared in the `core-isa.h` headers
#[derive(Debug, Clone, Copy, PartialEq, EnumString, Deserialize)]
enum InterruptType {
@ -97,15 +105,22 @@ fn handle_esp32() -> Result<()> {
})
}
let chip = match (
cfg!(feature = "esp32"),
cfg!(feature = "esp32s2"),
cfg!(feature = "esp32s3"),
) {
(true, false, false) => Chip::Esp32,
(false, true, false) => Chip::Esp32s2,
(false, false, true) => Chip::Esp32s3,
_ => panic!("Either the esp32, esp32s2, esp32s3 feature must be enabled"),
// Based on the build target, determine which chip to use.
let target = std::env::var("TARGET");
let target = target.as_deref().unwrap_or("unspecified target");
let Some(chip) = Chip::TARGET_TO_CHIP
.iter()
.copied()
.find_map(|(t, chip)| (t == target).then_some(chip))
else {
panic!(
"Unsupported target: {target}. Expected one of: {}",
Chip::TARGET_TO_CHIP
.iter()
.map(|(t, _)| t.to_string())
.collect::<Vec<_>>()
.join(", ")
);
};
let isa_toml = fs::read_to_string(format!("config/{chip}.toml"))?;