Skip to content

perf(esp32): move WiFi statics from SRAM2 to DRAM1 (~14 KB) - #56

Merged
deadprogram merged 3 commits into
mainfrom
esp32-better-dram1-usage
Jul 25, 2026
Merged

perf(esp32): move WiFi statics from SRAM2 to DRAM1 (~14 KB)#56
deadprogram merged 3 commits into
mainfrom
esp32-better-dram1-usage

Conversation

@deadprogram

@deadprogram deadprogram commented Jul 25, 2026

Copy link
Copy Markdown
Member

Place the RX ring buffer in a .rxring section and ISR/timer arrays in a .wifibss section, both mapped to SRAM1 (DRAM1) by the ESP32 linker script, and then guard the DMA relocation tables.

On ESP32 this frees ~14 KB of SRAM2 for the Go GC heap:

  • RX ring (6 × 1602 B): ~9.6 KB
  • DMA tables compiled out: ~1.9 KB
  • ISR + timer arrays: ~2.8 KB

Requires that tinygo-org/tinygo#5555 be merged, due to needing the additional linker symbols.

With this PR there is enough memory for ESP32 to use net/http like the other currently supported processors. Here is the webserver example running on ESP32:

image

Base automatically changed from refactoring-cleanup to main July 25, 2026 12:54
Place the RX ring buffer in a .rxring section and ISR/timer
arrays in a .wifibss section, both mapped to SRAM1 (DRAM1) by
the ESP32 linker script, and then guard the DMA relocation tables.

On ESP32 this frees ~14 KB of SRAM2 for the Go GC heap:
  - RX ring (6 × 1602 B):  ~9.6 KB
  - DMA tables compiled out: ~1.9 KB
  - ISR + timer arrays:     ~2.8 KB

Signed-off-by: deadprogram <[email protected]>
@deadprogram
deadprogram force-pushed the esp32-better-dram1-usage branch from a8f9fb6 to 49356b4 Compare July 25, 2026 13:18

@soypat soypat left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If it works!

Wire xnet.StackConfig.AcceptIPv4Broadcast through espradio.StackConfig
so AP-mode stacks accept IPv4 broadcast destinations. Required for DHCP
server to receive client Discovers/Requests sent to 255.255.255.255.

Enable it in netlink/ap.go and examples/ap.

Signed-off-by: deadprogram <[email protected]>
@deadprogram

Copy link
Copy Markdown
Member Author

Thank you for review @soypat now merging!

@deadprogram
deadprogram merged commit a10beee into main Jul 25, 2026
1 check passed
@deadprogram
deadprogram deleted the esp32-better-dram1-usage branch July 25, 2026 16:18
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