Skip to content
This repository has been archived by the owner on Jan 24, 2022. It is now read-only.

Commit

Permalink
.heap support
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
japaric committed Nov 22, 2017
1 parent 8840aa5 commit f060700
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion link.x
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ SECTIONS
_sstack = ORIGIN(RAM);
_estack = _stack_start;

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

PROVIDE(_heap_size = 0);

_sheap = _edata;
_eheap = _sheap + _heap_size;

/* fictitious region that represents the memory available for the heap */
.heap _sheap (INFO) : ALIGN(4)
{
. += _heap_size;
}

/* fake output .got section */
/* Dynamic relocations are unsupported. This section is only used to detect
relocatable code in the input files and raise an error if relocatable code
Expand Down

0 comments on commit f060700

Please sign in to comment.