Expand description
User program startup and runtime support.
This crate provides runtime infrastructure for booting vexide programs from Rust code. This infrastructure includes a more optimized heap allocator, differential uploading support, and a panic hook that draws panic messages to the screen and captures backtraces.
-
User code begins at an assembly routine called
_vexide_boot, which sets up the stack section before jumping to the_startroutine defined in libstd, which then calls themainfunction. -
From there, consumers must call the
startupfunction to finish the startup process by applying differential upload patches, claiming heap space, and setting up this crate’s custom panic hook.
This crate does NOT provide a libc crt0 implementation. No libc-style global constructors
are called. This means that the __libc_init_array function must be explicitly called if you
wish to link to C libraries.
§Example
This is an example of a minimal user program that boots without using the main vexide runtime or
the #[vexide::main] macro.
use vexide_core::program::{CodeSignature, ProgramOptions, ProgramOwner, ProgramType};
// SAFETY: This symbol is unique and is being used to start the runtime.
fn main() {
// Setup the heap, zero bss, apply patches, etc...
unsafe {
vexide_startup::startup();
}
// Rust code goes here!
}
// Program header (placed at the first 20 bytes on the binary).
#[unsafe(link_section = ".code_signature")]
#[used] // This is needed to prevent the linker from removing this object in release builds
static CODE_SIG: CodeSignature = CodeSignature::new(
ProgramType::User,
ProgramOwner::Partner,
ProgramOptions::empty(),
);Modules§
- banner
- vexide startup banner.
Functions§
- startup⚠
- vexide runtime initialization.