diff --git a/lmdk/cmake/ldscripts/bss_linker_script.txt b/lmdk/cmake/ldscripts/bss_linker_script.txt index c214d4662978..4d76356f8630 100644 --- a/lmdk/cmake/ldscripts/bss_linker_script.txt +++ b/lmdk/cmake/ldscripts/bss_linker_script.txt @@ -16,5 +16,18 @@ SECTIONS { _next_end = ABSOLUTE(.); *(.bss) *(.bss.*) + + /* Heap memory */ + . = ALIGN(4); + __stack = .; + _end = .; + KEEP(*(.heap_mem)) + + /* Use the unused rest of the memory page as a heap */ + . = ALIGN(4096); + + /* The sbrk function implementation by xtensa incorrectly checks whether the allocated + memory block fits in the heap, so we have to add 1 to the end of the heap marker. */ + _heap_sentry = . + 1; } >HPSRAM_seg : bss_phdr } diff --git a/lmdk/cmake/ldscripts/data_linker_script.txt b/lmdk/cmake/ldscripts/data_linker_script.txt index 08b75bbf5b53..c9b4e768844b 100644 --- a/lmdk/cmake/ldscripts/data_linker_script.txt +++ b/lmdk/cmake/ldscripts/data_linker_script.txt @@ -11,6 +11,7 @@ SECTIONS { _data_start = ABSOLUTE(.); *(.data) *(.data.*) + *(.*.data) _data_end = ABSOLUTE(.); } >HPSRAM_seg : data_phdr