Skip to content

Commit

Permalink
clarify documentation regarding cargo-v5, adjust SystemTime panic m…
Browse files Browse the repository at this point in the history
…essage
  • Loading branch information
Tropix126 authored and max-niederman committed Dec 25, 2024
1 parent 64b4027 commit d631367
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
1 change: 0 additions & 1 deletion compiler/rustc_target/src/spec/targets/armv7a_vex_v5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ pub(crate) fn target() -> Target {
options: TargetOptions {
os: "vexos".into(),
vendor: "vex".into(),
exe_suffix: ".elf".into(),
cpu: "cortex-a9".into(),
abi: "eabihf".into(),
features: "+v7,+neon,+vfp3,+thumb2".into(),
Expand Down
7 changes: 5 additions & 2 deletions library/std/src/sys/pal/vexos/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ pub unsafe extern "C" fn _start() -> ! {
// Setup the stack
asm!("ldr sp, =__stack_top", options(nostack));

// VEXos doesn't explicitly clean out .bss, so as a sanity
// check we'll fill it with zeroes.
// VEXos doesn't explicitly clean out .bss.
ptr::slice_from_raw_parts_mut(
addr_of_mut!(__bss_start),
addr_of_mut!(__bss_end).offset_from(addr_of_mut!(__bss_start)) as usize,
Expand All @@ -52,6 +51,10 @@ pub unsafe extern "C" fn _start() -> ! {
abort_internal()
}

// The code signature is a 32 byte header at the start of user programs that
// identifies the owner and type of the program, as well as certain flags for
// program behavior dictated by the OS. In the event that the user wants to
// change this header, we use weak linkage so it can be overwritten.
#[link_section = ".code_signature"]
#[linkage = "weak"]
#[used]
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/sys/pal/vexos/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ impl Instant {

impl SystemTime {
pub fn now() -> SystemTime {
panic!("time not implemented on this platform")
panic!("system time not implemented on this platform")
}

pub fn sub_time(&self, other: &SystemTime) -> Result<Duration, Duration> {
Expand Down
6 changes: 4 additions & 2 deletions src/doc/rustc/src/platform-support/armv7a-vex-v5.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ This target is cross-compiled. Dynamic linking is unsupported.
`#![no_std]` crates can be built using `build-std` to build `core` and optionally
`alloc`. Unwinding panics are not yet supported.

`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).
`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 environment (e.g. directories cannot be created, filesystem objects cannot be removed).

This target generates binaries in the ELF format that may uploaded to the brain with external tools.

Expand All @@ -44,7 +44,9 @@ build-std-features = ["compiler-builtins-mem"]

## Building Rust programs

The recommended way to build artifacts that 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 functionality for uploading over USB to a V5 Controller or Brain.
When the compiler builds a binary, an ELF build artifact will be produced. Additional tools are required for this artifact to be recognizable to VEXos as a user program.

The [cargo-v5](https://github.com/vexide/cargo-v5) tool is capable of creating binaries that can be uploaded to the V5 brain. This tool wraps the `cargo build` command by supplying arguments necessary to build the target and produce an artifact recognizable to VEXos, while also providing functionality for uploading over USB to a V5 Controller or Brain.

To install the tool, run:

Expand Down

0 comments on commit d631367

Please sign in to comment.