Skip to content

Commit 68d46ff

Browse files
committed
Add some no_std Xtensa targets
ESP32, ESP32S2, ESP32S3 & ESP8266.
1 parent fdda0b9 commit 68d46ff

File tree

6 files changed

+93
-0
lines changed

6 files changed

+93
-0
lines changed

compiler/rustc_target/src/spec/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ mod windows_gnullvm_base;
9090
mod windows_msvc_base;
9191
mod windows_uwp_gnu_base;
9292
mod windows_uwp_msvc_base;
93+
mod xtensa_base;
9394

9495
/// Linker is called through a C/C++ compiler.
9596
#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)]
@@ -1222,6 +1223,11 @@ supported_targets! {
12221223

12231224
("nvptx64-nvidia-cuda", nvptx64_nvidia_cuda),
12241225

1226+
("xtensa-esp32-none-elf", xtensa_esp32_none_elf),
1227+
("xtensa-esp32s2-none-elf", xtensa_esp32s2_none_elf),
1228+
("xtensa-esp8266-none-elf", xtensa_esp8266_none_elf),
1229+
("xtensa-esp32s3-none-elf", xtensa_esp32s3_none_elf),
1230+
12251231
("i686-wrs-vxworks", i686_wrs_vxworks),
12261232
("x86_64-wrs-vxworks", x86_64_wrs_vxworks),
12271233
("armv7-wrs-vxworks-eabihf", armv7_wrs_vxworks_eabihf),
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
use crate::spec::{LinkerFlavor, Cc, PanicStrategy, RelocModel, TargetOptions, Lld};
2+
use crate::abi::Endian;
3+
4+
pub fn opts() -> TargetOptions {
5+
TargetOptions {
6+
os: "none".into(),
7+
endian: Endian::Little,
8+
c_int_width: "32".into(),
9+
linker_flavor: LinkerFlavor::Gnu(Cc::Yes, Lld::No),
10+
executables: true,
11+
panic_strategy: PanicStrategy::Abort,
12+
relocation_model: RelocModel::Static,
13+
emit_debug_gdb_scripts: false,
14+
atomic_cas: false,
15+
..Default::default()
16+
}
17+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
use crate::spec::{Target, TargetOptions};
2+
3+
pub fn target() -> Target {
4+
Target {
5+
llvm_target: "xtensa-none-elf".into(),
6+
pointer_width: 32,
7+
data_layout: "e-m:e-p:32:32-i64:64-i128:128-n32".into(),
8+
arch: "xtensa".into(),
9+
10+
options: TargetOptions {
11+
cpu: "esp32".into(),
12+
linker: Some("xtensa-esp32-elf-gcc".into()),
13+
max_atomic_width: Some(32),
14+
atomic_cas: true,
15+
..super::xtensa_base::opts()
16+
},
17+
}
18+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
use crate::spec::{Target, TargetOptions};
2+
3+
pub fn target() -> Target {
4+
Target {
5+
llvm_target: "xtensa-none-elf".into(),
6+
pointer_width: 32,
7+
data_layout: "e-m:e-p:32:32-i64:64-i128:128-n32".into(),
8+
arch: "xtensa".into(),
9+
10+
options: TargetOptions {
11+
cpu: "esp32-s2".into(),
12+
linker: Some("xtensa-esp32s2-elf-gcc".into()),
13+
max_atomic_width: Some(32),
14+
..super::xtensa_base::opts()
15+
},
16+
}
17+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
use crate::spec::{Target, TargetOptions};
2+
3+
pub fn target() -> Target {
4+
Target {
5+
llvm_target: "xtensa-none-elf".into(),
6+
pointer_width: 32,
7+
data_layout: "e-m:e-p:32:32-i64:64-i128:128-n32".into(),
8+
arch: "xtensa".into(),
9+
10+
options: TargetOptions {
11+
cpu: "esp32-s3".into(),
12+
linker: Some("xtensa-esp32s3-elf-gcc".into()),
13+
max_atomic_width: Some(32),
14+
atomic_cas: true,
15+
..super::xtensa_base::opts()
16+
},
17+
}
18+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
use crate::spec::{Target, TargetOptions};
2+
3+
pub fn target() -> Target {
4+
Target {
5+
llvm_target: "xtensa-none-elf".into(),
6+
pointer_width: 32,
7+
data_layout: "e-m:e-p:32:32-i64:64-i128:128-n32".into(),
8+
arch: "xtensa".into(),
9+
10+
options: TargetOptions {
11+
cpu: "esp8266".into(),
12+
linker: Some("xtensa-lx106-elf-gcc".into()),
13+
max_atomic_width: Some(32),
14+
..super::xtensa_base::opts()
15+
},
16+
}
17+
}

0 commit comments

Comments
 (0)