Bare-metal: how to specify the heap size in the linker script

Nick Clifton nickc@redhat.com
Wed Aug 8 14:15:00 GMT 2018


Hi Claudio,

>>From the link provided by Nick (thanks!) it seems that when using dynamic
> allocation (e.g. malloc/new) newlib always checks if the heap is going to
> overwrite the current stack.
> However, it may happen that the stack then grows further and overwrites the
> heap. Did I understood correctly ?

Yes.  Although you may be able to turn on stack checking, depending upon what
compiler you are using.  If the stack check routines are written correctly
(you may have to do this...) then they can detect stack overflow before it
happens and so abort the program.

Cheers
  Nick



More information about the Newlib mailing list