Commit caaabf6
espressif: freeze the env-collector's libraries on the 13 boards it targets
The ESP-NOW / WiFi / BLE environmental collector ships ~20 libraries in
lib/. On a board without PSRAM that is the difference between running and
not. Measured on a Feather ESP32-S3 No PSRAM (2026-09-13), with the
application itself already cross-compiled to .mpy:
* BLE + ESP-NOW + softAP all come up, and then `import datastore` dies
with `MemoryError: memory allocation failed, allocating 158 bytes`;
* with BLE off it gets as far as building the eInk dashboard and the SD
mount fails for want of 832 bytes, with 15.9 KB free.
Cross-compiling the application removes the on-device *compiler* peak,
which is what made the C6 unbootable, but not the resident bytecode.
Freezing does: a frozen module executes in place from flash and never
occupies heap at all.
So this adds FROZEN_MPY_DIRS for the libraries the project actually uses,
to the 13 espressif boards it targets -- the same 13 the custom-build
workflow has been dispatched for.
The list lives in ports/espressif/envhub_frozen.mk and each board gets one
`include` line rather than twenty `FROZEN_MPY_DIRS +=` lines. These are
upstream-shared board files: one line of divergence rebases far more
quietly than twenty, and there is one place to edit when the library set
moves.
Nine libraries were not yet in frozen/ and are added as submodules:
IL0373, JD79667, MAX1704x, NTP, SCD4X, SCD30, SEN6x, PCF8523, DS1307.
The other thirteen were already there.
Deliberately NOT frozen:
* adafruit_pixelbuf -- already a built-in C module.
* sensirion_i2c_driver / sensirion_i2c_sen5x -- from a third-party
circup bundle rather than a library repo, and node_sensors.py carries
a minimal built-in SEN5x driver for boards without them.
* PCF85063A -- no Adafruit library exists; the project drives that chip
directly from its own extrtc.py.
Size: ~162 KB of frozen bytecode from 621 KB of source, uniform across
all 13. That is comfortable on the 8 MB and 16 MB boards and is the open
question on the 4 MB ones (qtpy_esp32s3_4mbflash_2mbpsram,
feather_huzzah32, feather_esp32s3_tft, feather_esp32s3_reverse_tft,
feather_esp32s3_4mbflash_2mbpsram, feather_esp32c6_4mbflash_nopsram) --
CI is the arbiter, and if one overflows the fix is to split the list
rather than to shrink it everywhere.
NOTE for whoever deploys against these builds: `sys.path` puts `/lib`
ahead of `.frozen`, so a copy left in lib/ SHADOWS the frozen one and the
board pays the RAM anyway. Deleting lib/ is what collects the benefit --
the same trap as leaving a .py beside a .mpy.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>1 parent 201776a commit caaabf6
24 files changed
Lines changed: 137 additions & 0 deletions
File tree
- frozen
- ports/espressif
- boards
- adafruit_feather_esp32_v2
- adafruit_feather_esp32c6_4mbflash_nopsram
- adafruit_feather_esp32s3_4mbflash_2mbpsram
- adafruit_feather_esp32s3_nopsram
- adafruit_feather_esp32s3_reverse_tft
- adafruit_feather_esp32s3_tft
- adafruit_feather_huzzah32
- adafruit_metro_esp32s3
- adafruit_qtpy_esp32_pico
- adafruit_qtpy_esp32s3_4mbflash_2mbpsram
- adafruit_qtpy_esp32s3_nopsram
- espressif_esp32c6_devkitc_1_n8
- espressif_esp32s3_devkitc_1_n8
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
430 | 430 | | |
431 | 431 | | |
432 | 432 | | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
Submodule Adafruit_CircuitPython_DS1307 added at d9ccc8c
Submodule Adafruit_CircuitPython_IL0373 added at 645f0bf
Submodule Adafruit_CircuitPython_JD79667 added at 4a5ce53
Submodule Adafruit_CircuitPython_MAX1704x added at ad881ac
Submodule Adafruit_CircuitPython_NTP added at 20cb912
Submodule Adafruit_CircuitPython_PCF8523 added at 28187e9
Submodule Adafruit_CircuitPython_SCD30 added at a13f91c
Submodule Adafruit_CircuitPython_SCD4X added at 2c62569
Submodule Adafruit_CircuitPython_SEN6x added at b8dacfc
0 commit comments