feat(core): no_std support for the core module (Phase 1)#86
Open
kalwalt wants to merge 5 commits into
Open
Conversation
- add #![cfg_attr(not(feature = "std"), no_std)] and extern crate alloc - std-gate the not-yet-converted modules (calib3d, features, features2d, imgproc, video) and their prelude re-exports - switch std:: paths to core::/alloc:: throughout src/core - PureCvError now implements core::error::Error (MSRV 1.88) - float methods resolve through num_traits::Float (libm) in no_std builds - std-gate get_tick_count/get_tick_frequency (no bare-metal clock) and the thread-local RNG API; replace a debug eprintln! with log::warn! Verified on thumbv7em-none-eabihf and ESP32-S3 (Xtensa). Refs #83 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
crates/no-std-smoke consumes the purecv public API from a #![no_std] crate; building it for a bare-metal target proves downstream no_std usability. Excluded from the workspace as its own root. Refs #83 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Builds and lints with --no-default-features on the host, then builds purecv and the smoke-test consumer for thumbv7em-none-eabihf. Refs #83 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
default-features = false previously only dropped rayon; now that std gates the non-core modules, the wasm wrapper must opt back into it. Refs #83 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Makes the
coremodule compile without the Rust standard library, using onlycore+alloc, so purecv can run on microcontrollers such as the ESP32 (#82).stdis now an explicit opt-in feature (still on by default — no change for existing users). With--no-default-features:lib.rssets#![cfg_attr(not(feature = "std"), no_std)]withextern crate allocstd::paths insrc/coremoved tocore::/alloc::;PureCvErrorimplementscore::error::Error(MSRV set to 1.88, which the codebase already required viais_multiple_of)sqrt,sin, …, 243 call sites) resolves throughnum_traits::Floatbacked bylibm, since those methods don't exist onf32/f64without stdget_tick_count/get_tick_frequency(no bare-metal clock) and the thread-local RNG (set_rng_seed,randu,randn,rand_shuffle)imgproc,features2d,video,calib3d,features) and theparallel/simd/fft/ndarrayfeatures requirestduntil their own phases landA new build-only crate
crates/no-std-smokeconsumes the public API from a#![no_std]crate, and a new CI job builds both purecv and the smoke crate forthumbv7em-none-eabihfand lints the no-default-features configuration.Verified: full test suite passes with default features (358 unit + 35 doc tests), clippy/fmt clean on both configurations, and matrix arithmetic ran end-to-end on real ESP32-S3 hardware (Xtensa,
esptoolchain) with output logged over serial.Alternative considered: splitting a
purecv-coresub-crate for isolation — rejected for Phase 1 as the mechanical move would dominate the diff; the single-cratecfg_attrapproach keeps the change reviewable.Closes #83
Refs #82
🤖 Generated with Claude Code