Skip to content

Commit 714ed98

Browse files
bors[bot]arjanmels
andauthored
Merge #448
448: Rename ESP32 to XTensaLX6 and split crate into rt and base r=burrbull a=arjanmels This PR renames ESP32 (SOC name) to XtensaLX6 (CPU name) to align to convention of other platforms. It also adds seperate xtensa-lx6-rt and xtensa-lx6 support (instead of just xtensa-lx6-rt). Co-authored-by: Arjan Mels <[email protected]>
2 parents d894fd1 + 76903e4 commit 714ed98

File tree

8 files changed

+23
-19
lines changed

8 files changed

+23
-19
lines changed

ci/script.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -697,10 +697,13 @@ main() {
697697
echo '[dependencies.bare-metal]' >> $td/Cargo.toml
698698
echo 'version = "0.2.0"' >> $td/Cargo.toml
699699

700+
echo '[dependencies.xtensa-lx6]' >> $td/Cargo.toml
701+
echo 'version = "0.1.0"' >> $td/Cargo.toml
702+
700703
echo '[dependencies.xtensa-lx6-rt]' >> $td/Cargo.toml
701-
echo 'git = "https://github.com/esp-rs/xtensa-lx6-rt.git"' >> $td/Cargo.toml
704+
echo 'version = "0.2.0"' >> $td/Cargo.toml
702705

703-
test_svd_for_target esp32 https://raw.githubusercontent.com/arjanmels/esp32/add-output-svd/svd/esp32.svd
706+
test_svd_for_target xtensalx6 https://raw.githubusercontent.com/arjanmels/esp32/add-output-svd/svd/esp32.svd
704707
;;
705708

706709
esac

ci/svd2rust-regress/src/svd_test.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ static CRATES_ALL: &[&str] = &["bare-metal = \"0.2.0\"", "vcell = \"0.1.0\""];
1010
static CRATES_MSP430: &[&str] = &["msp430 = \"0.1.0\""];
1111
static CRATES_CORTEX_M: &[&str] = &["cortex-m = \"0.5.0\"", "cortex-m-rt = \"0.5.0\""];
1212
static CRATES_RISCV: &[&str] = &["riscv = \"0.4.0\"", "riscv-rt = \"0.4.0\""];
13-
static CRATES_ESP32: &[&str] =
14-
&["xtensa-lx6-rt = {git=\"https://github.com/esp-rs/xtensa-lx6-rt\"}"];
13+
static CRATES_XTENSALX6: &[&str] = &["xtensa-lx6-rt = \"0.2.0\"", "xtensa-lx6 = \"0.1.0\""];
1514
static PROFILE_ALL: &[&str] = &["[profile.dev]", "incremental = false"];
1615
static FEATURES_ALL: &[&str] = &["[features]"];
1716
static FEATURES_CORTEX_M: &[&str] =
@@ -135,7 +134,7 @@ pub fn test(
135134
CortexM => CRATES_CORTEX_M.iter(),
136135
RiscV => CRATES_RISCV.iter(),
137136
Msp430 => CRATES_MSP430.iter(),
138-
ESP32 => CRATES_ESP32.iter(),
137+
XtensaLX6 => CRATES_XTENSALX6.iter(),
139138
})
140139
.chain(PROFILE_ALL.iter())
141140
.chain(FEATURES_ALL.iter())
@@ -168,7 +167,7 @@ pub fn test(
168167
CortexM => "cortex-m",
169168
Msp430 => "msp430",
170169
RiscV => "riscv",
171-
ESP32 => "esp32",
170+
XtensaLX6 => "xtensalx6",
172171
};
173172
let mut svd2rust_bin = Command::new(bin_path);
174173
if nightly {
@@ -185,14 +184,14 @@ pub fn test(
185184
true,
186185
"svd2rust",
187186
Some(&lib_rs_file)
188-
.filter(|_| (t.arch != CortexM) && (t.arch != Msp430) && (t.arch != ESP32)),
187+
.filter(|_| (t.arch != CortexM) && (t.arch != Msp430) && (t.arch != XtensaLX6)),
189188
Some(&svd2rust_err_file),
190189
&[],
191190
)?;
192191
process_stderr_paths.push(svd2rust_err_file);
193192

194193
match t.arch {
195-
CortexM | Msp430 | ESP32 => {
194+
CortexM | Msp430 | XtensaLX6 => {
196195
// TODO: Give error the path to stderr
197196
fs::rename(path_helper_base(&chip_dir, &["lib.rs"]), &lib_rs_file)
198197
.chain_err(|| "While moving lib.rs file")?

ci/svd2rust-regress/src/tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pub enum Architecture {
77
CortexM,
88
Msp430,
99
RiscV,
10-
ESP32,
10+
XtensaLX6,
1111
}
1212

1313
#[derive(Debug)]
@@ -4229,7 +4229,7 @@ pub const TESTS: &[&TestCase] = &[
42294229
run_when: Always,
42304230
},
42314231
&TestCase {
4232-
arch: ESP32,
4232+
arch: XtensaLX6,
42334233
mfgr: Espressif,
42344234
chip: "esp32",
42354235
svd_url: Some(

src/generate/device.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,10 @@ pub fn render(
9797
extern crate riscv_rt;
9898
});
9999
}
100-
Target::ESP32 => {
100+
Target::XtensaLX6 => {
101101
out.extend(quote! {
102+
extern crate xtensa_lx6;
103+
#[cfg(feature = "rt")]
102104
extern crate xtensa_lx6_rt;
103105
});
104106
}
@@ -231,7 +233,7 @@ pub fn render(
231233
Target::CortexM => Some(Ident::new("cortex_m", span)),
232234
Target::Msp430 => Some(Ident::new("msp430", span)),
233235
Target::RISCV => Some(Ident::new("riscv", span)),
234-
Target::ESP32 => Some(Ident::new("xtensa_lx6_rt", span)),
236+
Target::XtensaLX6 => Some(Ident::new("xtensa_lx6", span)),
235237
Target::None => None,
236238
}
237239
.map(|krate| {

src/generate/interrupt.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ pub fn render(
125125
});
126126
}
127127
Target::RISCV => {}
128-
Target::ESP32 => {
128+
Target::XtensaLX6 => {
129129
for name in &names {
130130
writeln!(device_x, "PROVIDE({} = DefaultHandler);", name)?;
131131
}
@@ -202,7 +202,7 @@ pub fn render(
202202
_ => "C",
203203
};
204204

205-
if target != Target::CortexM && target != Target::Msp430 && target != Target::ESP32 {
205+
if target != Target::CortexM && target != Target::Msp430 && target != Target::XtensaLX6 {
206206
mod_items.extend(quote! {
207207
#[cfg(feature = "rt")]
208208
#[macro_export]

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
//!
1919
//! # Usage
2020
//!
21-
//! `svd2rust` supports Cortex-M, MSP430, RISCV and ESP32 microcontrollers. The generated crate can
21+
//! `svd2rust` supports Cortex-M, MSP430, RISCV and Xtensa LX6 microcontrollers. The generated crate can
2222
//! be tailored for either architecture using the `--target` flag. The flag accepts "cortex-m",
23-
//! "msp430", "riscv", "esp32" and "none" as values. "none" can be used to generate a crate that's
23+
//! "msp430", "riscv", "xtensalx6" and "none" as values. "none" can be used to generate a crate that's
2424
//! architecture agnostic and that should work for architectures that `svd2rust` doesn't currently
2525
//! know about like the Cortex-A architecture.
2626
//!

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ fn run() -> Result<()> {
103103
file.write_all(data.as_ref())
104104
.expect("Could not write code to lib.rs");
105105

106-
if target == Target::CortexM || target == Target::Msp430 || target == Target::ESP32 {
106+
if target == Target::CortexM || target == Target::Msp430 || target == Target::XtensaLX6 {
107107
writeln!(File::create("device.x")?, "{}", device_x)?;
108108
writeln!(File::create("build.rs")?, "{}", build_rs())?;
109109
}

src/util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub enum Target {
1818
CortexM,
1919
Msp430,
2020
RISCV,
21-
ESP32,
21+
XtensaLX6,
2222
None,
2323
}
2424

@@ -28,7 +28,7 @@ impl Target {
2828
"cortex-m" => Target::CortexM,
2929
"msp430" => Target::Msp430,
3030
"riscv" => Target::RISCV,
31-
"esp32" => Target::ESP32,
31+
"xtensalx6" => Target::XtensaLX6,
3232
"none" => Target::None,
3333
_ => bail!("unknown target {}", s),
3434
})

0 commit comments

Comments
 (0)