sparc stack and heap

Yacine EL KOLLI yacine.elkolli at crf.canon.fr
Mon Aug 21 12:54:19 UTC 2006


Hello,

AFAIK, CONFIGURE_INIT_STACK_SIZE does only change the stack size of the 
init task.
For pthread this is defined by default in:
cpukit/posix /include/rtems/posix/pthread.h at line 26:
#define PTHREAD_MINIMUM_STACK_SIZE (STACK_MINIMUM_SIZE * 2)

May be the proper way to modify the pthread default stack size is to 
specify the stack size when creating the thread or to modify the global 
variable _POSIX_Threads_Default_attributes ?

Also you can enable the stack checker (#define STACK_CHECKER_ON in your 
appllication header)

Hope this help
Yacine.

Marek Prochazka wrote:
> 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
>>>
>>>
> 
> 


-- 
=====================================================
EL KOLLI Yacine         | yacine.elkolli at crf.canon.fr
Canon C.R.F.            | Phone: +33.(0)2.99.87.68.79
http://www.crf.canon.fr | FAX: +33.(0)2.99.84.11.30
====================================================




More information about the users mailing list