Skip to content

zephyr: Add patch to fix zero newlib sbrk() heap on i.MX8M ADSP#90

Merged
quic-aditrath merged 1 commit into
AudioReach:masterfrom
quic-aditrath:zephyr_malloc_fix
Jun 2, 2026
Merged

zephyr: Add patch to fix zero newlib sbrk() heap on i.MX8M ADSP#90
quic-aditrath merged 1 commit into
AudioReach:masterfrom
quic-aditrath:zephyr_malloc_fix

Conversation

@quic-aditrath
Copy link
Copy Markdown
Contributor

Add west patch entry and patch file to fix the zero newlib sbrk() heap size on the i.MX8M ADSP when used with audioreach-engine.

_heap_sentry was assigned to '.' immediately after the NOLOAD .heap_mem section in sdram1. When .heap_mem has no input objects, _heap_mem_end == _end == _heap_sentry, collapsing MAX_HEAP_SIZE to 0. Every malloc() call then returns NULL, causing init failures across the audioreach-engine stack.

Fix by anchoring _heap_sentry to __stack (SDRAM1_BASE + SDRAM1_SIZE = 0x93400000), giving the newlib sbrk() arena the full remaining sdram1 space above _end.

Add west patch entry and patch file to fix the zero newlib sbrk()
heap size on the i.MX8M ADSP when used with audioreach-engine.

_heap_sentry was assigned to '.' immediately after the NOLOAD
.heap_mem section in sdram1. When .heap_mem has no input objects,
_heap_mem_end == _end == _heap_sentry, collapsing MAX_HEAP_SIZE
to 0. Every malloc() call then returns NULL, causing init failures
across the audioreach-engine stack.

Fix by anchoring _heap_sentry to __stack (SDRAM1_BASE + SDRAM1_SIZE
= 0x93400000), giving the newlib sbrk() arena the full remaining
sdram1 space above _end.

Signed-off-by: Aditya Rathi <aditrath@qti.qualcomm.com>
@quic-aditrath quic-aditrath requested review from a team June 1, 2026 05:43
@quic-aditrath quic-aditrath merged commit 8276504 into AudioReach:master Jun 2, 2026
18 checks passed
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.

3 participants