-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add no_std Xtensa targets support
- Loading branch information
1 parent
31026b7
commit fcd81c1
Showing
11 changed files
with
138 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use crate::abi::Endian; | ||
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, TargetOptions}; | ||
|
||
pub fn opts() -> TargetOptions { | ||
TargetOptions { | ||
os: "none".into(), | ||
endian: Endian::Little, | ||
c_int_width: "32".into(), | ||
linker_flavor: LinkerFlavor::Gnu(Cc::Yes, Lld::No), | ||
executables: true, | ||
panic_strategy: PanicStrategy::Abort, | ||
relocation_model: RelocModel::Static, | ||
emit_debug_gdb_scripts: false, | ||
atomic_cas: false, | ||
..Default::default() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
compiler/rustc_target/src/spec/targets/xtensa_esp32_none_elf.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use crate::spec::{base::xtensa, Target, TargetOptions}; | ||
|
||
pub fn target() -> Target { | ||
Target { | ||
llvm_target: "xtensa-none-elf".into(), | ||
pointer_width: 32, | ||
data_layout: "e-m:e-p:32:32-v1:8:8-i64:64-i128:128-n32".into(), | ||
arch: "xtensa".into(), | ||
metadata: crate::spec::TargetMetadata { | ||
description: Some("Xtensa ESP32".into()), | ||
tier: Some(3), | ||
host_tools: Some(false), | ||
std: Some(false), | ||
}, | ||
|
||
options: TargetOptions { | ||
cpu: "esp32".into(), | ||
linker: Some("xtensa-esp32-elf-gcc".into()), | ||
max_atomic_width: Some(32), | ||
atomic_cas: true, | ||
..xtensa::opts() | ||
}, | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
compiler/rustc_target/src/spec/targets/xtensa_esp32s2_none_elf.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
use crate::spec::{base::xtensa, Target, TargetOptions}; | ||
|
||
pub fn target() -> Target { | ||
Target { | ||
llvm_target: "xtensa-none-elf".into(), | ||
pointer_width: 32, | ||
data_layout: "e-m:e-p:32:32-v1:8:8-i64:64-i128:128-n32".into(), | ||
arch: "xtensa".into(), | ||
metadata: crate::spec::TargetMetadata { | ||
description: Some("Xtensa ESP32-S2".into()), | ||
tier: Some(3), | ||
host_tools: Some(false), | ||
std: Some(false), | ||
}, | ||
|
||
options: TargetOptions { | ||
cpu: "esp32-s2".into(), | ||
linker: Some("xtensa-esp32s2-elf-gcc".into()), | ||
max_atomic_width: Some(32), | ||
..xtensa::opts() | ||
}, | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
compiler/rustc_target/src/spec/targets/xtensa_esp32s3_none_elf.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use crate::spec::{base::xtensa, Target, TargetOptions}; | ||
|
||
pub fn target() -> Target { | ||
Target { | ||
llvm_target: "xtensa-none-elf".into(), | ||
pointer_width: 32, | ||
data_layout: "e-m:e-p:32:32-v1:8:8-i64:64-i128:128-n32".into(), | ||
arch: "xtensa".into(), | ||
metadata: crate::spec::TargetMetadata { | ||
description: Some("Xtensa ESP32-S3".into()), | ||
tier: Some(3), | ||
host_tools: Some(false), | ||
std: Some(false), | ||
}, | ||
|
||
options: TargetOptions { | ||
cpu: "esp32-s3".into(), | ||
linker: Some("xtensa-esp32s3-elf-gcc".into()), | ||
max_atomic_width: Some(32), | ||
atomic_cas: true, | ||
..xtensa::opts() | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# `xtensa-*` | ||
|
||
**Tier: 3** | ||
|
||
Targets for Xtensa CPUs. | ||
|
||
## Target maintainers | ||
|
||
- Scott Mabin [@MabezDev](https://github.com/MabezDev) | ||
- Sergio Gasquez [@SergioGasquez](https://github.com/SergioGasquez) | ||
|
||
## Requirements | ||
|
||
The target names follow this format: `xtensa-$CPU`, where `$CPU` specifies the target chip. The following targets are currently defined: | ||
|
||
| Target name | Target CPU(s) | | ||
| ------------------------- | --------------------------------------------------------------- | | ||
| `xtensa-esp32-none-elf` | [ESP32](https://www.espressif.com/en/products/socs/esp32) | | ||
| `xtensa-esp32s2-none-elf` | [ESP32-S2](https://www.espressif.com/en/products/socs/esp32-s2) | | ||
| `xtensa-esp32s3-none-elf` | [ESP32-S3](https://www.espressif.com/en/products/socs/esp32-s3) | | ||
|
||
|
||
## Building the target | ||
|
||
The targets can be built by installing the [Xtensa enabled Rust channel](https://github.com/esp-rs/rust/). See instructions in the [RISC-V and Xtensa Targets section of the The Rust on ESP Book](https://docs.esp-rs.org/book/installation/riscv-and-xtensa.html). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters