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

Nick Clifton <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
Hi Claudio,

> However, this way there is no way of checking if the heap has reached the maximum value (after which we get stack corruption).

It sounds like you need to check the current heap top against the 
current stack pointer.  Take a look in newlib/libgloss/aarch64/syscalls.c
at the implementation of the _sbrk() system call.  This uses a magic
asm("sp") statement to get hold of the stack pointer...

Cheers
  Nick
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.