You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/doc/rustc/src/platform-support/riscv64im-unknown-none-elf.md
+10-17Lines changed: 10 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ Bare-metal target for RISC-V CPUs with the RV64IM ISA.
12
12
13
13
This target is cross-compiled and uses static linking. The target supports `core` and `alloc`, but not `std`.
14
14
15
-
The target does not support atomic compare-and-swap operations, as the RV64IM ISA lacks the "A" (Atomics) extension. Atomic operations are emulated using the `+forced-atomics` feature.
15
+
As the RV64IM ISA lacks the "A" (Atomics) extension, atomic operations are emulated using the `+forced-atomics` feature.
16
16
17
17
No external toolchain is required and the default `rust-lld` linker works, but you must specify a linker script. The [`riscv-rt`] crate provides suitable linker scripts. The [`riscv-rust-quickstart`] repository gives examples of RISC-V bare-metal projects.
18
18
@@ -21,34 +21,27 @@ No external toolchain is required and the default `rust-lld` linker works, but y
21
21
22
22
## Building the target
23
23
24
-
This target is included in Rust and can be installed via `rustup`:
24
+
You can build Rust with support for the target by adding it to the `target` list in `bootstrap.toml`:
25
25
26
-
```bash
27
-
rustup target add riscv64im-unknown-none-elf
26
+
```toml
27
+
[build]
28
+
target = ["riscv64im-unknown-none-elf"]
28
29
```
29
30
30
-
## Building Rust programs
31
-
32
-
Build using the standard Cargo workflow:
31
+
Alternatively, you can use the `-Z build-std` flag to build the standard library on-demand:
You will need to provide a linker script. The [`riscv-rt`] crate handles this automatically when used as a dependency.
37
+
## Building Rust programs
38
+
39
+
Rust does not yet ship pre-compiled artifacts for this target. To compile for this target (see "Building the target" above)
39
40
40
41
## Testing
41
42
42
43
This is a cross-compiled `no-std` target, which must be run either in a simulator or by programming onto suitable hardware. It is not possible to run the Rust test-suite on this target.
Note: You must explicitly disable the 'a' (atomics) and 'c' (compressed) extensions when using QEMU to accurately emulate an RV64IM-only CPU.
51
-
52
45
## Cross-compilation toolchains and C code
53
46
54
47
This target supports C code. If interlinking with C or C++, you may need to use `riscv64-unknown-elf-gcc` with the appropriate `-march=rv64im -mabi=lp64` flags as a linker instead of `rust-lld`.
0 commit comments