mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
43b31efb76
Allocate per-instance data for drivers from the heap rather than as static variables from the .data segment. This converts > 800 bytes of RAM from being always consumed as static data into being allocated from the heap only when a particular feature is enabled in the hwsettings object. A minimal config (no receivers, flexi port disabled, main port disabled) leaves 2448 bytes of free heap. That's our new baseline. Approximate RAM (heap) costs of enabling various features: + 632 Serial Telemetry (includes 400 bytes of Rx/Tx buffers) + 108 PWM Rcvr + 152 PPM Rcvr + 112 Spektrum Rcvr + 24 S.Bus (Should be closer to 68 since driver is still using static memory) There are still some drivers that pre-allocate all of their memory as static data. It'll take some work to convert those over to dynamically allocating their instance data.