Skip to content

Commit 03da867

Browse files
Tropix126max-niederman
authored andcommitted
add platform docs
1 parent 7b4d4ab commit 03da867

File tree

2 files changed

+92
-0
lines changed

2 files changed

+92
-0
lines changed

src/doc/rustc/src/platform-support.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ target | std | notes
159159
`armv7-unknown-linux-musleabihf` | ✓ | Armv7-A Linux with musl 1.2.3, hardfloat
160160
[`armv7-unknown-linux-ohos`](platform-support/openharmony.md) | ✓ | Armv7-A OpenHarmony
161161
[`armv7a-none-eabi`](platform-support/arm-none-eabi.md) | * | Bare Armv7-A
162+
[`armv7a-vex-v5`](platform-support/armv7a-vex-v5.md) | * | Armv7-A Cortex-A9 VEX V5 Brain, vexOS
162163
[`armv7r-none-eabi`](platform-support/armv7r-none-eabi.md) | * | Bare Armv7-R
163164
[`armv7r-none-eabihf`](platform-support/armv7r-none-eabi.md) | * | Bare Armv7-R, hardfloat
164165
`i586-pc-windows-msvc` | * | 32-bit Windows w/o SSE [^x86_32-floats-x87]
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# `armv7a-vex-v5`
2+
3+
**Tier: 3**
4+
5+
6+
Allows compiling user programs for the [VEX V5 Brain](https://www.vexrobotics.com/276-4810.html), a microcontroller for educational and competitive robotics.
7+
8+
Rust support for this target is not affiliated with VEX Robotics or IFI, and is not derived from nor used with any official VEX SDK.
9+
10+
## Target maintainers
11+
12+
This target is maintained by members of the [vexide](https://github.com/vexide) organization:
13+
14+
- [@Tropix126](https://github.com/Tropix126)
15+
- [@Gavin-Niederman](https://github.com/Gavin-Niederman)
16+
- [@max-niederman](https://github.com/max-niederman)
17+
- [@doinkythederp](https://github.com/doinkythederp)
18+
19+
## Requirements
20+
21+
This target is cross-compiled. Dynamic linking is unsupported.
22+
23+
`#![no_std]` crates can be built using `build-std` to build `core` and optionally
24+
`alloc`. Unwinding panics are not yet supported.
25+
26+
`std` is partially implemented, but many modules (such as `thread`, `process`, `net`, etc...) will return errors. An allocator is provided along with partial support for the `time`, `env` and `io` modules. Filesystem operations over SDCard through `std::fs` are partially supported within the restrictions of the user enviornment (e.g. directories cannot be created, filesystem objects cannot be removed).
27+
28+
This target generates binaries in the ELF format that may uploaded to the brain with external tools.
29+
30+
## Building the target
31+
32+
Rust does not ship pre-compiled artifacts for this target. You can use `build-std` feature to build ELF binaries with `std` support.
33+
34+
`.cargo/config.toml`:
35+
36+
```toml
37+
[build]
38+
target = "armv7a-vex-v5"
39+
40+
[unstable]
41+
build-std = ["std", "panic_abort"]
42+
build-std-features = ["compiler-builtins-mem"]
43+
```
44+
45+
## Building Rust programs
46+
47+
The recommended way to build artifacts that can be installed and run on V5 Brain is by using the [cargo-v5](https://github.com/vexide/cargo-v5) tool. This tool wraps the `cargo build` command by supplying arguments necessary to build the target, while also providing uploading functionality.
48+
49+
To install the tool run:
50+
51+
```sh
52+
cargo install cargo-v5
53+
```
54+
55+
The following fields in your project's `Cargo.toml` are read by `cargo-v5` to configure upload behavior:
56+
57+
```toml
58+
[package.metadata.v5]
59+
# Slot number to upload the user program to. This should be from 1-8.
60+
slot = 1
61+
# Program icon/thumbnail that will be displayed on the dashboard.
62+
icon = "cool-x"
63+
# Use gzip compression when uploading binaries.
64+
compress = true
65+
```
66+
67+
To build an uploadable BIN file using the release profile, run:
68+
69+
```sh
70+
cargo v5 build --release
71+
```
72+
73+
Programs can also be directly uploaded to the brain over a USB connection after building:
74+
75+
```sh
76+
cargo v5 upload --release
77+
```
78+
79+
## Testing
80+
81+
Binaries built for this target can be run in an emulator (such as [vex-v5-qemu](https://github.com/vexide/vex-v5-qemu)), or uploaded to a device over a USB or bluetooth connection.
82+
83+
The default Rust test runner is not supported.
84+
85+
The Rust test suite for `library/std` is not yet supported.
86+
87+
## Cross-compilation toolchains and C code
88+
89+
This target can be cross-compiled from any host.
90+
91+
This target does not link to C libraries. OS calls are implemented in rust through the [vex-sdk](https://github.com/vexide/vex-sdk) crate. No `libc` or crt0 implementation is present on this target.

0 commit comments

Comments
 (0)