Skip to content

Commit bc0e24c

Browse files
MabezDevkelnos
authored andcommitted
Add some Xtensa targets
ESP32, ESP8266 and a generic Xtensa target.
1 parent 0c11a48 commit bc0e24c

File tree

4 files changed

+144
-0
lines changed

4 files changed

+144
-0
lines changed

compiler/rustc_target/src/spec/mod.rs

+4
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,10 @@ supported_targets! {
651651

652652
("nvptx64-nvidia-cuda", nvptx64_nvidia_cuda),
653653

654+
("xtensa-esp32-none-elf", xtensa_esp32_none_elf),
655+
("xtensa-esp8266-none-elf", xtensa_esp8266_none_elf),
656+
("xtensa-none-elf", xtensa_none_elf),
657+
654658
("i686-wrs-vxworks", i686_wrs_vxworks),
655659
("x86_64-wrs-vxworks", x86_64_wrs_vxworks),
656660
("armv7-wrs-vxworks-eabihf", armv7_wrs_vxworks_eabihf),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
use crate::spec::{abi::Abi, LinkerFlavor, PanicStrategy, Target, TargetOptions, RelocModel};
2+
3+
pub fn target() -> Target {
4+
Target {
5+
llvm_target: "xtensa-none-elf".to_string(),
6+
pointer_width: 32,
7+
data_layout: "e-m:e-p:32:32-i8:8:32-i16:16:32-i64:64-n32".to_string(),
8+
arch: "xtensa".to_string(),
9+
10+
options: TargetOptions {
11+
endian: "little".to_string(),
12+
c_int_width: "32".to_string(),
13+
os: "none".to_string(),
14+
env: String::new(),
15+
vendor: String::new(),
16+
linker_flavor: LinkerFlavor::Gcc,
17+
18+
executables: true,
19+
cpu: "esp32".to_string(),
20+
linker: Some("xtensa-esp32-elf-gcc".to_string()),
21+
22+
max_atomic_width: Some(32),
23+
24+
// Because these devices have very little resources having an
25+
// unwinder is too onerous so we default to "abort" because the
26+
// "unwind" strategy is very rare.
27+
panic_strategy: PanicStrategy::Abort,
28+
29+
// Similarly, one almost always never wants to use relocatable
30+
// code because of the extra costs it involves.
31+
relocation_model: RelocModel::Static,
32+
33+
emit_debug_gdb_scripts: false,
34+
35+
unsupported_abis: vec![
36+
Abi::Stdcall,
37+
Abi::Fastcall,
38+
Abi::Vectorcall,
39+
Abi::Thiscall,
40+
Abi::Win64,
41+
Abi::SysV64,
42+
],
43+
44+
..Default::default()
45+
},
46+
}
47+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
use crate::spec::{abi::Abi, LinkerFlavor, PanicStrategy, Target, TargetOptions, RelocModel};
2+
3+
pub fn target() -> Target {
4+
Target {
5+
llvm_target: "xtensa-none-elf".to_string(),
6+
pointer_width: 32,
7+
data_layout: "e-m:e-p:32:32-i8:8:32-i16:16:32-i64:64-n32".to_string(),
8+
arch: "xtensa".to_string(),
9+
10+
options: TargetOptions {
11+
endian: "little".to_string(),
12+
c_int_width: "32".to_string(),
13+
os: "none".to_string(),
14+
env: String::new(),
15+
vendor: String::new(),
16+
linker_flavor: LinkerFlavor::Gcc,
17+
18+
executables: true,
19+
cpu: "esp8266".to_string(),
20+
linker: Some("xtensa-lx106-elf-gcc".to_string()),
21+
22+
max_atomic_width: Some(32),
23+
24+
// Because these devices have very little resources having an
25+
// unwinder is too onerous so we default to "abort" because the
26+
// "unwind" strategy is very rare.
27+
panic_strategy: PanicStrategy::Abort,
28+
29+
// Similarly, one almost always never wants to use relocatable
30+
// code because of the extra costs it involves.
31+
relocation_model: RelocModel::Static,
32+
33+
emit_debug_gdb_scripts: false,
34+
35+
unsupported_abis: vec![
36+
Abi::Stdcall,
37+
Abi::Fastcall,
38+
Abi::Vectorcall,
39+
Abi::Thiscall,
40+
Abi::Win64,
41+
Abi::SysV64,
42+
],
43+
44+
..Default::default()
45+
},
46+
}
47+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
use crate::spec::{abi::Abi, LinkerFlavor, PanicStrategy, Target, TargetOptions, RelocModel};
2+
3+
pub fn target() -> Target {
4+
Target {
5+
llvm_target: "xtensa-none-elf".to_string(),
6+
pointer_width: 32,
7+
data_layout: "e-m:e-p:32:32-i8:8:32-i16:16:32-i64:64-n32".to_string(),
8+
arch: "xtensa".to_string(),
9+
10+
options: TargetOptions {
11+
endian: "little".to_string(),
12+
c_int_width: "32".to_string(),
13+
os: "none".to_string(),
14+
env: String::new(),
15+
vendor: String::new(),
16+
linker_flavor: LinkerFlavor::Gcc,
17+
18+
executables: true,
19+
linker: Some("xtensa-esp32-elf-gcc".to_string()),
20+
21+
max_atomic_width: Some(32),
22+
23+
// Because these devices have very little resources having an
24+
// unwinder is too onerous so we default to "abort" because the
25+
// "unwind" strategy is very rare.
26+
panic_strategy: PanicStrategy::Abort,
27+
28+
// Similarly, one almost always never wants to use relocatable
29+
// code because of the extra costs it involves.
30+
relocation_model: RelocModel::Static,
31+
32+
emit_debug_gdb_scripts: false,
33+
34+
unsupported_abis: vec![
35+
Abi::Stdcall,
36+
Abi::Fastcall,
37+
Abi::Vectorcall,
38+
Abi::Thiscall,
39+
Abi::Win64,
40+
Abi::SysV64,
41+
],
42+
43+
..Default::default()
44+
},
45+
}
46+
}

0 commit comments

Comments
 (0)