Blown stack ?

Joel Sherrill joel at OARcorp.com
Wed Apr 10 15:47:00 UTC 2002



Puro Markku wrote:
> 
> Unfortunately no,
> problems appears with rtems-ss-20010816 and in early state of BSP
> modifications.
> I've change to use RTEMS-4.5.1-pre3 on that Intel evaluation board
> but I still use "CPU_STACK_MINIMUM_SIZE (4*1024)" definition.
> I accept that, although it sounds quite large.
> ( Perhaps I try to reduce 'stack minimum size' back to 1024 )
> 
> Joel: Is that 4096 for 'stack minimum size' too much for i386 ?

It depends on what you are doing.  It could in fact be too large for
non-networked applications.

A proposal has floated around a long time to let user's configure
the minimum stack size for their system.  If not specified, the
preferred default would be used.

> Iam running RTEMS-4.5.1-pre3 on Intel ev386ex card with interrupt driven
> console
> device at 38400 baud. CPU_STACK_MINIMUM_SIZE defined 4*1024.
> I use ev_386ex BSP which based on i386ex BSP(biggest modifications in
> start.S/start_ram.S, bsp_specs and linkcmds/linkcmds.ram).
> So far it has been working without any major problems.

Using cout versus regular C IO brings in a lot of code. It also
introduces
new potentials for things to go wrong.  I recall a problem where the
2.95.x libstdc++ (v2) had a weird bug where you needed to print from
the first thread in the system to ensure things were initialized
properly.
It was a bad side-effect of the libstdc++-v2 caching a thread specific
piece of data (file descriptor?) at init time and later using it in 
another thread. Since the 1st thread never printed, it wasn't completely 
initialized.  

Try printing from the 1st thread if using cout is the culprit.

>    -Mp
> 
> > -----Original Message-----
> > From: Angelo Fraietta [mailto:angelo_f at bigpond.com]
> > Sent: 10. huhtikuuta 2002 8:40
> > To: Puro Markku
> > Cc: 'rtems-users at oarcorp.com'
> > Subject: Re: Blown stack ?
> >
> >
> > Did this ever get sorted out? I am having a similar problem and I
> > believe that it is also a stack problem.
> >
> > The reason I come to this conclusion is that when I add a
> > cout function,
> > even when the function cannot be called (this is because I have a
> > volatile value set at false at this time), I get  similar sorts of
> > exceptions. Just the existence of the added code within the function
> > causes the failure.
> >
> > Puro Markku wrote:
> >
> > >Hi,
> > >
> > >On ev386ex BSP(~i386ex) I ran into problems that looks like
> > >stack overrun.  Anyhow I 'manage to fix' those by modifying
> > >stack minimum size (original value was 1024) in
> > >.../rtems-ss-20010816/c/src/exec/score/cpu/i386/rtems/score/cpu.h
> > >( thats not the best place to do it but... ;)
> > >--8<--------------------------------------------------------------
> > >/*
> > > *  Minimum size of a thread's stack.
> > > */
> > >#define CPU_STACK_MINIMUM_SIZE           (4*1024)
> > >--8<--------------------------------------------------------------
> > >
> > >Where can I define new value for (CPU_)STACK_MINIMUM_SIZE ?
> > >Has anyone findout similar problems in startup ?
> > >(pc386 works with default values. maybe its not a stack
> > problem at all ? )
> > >
> > >
> > >  -Mp
> > >
> > >examples-4.5.0:
> > >termios with default stack=1024
> > >--8<--------------------------------------------------------------
> > >Initialized console on port COM2 9600-8-N-1
> > >
> > >*** TEST OF TERMIOS INPUT CAPABILITIES ***
> > >
> > >You----------------------------------------------------------
> > >Exception 13 caught at PC 33E4 by thread 134283265
> > >----------------------------------------------------------
> > >Processor execution context at time of the fault was  :
> > >----------------------------------------------------------
> > > EAX = 1F       EBX = 1F        ECX = FD930     EDX = 3212
> > > ESI = FB4B8    EDI = 361C      EBP = FCCC8     ESP = FCC8C
> > >----------------------------------------------------------
> > >Error code pushed by processor itself (if not 0) = C1C0
> > >----------------------------------------------------------
> > > ************ FAULTY THREAD WILL BE DELETED **************
> > >--8<--------------------------------------------------------------
> > >
> > >after defining STACK_CHECKER_ON in
> > >.../rtems-ss-20010816/c/src/lib/libbsp/i386/ev386ex/include/bsp.h
> > >and CPU_STACK_MINIMUM_SIZE (2*1024) termios runs OK
> > >but monitor generate BLOWN STACK.
> > >--8<--------------------------------------------------------------
> > >Initialized console on port COM2 9600-8-N-1
> > >
> > >*** MONITOR TASK TEST ***
> > >
> > >Monitor ready, press enter to login.
> > >
> > >BLOWN STACK!!! Offending task(0xfdb0c): id=0x08010007;
> > name=0x524d4f4e
> > >  stack covers range 0x000f0d7c - 0x000f157b (2048 bytes)
> > >--8<--------------------------------------------------------------
> > >
> > >after defining CPU_STACK_MINIMUM_SIZE (4*1024) 'monitor' runs OK
> > >
> > >
> > >-------------------------------------------------------------
> > -----------
> > >Markku Puro           markku.puro at insta.fi
> > Sarankulmankatu 20
> > >                      tel.   +358 3  2659 769       FIN-33900 Tampere
> > >INSTRUMENTOINTI OY    mobile +358 40 7092 769
> > http://www.insta.fi
> > >C3i Systems           fax    +358 3  2659 501
> > >
> >
> > --
> > Angelo Fraietta
> >
> > PO Box 859
> > Hamilton NSW 2303
> >
> > Home Page
> >
> >
> > http://www.users.bigpond.com/angelo_f/
> >
> > There are those who seek knowledge for the sake of knowledge
> > - that is CURIOSITY
> > There are those who seek knowledge to be known by others -
> > that is VANITY
> > There are those who seek knowledge in order to serve - that is LOVE
> >     Bernard of Clairvaux (1090 - 1153)
> >
> >
> >
> >

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel at OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985



More information about the users mailing list