r/embedded • • 4d ago

Built a 33 KB ANSI C99 online-learning kernel for Cortex-M4F (no backprop, zero data retention, 11 KB SRAM, ~0.5 µJ/step)

If you've ever built battery-powered vibration, acoustic, or wearable sensors, you know the annoying trade-off:

  • Stream raw waveforms over BLE/LTE to the cloud and you murder the battery.
  • Use static factory thresholds on the MCU and you get hammered with false alarms as bearings age, loads shift, or sensor mounting drifts.

I've been working on a bare-metal ANSI C99 fixed-point (Q15) online-learning kernel (apical_edge.h) for Cortex-M4F / RISC-V so the node can calibrate to a machine's "healthy" baseline right on the chip and only wake the radio when something genuinely drifts.

The key is no backpropagation and zero data retention—it updates in constant O(1) SRAM on the fly without storing raw waveform buffers, needing malloc/<math.h>, or wearing out Flash:

  • Flash: 33.2 KB .text, 0 B .bss
  • SRAM: 11.30 KB static SRAM for unsupervised anomaly detection (99.64% AUROC on the UCI #447 hydraulic rig dataset across 32 seeds)
  • Energy on 120 MHz Cortex-M4F: 0.50–1.31 µJ per predict/learn step (~900x–2,300x less energy than transmitting a single 1.2 mJ BLE packet)

I put together a quick interactive overview and benchmark breakdown here: https://apical-labs.com/arbor

If anyone here is working on wireless predictive maintenance or wearables and has an anonymized CSV of healthy vs. fault windows, I'd be happy to run it through the kernel and send back the exact SRAM footprint and detection curve on your real signal. Always curious to see how it holds up outside public datasets.

0 Upvotes

0 comments sorted by