Skip to content

fix: avoid repeated SDRAM allocator setup - #1117

Open
Old-Ding wants to merge 1 commit into
arduino:mainfrom
Old-Ding:codex/sdram-begin-once
Open

fix: avoid repeated SDRAM allocator setup#1117
Old-Ding wants to merge 1 commit into
arduino:mainfrom
Old-Ding:codex/sdram-begin-once

Conversation

@Old-Ding

@Old-Ding Old-Ding commented Jul 5, 2026

Copy link
Copy Markdown

Summary

  • prevent SDRAM.begin() from adding another global allocator block after one was already registered
  • keep repeated calls with the same start address idempotent
  • return failure when a later call tries to change the SDRAM malloc start address

Validation

  • git diff --check
  • inspected the SDRAM.begin() flow and the ea_malloc freelist setup to keep the guard at the single malloc_addblock() call site
  • rg -n "malloc_addblock|malloc_start_address|int SDRAMClass::begin" libraries/Portenta_SDRAM/src libraries/ea_malloc -S

I did not run a full Arduino board build locally because the required board/toolchain setup is not provisioned here.

Fixes #1105

CI notes

  • Current license/cla check is pending.
  • This is an account/legal gate, not a code failure in the SDRAM allocator setup diff.

Track the SDRAM malloc block after it is registered so begin() does not add the same global allocator region again. Repeating the same start address is treated as an idempotent call, while changing it after allocator setup fails.

Fixes arduino#1105

Generated-by: OpenAI Codex
Signed-off-by: aineoae86-sys <ai.neo.ae86@gmail.com>
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@per1234 per1234 added the bug Something isn't working label Jul 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SDRAM.begin can be repeated, possibly corrupting static allocation

4 participants