This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Forwarding to list too. Sorry for the dup.

> -----Original Message-----
> From: Tamar Christina
> Sent: Wednesday, August 8, 2018 12:09
> To: 'Nick Clifton' <nickc@redhat.com>; Claudio Scordino
> <claudio@evidence.eu.com>; newlib@sourceware.org
> Subject: RE: Bare-metal: how to specify the heap size in the linker script
> 
> Hi Claudio,
> 
> > -----Original Message-----
> > From: newlib-owner@sourceware.org <newlib-owner@sourceware.org>
> On
> > Behalf Of Nick Clifton
> > Sent: Wednesday, August 8, 2018 11:58
> > To: Claudio Scordino <claudio@evidence.eu.com>;
> newlib@sourceware.org
> > Subject: Re: Bare-metal: how to specify the heap size in the linker
> > script
> >
> > 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...
> 
> You didn't say if you're using semihosting or not
> 
> If you're using semihosting you can specify the limits in the SYS_HEAPINFO
> return values
> https://developer.arm.com/docs/100863/latest/semihosting-
> operations/sys_heapinfo-0x16
> 
> if you're not, then what Nick suggests is the way to go in your _sbrk
> implementation.
> 
> Regards,
> Tamar
> 
> >
> > Cheers
> >   Nick
> >


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]