AUDIO
Source snapshot · 12 October 2026

Embedded projects

STM32 and the C bridge

Choose the target for the exact Cortex core/FPU. These commands check libraries; they do not link/flash a firmware image:

rustup target add thumbv6m-none-eabi thumbv7em-none-eabihf
cargo check -p ravet-embedded -p ravet-embedded-gain --no-default-features \
  --target thumbv6m-none-eabi --locked
cargo check -p ravet-embedded -p ravet-embedded-gain --no-default-features \
  --target thumbv7em-none-eabihf --locked

Rust's Armv7E-M target documentation explains Cortex-M4/M7 and hard/soft-float target distinctions. Do not select the hard-float ABI for a core without the required FPU, or mix float ABIs across C and Rust objects. No STM32 model or HAL is selected by these library checks.

The public reference C header exposes caller-owned state, init, block-start gain and interleaved stereo f32 processing. Gain is immediate, ID zero, amplitude 0..4, unity by default; this reference does not implement the desktop gain's smoothing/bypass/meters. The Rust processor accepts up to eight timed input events; the C ABI accepts block-start gain only. C audio lengths are bounded to 128 samples, blocks to 1..64 prepared frames; zero-frame calls are legal. Input/output aliasing works, state must not overlap audio. The C reference uses fixed callback stack scratch; budget it separately from its caller-owned state. Pointer/alignment/lifetime/exclusive access remain caller obligations. No handles, allocator, callback panic recovery or arbitrary-processor export is introduced.

Build the standalone reference archive:

cargo rustc -p ravet-embedded-gain --no-default-features --features firmware-panic \
  --target thumbv7em-none-eabihf --release --locked --lib --crate-type staticlib \
  -- -C panic=abort

Link target/thumbv7em-none-eabihf/release/libravet_embedded_gain.a from the consumer's firmware build. The explicitly selected reference panic handler spins on panic; choose the product's reset/fault policy before deployment. Rust firmware using the rlib should leave firmware-panic disabled and provide its own handler. The consumer supplies linker/memory map, startup and compiler runtime symbols. Archive construction alone is not final firmware link evidence.