Skip to content

Conversation

@tropicaaal
Copy link
Member

@tropicaaal tropicaaal commented Aug 18, 2025

This is a large scale, unorganized mess of a refactor i've been sitting on for most of the summer. It cleans up some APIs and reorganizes the packet modules to better match how they're categorized in the protocol. It also renames most packets to match internal naming conventions. There's still work to be done here, but this should hopefully make things a little easier to maintain.

@tropicaaal
Copy link
Member Author

This is at a place where I feel comfortable enough to merge. I've verified that all commands, including uploading programs work correctly. This branch is already in use in cargo-v5's vexide 0.8.0 upstreamed-target support branch and hasn't given me trouble.

@tropicaaal tropicaaal merged commit 45f2a1e into main Sep 20, 2025
tropicaaal added a commit to vexide/vexide that referenced this pull request Oct 9, 2025
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"
/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants