-
Notifications
You must be signed in to change notification settings - Fork 13.4k
riscv32
platform support
#117874
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
riscv32
platform support
#117874
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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() | ||
}, | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
riscv32imac-unknown-none-elf.md |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
riscv32imac-unknown-none-elf.md |
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/3** | ||
|
||
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. | ||
MabezDev marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
riscv32imac-unknown-none-elf.md | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did not know about this quirk of mdbook that turns it into a symlink. Cute. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, wait, the table links to the same file... no, I think this is just not getting used at all...? @MabezDev Was this intentional? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops, you're right. I will fix that now. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
riscv32imac-unknown-none-elf.md |
Uh oh!
There was an error while loading. Please reload this page.