Skip to content

Implement GlobalAlloc via SiLabs SDK and ESP-IDF - #74

Merged
puddly merged 6 commits into
devfrom
puddly/esp32-globalalloc
Oct 30, 2026
Merged

puddly merged 6 commits into
devfrom
puddly/esp32-globalalloc

Conversation

@puddly

@puddly puddly commented Oct 30, 2026

Copy link
Copy Markdown
Member

Currently, embedded-alloc is used as a fixed 128KB arena for embedded Ziggurat. This works fine. An alternative is to integrate with the chip vendor SDK's memory management system: heap_caps_aligned_alloc for ESP-IDF and sl_memory_alloc_advanced for Simplicity SDK. These allow Ziggurat to better coexist with other applications and also fully utilize available RAM.

CC @DH4CK, as you mentioned running Ziggurat on a C6.

Copilot AI balanced review requested due to automatic review settings October 30, 2026 04:32

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The unsafe global allocator replacements lack SDK-matched build and on-device validation of ABI compatibility, alignment, realloc failure, and shared-heap behavior on both MCUs, particularly against pinned Simplicity SDK 2026.6.2.

No open issues 🎉

What changed in this PR

Replaces the embedded Rust stack’s fixed 128 KiB heap with vendor SDK allocators, allowing Ziggurat to share available RAM with other firmware components.

Changes:

  • Adds SiLabs and ESP-IDF GlobalAlloc implementations with alignment-aware reallocation and mutually exclusive platform features.
  • Updates firmware build configuration, bumps the SiLabs SDK, and increases both platforms’ NCP transmit buffers to 4 KiB.
  • Refreshes embedded firmware documentation and removes the embedded-alloc dependency.
File Description
README.md Documents embedded RCP support and platform build locations.
firmwares/​esp32-c6/​CMakeLists.txt Increases the NCP transmit buffer to 4 KiB.
firmwares/​esp32-c6/​build.sh Enables the esp-idf Rust feature.
firmwares/​efr32mg24/​brd2601b_ziggurat_rcp.yaml Updates the SDK to 2026.6.2 and increases the NCP transmit buffer.
crates/​ziggurat-ot/​src/​lib.rs Implements SDK-backed allocators and platform feature checks.
crates/​ziggurat-ot/​Cargo.toml Defines platform features and removes embedded-alloc.
crates/​ziggurat-ot/​Cargo.lock Removes unused allocator dependencies.

Review effort: Balanced

@puddly

puddly commented Oct 30, 2026

Copy link
Copy Markdown
Member Author

I tested this change on my home network with ~100 devices just fine. Performing an OTA update of a bulb while toggling 20-30 lights caused no issues.

@puddly
puddly merged commit d563c2f into dev Oct 30, 2026
2 checks passed
@puddly

puddly commented Oct 30, 2026

Copy link
Copy Markdown
Member Author

For reference, here's what the current memory usage looks like with fairly aggressive usage patterns:

Stat Value
Heap total 450 KB
Used, min / avg / max 50.7 / 53.9 / 58.4 KB
Lifetime peak used 62.3 KB
Lifetime min free 388 KB
Largest free block 360 KB, constant
Used blocks, min / max 149 / 175

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants