From 905939d8f16f9d621c4f32570f2935323290018a Mon Sep 17 00:00:00 2001 From: bunnie Date: Fri, 20 Feb 2026 23:53:09 +0800 Subject: [PATCH] featurify all BIO modules the reason we do this is that if we don't switch off library modules, they are compiled in and just become dead code in the OS image. with enough modules, this will eventually become a significant drag on binary size. --- libs/bio-lib/Cargo.toml | 16 ++++++++++++++++ libs/bio-lib/src/c/mod.rs | 1 + libs/bio-lib/src/lib.rs | 4 ++++ 3 files changed, 21 insertions(+) diff --git a/libs/bio-lib/Cargo.toml b/libs/bio-lib/Cargo.toml index 01cec53b2..4753f5764 100644 --- a/libs/bio-lib/Cargo.toml +++ b/libs/bio-lib/Cargo.toml @@ -12,3 +12,19 @@ bao1x-hal = { path = "../../libs/bao1x-hal", features = ["std"] } bao1x-api = { path = "../../libs/bao1x-api" } bitbybit = "1.4.0" arbitrary-int = "1.2" + +[features] +# C generated +c-math-test = [] + +# hand coded +mac-demo = [] +ws2812 = [] +captouch = [] +av-trng = [] + +# This shouldn't be a default - but provided so that code automation +# targets can easily crawl the whole library with a single flag. +all = ["c-math-test", "mac-demo", "ws2812", "captouch", "av-trng"] + +default = [] diff --git a/libs/bio-lib/src/c/mod.rs b/libs/bio-lib/src/c/mod.rs index c0c236bc6..098d72956 100644 --- a/libs/bio-lib/src/c/mod.rs +++ b/libs/bio-lib/src/c/mod.rs @@ -1 +1,2 @@ +#[cfg(feature = "c-math-test")] pub mod math_test; diff --git a/libs/bio-lib/src/lib.rs b/libs/bio-lib/src/lib.rs index 0566b7f7e..645d30800 100644 --- a/libs/bio-lib/src/lib.rs +++ b/libs/bio-lib/src/lib.rs @@ -33,8 +33,12 @@ //! Core ID & debug: //! - x31 r/- [31:30] -> core ID; [29:0] -> cpu clocks since reset +#[cfg(feature = "av-trng")] pub mod av_trng; pub mod c; +#[cfg(feature = "captouch")] pub mod captouch; +#[cfg(feature = "mac-demo")] pub mod mac_demo; +#[cfg(feature = "ws2812")] pub mod ws2812;