Skip to content

Teensy 4: ObjectFLED fixed 38.4 KB DMAMEM bitdata buffer is paid by every addLeds sketch #4711

Closed

Description

@zackees

Part of #4709.

ObjectFLEDDmaManager::bitdata[BYTES_PER_DMA * 64] (src/third_party/object_fled/src/ObjectFLEDDmaManager.h:63) is a fixed 38,400 B static in DMAMEM, declared __attribute__((used)). ObjectFLED is now the Teensy 4 default Bus::FLEX_IO driver, so every plain addLeds<WS2812, PIN> sketch pays for it, whatever its LED count.

teensy41 DemoReel100 RAM: 27,264 B (3.10.3, bit-bang default) → 70,016 B (HEAD).

Options: size the buffer to the registered LED count, allocate it lazily on first show, or drop used so an unused driver can be garbage-collected.

Activity

  1. zackees commented on Oct 6, 2026

    @zackees
    MemberAuthor

    Investigated in #4710. bitdata is a circular double buffer: dma2's TCD always walks two full BYTES_PER_DMA halves (fixed CITER/BITER, DLASTSGA back to the start), and BYTES_PER_DMA >= 90 is the ISR refill-margin floor from #3416. Sizing it to the LED count would change the DMA addressing, which needs hardware validation, so it was left at 38.4 KB.

    #4710 does recover RAM around it on the same addLeds path: newlib printf and the fl::printf engine are no longer linked (ITCM 59,664 → 35,680 B), and unused drivers' DMAMEM buffers are no longer kept (#4713). The remaining options for this buffer (lazy heap allocation in OCRAM2, or a smaller chunk with hardware validation via bash autoresearch teensy41) stay open here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions