Skip to content

Commit caaabf6

Browse files
tyethclaude
andcommitted
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

.gitmodules

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,3 +430,30 @@
430430
[submodule "frozen/Adafruit_CircuitPython_TAS2505"]
431431
path = frozen/Adafruit_CircuitPython_TAS2505
432432
url = https://github.com/adafruit/Adafruit_CircuitPython_TAS2505.git
433+
[submodule "frozen/Adafruit_CircuitPython_IL0373"]
434+
path = frozen/Adafruit_CircuitPython_IL0373
435+
url = https://github.com/adafruit/Adafruit_CircuitPython_IL0373.git
436+
[submodule "frozen/Adafruit_CircuitPython_JD79667"]
437+
path = frozen/Adafruit_CircuitPython_JD79667
438+
url = https://github.com/adafruit/Adafruit_CircuitPython_JD79667.git
439+
[submodule "frozen/Adafruit_CircuitPython_MAX1704x"]
440+
path = frozen/Adafruit_CircuitPython_MAX1704x
441+
url = https://github.com/adafruit/Adafruit_CircuitPython_MAX1704x.git
442+
[submodule "frozen/Adafruit_CircuitPython_NTP"]
443+
path = frozen/Adafruit_CircuitPython_NTP
444+
url = https://github.com/adafruit/Adafruit_CircuitPython_NTP.git
445+
[submodule "frozen/Adafruit_CircuitPython_SCD4X"]
446+
path = frozen/Adafruit_CircuitPython_SCD4X
447+
url = https://github.com/adafruit/Adafruit_CircuitPython_SCD4X.git
448+
[submodule "frozen/Adafruit_CircuitPython_SCD30"]
449+
path = frozen/Adafruit_CircuitPython_SCD30
450+
url = https://github.com/adafruit/Adafruit_CircuitPython_SCD30.git
451+
[submodule "frozen/Adafruit_CircuitPython_SEN6x"]
452+
path = frozen/Adafruit_CircuitPython_SEN6x
453+
url = https://github.com/adafruit/Adafruit_CircuitPython_SEN6x.git
454+
[submodule "frozen/Adafruit_CircuitPython_PCF8523"]
455+
path = frozen/Adafruit_CircuitPython_PCF8523
456+
url = https://github.com/adafruit/Adafruit_CircuitPython_PCF8523.git
457+
[submodule "frozen/Adafruit_CircuitPython_DS1307"]
458+
path = frozen/Adafruit_CircuitPython_DS1307
459+
url = https://github.com/adafruit/Adafruit_CircuitPython_DS1307.git

frozen/Adafruit_CircuitPython_NTP

0 commit comments

Comments
 (0)