Skip to content

Commit 4143c4d

Browse files
committed
.heap support
This adds a fictitious `.heap` linker section that denotes the span of a heap region. The size of this linker section is governed by the `_heap_size` symbol which defaults to 0 but can be overridden by the user.
1 parent c3b3264 commit 4143c4d

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

cortex-m-rt/link.x

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ SECTIONS
5252
_sstack = ORIGIN(RAM);
5353
_estack = _stack_start;
5454

55-
/* ficticious region that represents the memory available for the stack */
55+
/* fictitious region that represents the memory available for the stack */
5656
.stack _sstack (INFO) : ALIGN(4)
5757
{
5858
. += (_estack - _sstack);
@@ -75,6 +75,17 @@ SECTIONS
7575
_edata = .;
7676
} > RAM AT > FLASH
7777

78+
PROVIDE(_heap_size = 0);
79+
80+
_sheap = _edata;
81+
_eheap = _sheap + _heap_size;
82+
83+
/* fictitious region that represents the memory available for the heap */
84+
.heap _sheap (INFO) : ALIGN(4)
85+
{
86+
. += _heap_size;
87+
}
88+
7889
/* fake output .got section */
7990
/* Dynamic relocations are unsupported. This section is only used to detect
8091
relocatable code in the input files and raise an error if relocatable code

0 commit comments

Comments
 (0)