-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Add std
support for armv7a-vex-v5
#145973
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
Conversation
Some changes occurred in src/doc/rustc/src/platform-support cc @Noratrieb These commits modify the If this was unintentional then you should revert the changes before this PR is merged. These commits modify compiler targets. The list of allowed third-party dependencies may have been modified! You must ensure that any new dependencies have compatible licenses before merging. |
I think the limitations here seem fine, and from a quick skim nothing jumps out to me as problematic. Nominating to make sure the team doesn't have any concerns. @rustbot label +I-libs-nominated |
This comment has been minimized.
This comment has been minimized.
@rustbot author |
Reminder, once the PR becomes ready for a review, use |
@rustbot ready |
Thanks for the updates here, I'll take a more thorough look through after the libs meeting (next Wednesday). |
☔ The latest upstream changes (presumably #146160) made this pull request unmergeable. Please resolve the merge conflicts. |
This comment has been minimized.
This comment has been minimized.
Some changes occurred in src/tools/cargo cc @ehuss |
This comment has been minimized.
This comment has been minimized.
Hardware tests seem fine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updates look great! Noticed one last nit on error messages.
Please squash, r=me after that and the error message change
Done! Think things are in order (don't think I have permissions for |
Code changes look good to me! But on a history nit, for the squashed commit it looks like you aren't listed as the author. Since you prepared the final state, you probably want to Also you don't really need to keep all the squashed messages in the final commit message since they aren't relevant anymore. I know this is the default behavior for rebase |
Co-authored-by: Lewis McClelland <lewis@lewismcclelland.me>
Yeah, I squashed everything into the first commit, which is why it ended up that way. I've fixed that issue and added lewis back as a co-author. |
Looks great! Thanks for all the work here. @bors r+ |
Add `std` support for `armv7a-vex-v5` This PR adds standard library support for the VEX V5 Brain (`armv7a-vex-v5` target). It is more-or-less an updated version of the library-side work done in rust-lang#131530. This was a joint effort between me, ``@lewisfm,`` ``@max-niederman,`` ``@Gavin-Niederman`` and several other members of the [`vexide` project](https://github.com/vexide/). ## Background VEXos is a fairly unconventional operating system, with user code running in a restricted enviornment with regards to I/O capabilities and whatnot. As such, several OS-dependent APIs are unsupported or have partial support (such as `std::net`, `std::process`, and most of `std::thread`). A more comprehensive list of what does or doesn't work is outlined in the [updated target documentation](https://github.com/vexide/rust/blob/vex-std/src/doc/rustc/src/platform-support/armv7a-vex-v5.md). Despite these limitations, we believe that `libstd` support on this target still has value to users, especially given the popular use of this hardware for educational purposes. For some previous discussion on this matter, see [this comment](rust-lang#131530 (comment)). ## SDK Linkage VEXos doesn't really ship with an official `libc` or POSIX-style platform API (and though it does port newlib, these are stubbed on top of the underlying SDK). Instead, VEX provides their own SDK for calling platform APIs. Their official SDK is kept proprietary (with public headers), though open-source implementations exist. Following the precedent of the `armv6k-nintendo-3ds` team's work in rust-lang#95897, we've opted not to directly link `libstd` to any SDK with the expectation that users will provide their own with one of the following options: - [`vex-sdk-download`](https://github.com/vexide/vex-sdk/tree/main/packages/vex-sdk-download), which downloads an official proprietary SDK from VEX using a build script. - [`vex-sdk-jumptable`](https://crates.io/crates/vex-sdk-jumptable), which is a compatible, open-source reimplementation of the SDK using firmware jumps. - [`vex-sdk-pros`](https://github.com/vexide/vex-sdk/tree/main/packages/vex-sdk-pros), which uses the [PROS kernel](https://github.com/purduesigbots/pros) as a provider for SDK functions. - Linking their own implementation or stubbing the functions required by libstd. The `vex-sdk` crate used in the VEXos PAL provides `libc`-style FFI bindings for any compatible system library, so any of these options *should* work fine. A functional demo project using `vex-sdk-download` can be found [here](https://github.com/vexide/armv7a-vex-v5-demo/tree/main). ## Future Work This PR implements virtually everything we are currently able to implement given the current capabilities of the platform. The exception to this is file directory enumeration, though the implementation of that is sufficiently [gross enough](https://github.com/vexide/vexide/blob/c6c5bad11e035cf4e51d429dca7e427210185ed4/packages/vexide-core/src/fs/mod.rs#L987) to drive us away from supporting this officially. Additionally, I have a working branch implementing the `panic_unwind` runtime for this target, which is something that would be nice to see in the future, though given the volume of compiler changes i've deemed it out-of-scope for this PR.
Rollup of 14 pull requests Successful merges: - #145067 (RawVecInner: add missing `unsafe` to unsafe fns) - #145277 (Do not materialise X in [X; 0] when X is unsizing a const) - #145973 (Add `std` support for `armv7a-vex-v5`) - #146667 (Add an attribute to check the number of lanes in a SIMD vector after monomorphization) - #146735 (unstably constify float mul_add methods) - #146737 (f16_f128: enable some more tests in Miri) - #146766 (Add attributes for #[global_allocator] functions) - #146905 (llvm: update remarks support on LLVM 22) - #146982 (Remove erroneous normalization step in `tests/run-make/linker-warning`) - #147005 (Small string formatting cleanup) - #147007 (Explicitly note `&[SocketAddr]` impl of `ToSocketAddrs`) - #147008 (bootstrap.py: Respect build.jobs while building bootstrap tool) - #147013 (rustdoc: Fix documentation for `--doctest-build-arg`) - #147015 (Use `LLVMDisposeTargetMachine`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #145973 - vexide:vex-std, r=tgross35 Add `std` support for `armv7a-vex-v5` This PR adds standard library support for the VEX V5 Brain (`armv7a-vex-v5` target). It is more-or-less an updated version of the library-side work done in #131530. This was a joint effort between me, `@lewisfm,` `@max-niederman,` `@Gavin-Niederman` and several other members of the [`vexide` project](https://github.com/vexide/). ## Background VEXos is a fairly unconventional operating system, with user code running in a restricted enviornment with regards to I/O capabilities and whatnot. As such, several OS-dependent APIs are unsupported or have partial support (such as `std::net`, `std::process`, and most of `std::thread`). A more comprehensive list of what does or doesn't work is outlined in the [updated target documentation](https://github.com/vexide/rust/blob/vex-std/src/doc/rustc/src/platform-support/armv7a-vex-v5.md). Despite these limitations, we believe that `libstd` support on this target still has value to users, especially given the popular use of this hardware for educational purposes. For some previous discussion on this matter, see [this comment](#131530 (comment)). ## SDK Linkage VEXos doesn't really ship with an official `libc` or POSIX-style platform API (and though it does port newlib, these are stubbed on top of the underlying SDK). Instead, VEX provides their own SDK for calling platform APIs. Their official SDK is kept proprietary (with public headers), though open-source implementations exist. Following the precedent of the `armv6k-nintendo-3ds` team's work in #95897, we've opted not to directly link `libstd` to any SDK with the expectation that users will provide their own with one of the following options: - [`vex-sdk-download`](https://github.com/vexide/vex-sdk/tree/main/packages/vex-sdk-download), which downloads an official proprietary SDK from VEX using a build script. - [`vex-sdk-jumptable`](https://crates.io/crates/vex-sdk-jumptable), which is a compatible, open-source reimplementation of the SDK using firmware jumps. - [`vex-sdk-pros`](https://github.com/vexide/vex-sdk/tree/main/packages/vex-sdk-pros), which uses the [PROS kernel](https://github.com/purduesigbots/pros) as a provider for SDK functions. - Linking their own implementation or stubbing the functions required by libstd. The `vex-sdk` crate used in the VEXos PAL provides `libc`-style FFI bindings for any compatible system library, so any of these options *should* work fine. A functional demo project using `vex-sdk-download` can be found [here](https://github.com/vexide/armv7a-vex-v5-demo/tree/main). ## Future Work This PR implements virtually everything we are currently able to implement given the current capabilities of the platform. The exception to this is file directory enumeration, though the implementation of that is sufficiently [gross enough](https://github.com/vexide/vexide/blob/c6c5bad11e035cf4e51d429dca7e427210185ed4/packages/vexide-core/src/fs/mod.rs#L987) to drive us away from supporting this officially. Additionally, I have a working branch implementing the `panic_unwind` runtime for this target, which is something that would be nice to see in the future, though given the volume of compiler changes i've deemed it out-of-scope for this PR.
std: fix warning in VEXos stdio module Fixes building `std` on the `armv7a-vex-v5` target due to an unnecessarily mutable argument in `Stdin`. This was a stupid oversight on my part towards the end of rust-lang#145973's review process. Missed a warning and had a bad bootstrap config that didn't tell me about it when testing changes.
std: fix warning in VEXos stdio module Fixes building `std` on the `armv7a-vex-v5` target due to an unnecessarily mutable argument in `Stdin`. This was a stupid oversight on my part towards the end of rust-lang#145973's review process. Missed a warning and had a bad bootstrap config that didn't tell me about it when testing changes.
Rollup of 14 pull requests Successful merges: - rust-lang/rust#145067 (RawVecInner: add missing `unsafe` to unsafe fns) - rust-lang/rust#145277 (Do not materialise X in [X; 0] when X is unsizing a const) - rust-lang/rust#145973 (Add `std` support for `armv7a-vex-v5`) - rust-lang/rust#146667 (Add an attribute to check the number of lanes in a SIMD vector after monomorphization) - rust-lang/rust#146735 (unstably constify float mul_add methods) - rust-lang/rust#146737 (f16_f128: enable some more tests in Miri) - rust-lang/rust#146766 (Add attributes for #[global_allocator] functions) - rust-lang/rust#146905 (llvm: update remarks support on LLVM 22) - rust-lang/rust#146982 (Remove erroneous normalization step in `tests/run-make/linker-warning`) - rust-lang/rust#147005 (Small string formatting cleanup) - rust-lang/rust#147007 (Explicitly note `&[SocketAddr]` impl of `ToSocketAddrs`) - rust-lang/rust#147008 (bootstrap.py: Respect build.jobs while building bootstrap tool) - rust-lang/rust#147013 (rustdoc: Fix documentation for `--doctest-build-arg`) - rust-lang/rust#147015 (Use `LLVMDisposeTargetMachine`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #147049 - vexide:vex-std, r=workingjubilee std: fix warning in VEXos stdio module Fixes building `std` on the `armv7a-vex-v5` target due to an unnecessarily mutable argument in `Stdin`. This was a stupid oversight on my part towards the end of #145973's review process. Missed a warning and had a bad bootstrap config that didn't tell me about it when testing changes.
Add `std` support for `armv7a-vex-v5` This PR adds standard library support for the VEX V5 Brain (`armv7a-vex-v5` target). It is more-or-less an updated version of the library-side work done in rust-lang#131530. This was a joint effort between me, `@lewisfm,` `@max-niederman,` `@Gavin-Niederman` and several other members of the [`vexide` project](https://github.com/vexide/). ## Background VEXos is a fairly unconventional operating system, with user code running in a restricted enviornment with regards to I/O capabilities and whatnot. As such, several OS-dependent APIs are unsupported or have partial support (such as `std::net`, `std::process`, and most of `std::thread`). A more comprehensive list of what does or doesn't work is outlined in the [updated target documentation](https://github.com/vexide/rust/blob/vex-std/src/doc/rustc/src/platform-support/armv7a-vex-v5.md). Despite these limitations, we believe that `libstd` support on this target still has value to users, especially given the popular use of this hardware for educational purposes. For some previous discussion on this matter, see [this comment](rust-lang#131530 (comment)). ## SDK Linkage VEXos doesn't really ship with an official `libc` or POSIX-style platform API (and though it does port newlib, these are stubbed on top of the underlying SDK). Instead, VEX provides their own SDK for calling platform APIs. Their official SDK is kept proprietary (with public headers), though open-source implementations exist. Following the precedent of the `armv6k-nintendo-3ds` team's work in rust-lang#95897, we've opted not to directly link `libstd` to any SDK with the expectation that users will provide their own with one of the following options: - [`vex-sdk-download`](https://github.com/vexide/vex-sdk/tree/main/packages/vex-sdk-download), which downloads an official proprietary SDK from VEX using a build script. - [`vex-sdk-jumptable`](https://crates.io/crates/vex-sdk-jumptable), which is a compatible, open-source reimplementation of the SDK using firmware jumps. - [`vex-sdk-pros`](https://github.com/vexide/vex-sdk/tree/main/packages/vex-sdk-pros), which uses the [PROS kernel](https://github.com/purduesigbots/pros) as a provider for SDK functions. - Linking their own implementation or stubbing the functions required by libstd. The `vex-sdk` crate used in the VEXos PAL provides `libc`-style FFI bindings for any compatible system library, so any of these options *should* work fine. A functional demo project using `vex-sdk-download` can be found [here](https://github.com/vexide/armv7a-vex-v5-demo/tree/main). ## Future Work This PR implements virtually everything we are currently able to implement given the current capabilities of the platform. The exception to this is file directory enumeration, though the implementation of that is sufficiently [gross enough](https://github.com/vexide/vexide/blob/c6c5bad11e035cf4e51d429dca7e427210185ed4/packages/vexide-core/src/fs/mod.rs#L987) to drive us away from supporting this officially. Additionally, I have a working branch implementing the `panic_unwind` runtime for this target, which is something that would be nice to see in the future, though given the volume of compiler changes i've deemed it out-of-scope for this PR.
Rollup of 14 pull requests Successful merges: - rust-lang#145067 (RawVecInner: add missing `unsafe` to unsafe fns) - rust-lang#145277 (Do not materialise X in [X; 0] when X is unsizing a const) - rust-lang#145973 (Add `std` support for `armv7a-vex-v5`) - rust-lang#146667 (Add an attribute to check the number of lanes in a SIMD vector after monomorphization) - rust-lang#146735 (unstably constify float mul_add methods) - rust-lang#146737 (f16_f128: enable some more tests in Miri) - rust-lang#146766 (Add attributes for #[global_allocator] functions) - rust-lang#146905 (llvm: update remarks support on LLVM 22) - rust-lang#146982 (Remove erroneous normalization step in `tests/run-make/linker-warning`) - rust-lang#147005 (Small string formatting cleanup) - rust-lang#147007 (Explicitly note `&[SocketAddr]` impl of `ToSocketAddrs`) - rust-lang#147008 (bootstrap.py: Respect build.jobs while building bootstrap tool) - rust-lang#147013 (rustdoc: Fix documentation for `--doctest-build-arg`) - rust-lang#147015 (Use `LLVMDisposeTargetMachine`) r? `@ghost` `@rustbot` modify labels: rollup
std: fix warning in VEXos stdio module Fixes building `std` on the `armv7a-vex-v5` target due to an unnecessarily mutable argument in `Stdin`. This was a stupid oversight on my part towards the end of rust-lang#145973's review process. Missed a warning and had a bad bootstrap config that didn't tell me about it when testing changes.
This PR reorganizes vexide's internal codebase in preparation for rust-lang/rust#145973. Testing this branch currently requires the `nightly-2025-09-26` toolchain or newer, as well as a `cargo-v5` installation built from [this branch](https://github.com/vexide/cargo-v5/tree/upstreamed-target). Things are still pretty messy - some docs and tests and whatnot need updating. Closes #352, #354, #358, and #334. ## Relevant Work - Rust fork: https://github.com/vexide/rust/tree/vex-std - Website: - vexide/website#29 - ~~https://github.com/vexide/website/compare/v0.8-upgrade-guide~~ (merged into former) - cargo-v5: vexide/cargo-v5#30 - vex-v5-serial refactor: vexide/vex-v5-serial#9 - vex-sdk refactors: https://github.com/vexide/vex-sdk - vexide-template: vexide/vexide-template#14 ## The Big Changes - `vexide` now uses rustc's `armv7a-vex-v5` target, rather than our own custom target spec. This involves a new linkerscript that augments the one in rustc to faciliate the differential upload patcher. - Most of `vexide-core` has been gutted, including `fs`, most of `time`, `io`, `float`, `path`, and anything else that's now in `std`. - The `program` module in core has been repurposed to contain `CodeSignature`-related types (previously located in `vexide-startup`). - Added a `code_signature` function for reading the currently running program's code signature. - Added a `linked_file` function as a safe wrapper over `vexSystemLinkAddrGet()`. - `vexide-panic` is gone. Custom panic behavior is now done through a panic hook optionally registered by `vexide-startup` rather than our own `#[panic_handler]`. - `vexide-async` and `vexide-startup` are now dependent on `std`, with `vexide-devices` being optionally dependent (allowing for `std::io::{Read, Write}` implementations). The remaining subcrates remain `no_std`-compatible. - `vexide-async` was made `std`-dependent so that we can use libstd's `Instant` type for public APIs such as `sleep_until`. - `vexide-startup` was made `std`-dependent because it expects several things to be setup by the Rust runtime now, and also uses `std::io` for the patcher (which replaces `vexide_core::io`). It also has to call `println!` to do banner stuff. - An SDK provider can now be configured by choosing one of the following "backends" as feature flags (which vexide-startup will handle via the new `vex-sdk-*` family of crates): - `vex-sdk-download`: Downloads and links the official `libv5rt.a` using a build script. - `vex-sdk-jumptable`: What you're used to. - `vex-sdk-mock`: A stubbed version of the SDK that will be useful later for doing unit tests and running vexide on host targets. - `vex-sdk-pros`: Uses the partner SDK in libpros as a provider by bridging API incompatibilities between libv5rt and libv5rts. - `talc` is still used as our allocator by default, since it's lighter and theoretically faster in most cases than `dlmalloc`. The allocator APIs have been moved to `vexide-startup`. - `no_std_io` dependence is gone now that we have `std::io`. We now optionally support `embedded-io` implementations in `vexide-devices` through a feature flag if the user wants to use `vexide-devices` in a `#[no_std]` environment still. <img width="240" alt="merendas" src="https://github.com/user-attachments/assets/bb5630be-6ce5-49e9-a8df-1a1b7624b905" />
This PR adds standard library support for the VEX V5 Brain (
armv7a-vex-v5
target). It is more-or-less an updated version of the library-side work done in #131530.This was a joint effort between me, @lewisfm, @max-niederman, @Gavin-Niederman and several other members of the
vexide
project.Background
VEXos is a fairly unconventional operating system, with user code running in a restricted enviornment with regards to I/O capabilities and whatnot. As such, several OS-dependent APIs are unsupported or have partial support (such as
std::net
,std::process
, and most ofstd::thread
). A more comprehensive list of what does or doesn't work is outlined in the updated target documentation. Despite these limitations, we believe thatlibstd
support on this target still has value to users, especially given the popular use of this hardware for educational purposes. For some previous discussion on this matter, see this comment.SDK Linkage
VEXos doesn't really ship with an official
libc
or POSIX-style platform API (and though it does port newlib, these are stubbed on top of the underlying SDK). Instead, VEX provides their own SDK for calling platform APIs. Their official SDK is kept proprietary (with public headers), though open-source implementations exist. Following the precedent of thearmv6k-nintendo-3ds
team's work in #95897, we've opted not to directly linklibstd
to any SDK with the expectation that users will provide their own with one of the following options:vex-sdk-download
, which downloads an official proprietary SDK from VEX using a build script.vex-sdk-jumptable
, which is a compatible, open-source reimplementation of the SDK using firmware jumps.vex-sdk-pros
, which uses the PROS kernel as a provider for SDK functions.The
vex-sdk
crate used in the VEXos PAL provideslibc
-style FFI bindings for any compatible system library, so any of these options should work fine. A functional demo project usingvex-sdk-download
can be found here.Future Work
This PR implements virtually everything we are currently able to implement given the current capabilities of the platform. The exception to this is file directory enumeration, though the implementation of that is sufficiently gross enough to drive us away from supporting this officially.
Additionally, I have a working branch implementing the
panic_unwind
runtime for this target, which is something that would be nice to see in the future, though given the volume of compiler changes i've deemed it out-of-scope for this PR.