sparc stack and heap

Marek Prochazka Marek.Prochazka at scisys.co.uk
Mon Aug 21 12:33:52 UTC 2006


Hello,

in my application on Leon2, I configure RTEMS to have 
CONFIGURE_INIT_STACK_SIZE 			(20 * RTEMS_MINIMUM_STACK_SIZE)

This gives 81920 bytes for a single task stack. However, if I print addresses of two variables allocated on stack in two different POSIX threads (I assume each POSIX thread uses a single RTEMS task), I get 0x4ffa5e84 and 0x4ffa38c4. This gives only 0x25c0 (9664) bytes difference, which does not seem right. Am I missing something?

We are apparently having problems with not properly controlling stack size hence in case of more allocation on the stack we perhaps experience an overflow (random crashes, the fewer automatic variables, the later a crash occurs). Any hints please? Any diagnostic tools available?

Thanks,
Marek Prochazka

> -----Original Message-----
> From: Joel Sherrill [mailto:joel.sherrill at oarcorp.com] 
> Sent: 25 July 2006 15:11
> To: Aleix Conchillo Flaqué
> Cc: Chris Johns; rtems-users at rtems.com
> Subject: Re: sparc stack and heap
> 
> Aleix Conchillo Flaqué wrote:
> 
> > Thanks for the answer Chris.
> >
> > I'll need to modify some things from the ERC32 bsp, because 
> I need to  
> > keep some data into RAM between reboots, so I'll have to play with  
> > heap and workspace addresses.
> 
> 
> The simplest think to do would be to edit the linkcmds and reserve an 
> area after the BSS.  If you
> move the "end" symbols to after your reserved block, then it 
> will just 
> be ignored by the BSP
> when it is carving memory.
> 
> You could do this in an application specific linkcmds and add 
> -qnolinkcmds -T myLinkcmds
> to the gcc command that links your application.  It would avoid 
> otherwise changing the
> BSP as installed by RTEMS.
> 
> --joel
> 
> > Regards,
> >
> > aleix
> >
> > On 25 Jul 2006, at 15:23, Chris Johns wrote:
> >
> >> Aleix Conchillo Flaqué wrote:
> >>
> >>> I'll answer my self, task stacks are allocated in the heap. Right?
> >>
> >>
> >> No the workspace.
> >>
> >> You need to decided now to the split the memory between the  
> >> workspace and the heap. The typical way is to place the 
> workspace  at 
> >> the top and the heap between the end of .bss and the start of  the 
> >> workspace.
> >>
> >> Regards
> >> Chris
> >
> >
> 
> 




More information about the users mailing list