-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- riscv32imac-unknown-none-elf - Add platform support docs for rv32
- Loading branch information
Showing
11 changed files
with
71 additions
and
4 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
24 changes: 24 additions & 0 deletions
24
compiler/rustc_target/src/spec/targets/riscv32imafc_unknown_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::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions}; | ||
|
||
pub fn target() -> Target { | ||
Target { | ||
data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(), | ||
llvm_target: "riscv32".into(), | ||
pointer_width: 32, | ||
arch: "riscv32".into(), | ||
|
||
options: TargetOptions { | ||
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes), | ||
linker: Some("rust-lld".into()), | ||
cpu: "generic-rv32".into(), | ||
max_atomic_width: Some(32), | ||
llvm_abiname: "ilp32f".into(), | ||
features: "+m,+a,+c,+f".into(), | ||
panic_strategy: PanicStrategy::Abort, | ||
relocation_model: RelocModel::Static, | ||
emit_debug_gdb_scripts: false, | ||
eh_frame_header: 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
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
1 change: 1 addition & 0 deletions
1
src/doc/rustc/src/platform-support/riscv32i-unknown-none-elf.md
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 @@ | ||
riscv32imac-unknown-none-elf.md |
1 change: 1 addition & 0 deletions
1
src/doc/rustc/src/platform-support/riscv32im-unknown-none-elf.md
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 @@ | ||
riscv32imac-unknown-none-elf.md |
34 changes: 34 additions & 0 deletions
34
src/doc/rustc/src/platform-support/riscv32imac-unknown-none-elf.md
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,34 @@ | ||
# `riscv32{i,im,imc,imac,imafc}-unknown-none-elf` | ||
|
||
**Tier: 2** | ||
|
||
Bare-metal target for RISC-V CPUs with the RV32I, RV32IM, RV32IMC, RV32IMAFC and RV32IMAC ISAs. | ||
|
||
## Target maintainers | ||
|
||
* Rust Embedded Working Group, [RISC-V team](https://github.com/rust-embedded/wg#the-risc-v-team) | ||
|
||
## Requirements | ||
|
||
The target is cross-compiled, and uses static linking. No external toolchain | ||
is required and the default `rust-lld` linker works, but you must specify | ||
a linker script. The [`riscv-rt`] crate provides a suitable one. The | ||
[`riscv-rust-quickstart`] repository gives an example of an RV32 project. | ||
|
||
[`riscv-rt`]: https://crates.io/crates/riscv-rt | ||
[`riscv-rust-quickstart`]: https://github.com/riscv-rust/riscv-rust-quickstart | ||
|
||
## Building the target | ||
|
||
This target is included in Rust and can be installed via `rustup`. | ||
|
||
## Testing | ||
|
||
This is a cross-compiled no-std target, which must be run either in a simulator | ||
or by programming them onto suitable hardware. It is not possible to run the | ||
Rust testsuite on this target. | ||
|
||
## Cross-compilation toolchains and C code | ||
|
||
This target supports C code. If interlinking with C or C++, you may need to use | ||
riscv64-unknown-elf-gcc as a linker instead of rust-lld. |
1 change: 1 addition & 0 deletions
1
src/doc/rustc/src/platform-support/riscv32imafc-unknown-none-elf.md
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 @@ | ||
riscv32imac-unknown-none-elf.md |
1 change: 1 addition & 0 deletions
1
src/doc/rustc/src/platform-support/riscv32imc-unknown-none-elf.md
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 @@ | ||
riscv32imac-unknown-none-elf.md |
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