Set stack size for main

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Set stack size for main

Michael Bergandi
Hi all,

I have a test app that seems to crash in random locations. After
probing with gdb for a bit, it appears that an interupt occurs at some
point and then the app crashes with:

ASSERT FAIL: <3240>sched.cxx[160]static void
Cyg_Scheduler::unlock_inner() Bad current thread

I am thinking that this is probably a corrupt stack problem, but I am
not sure how to know for sure. Assuming it is a stack problem and it
is just too small, can someone explain how I can set/check the stack
size of main()?

Thanks,

--
Mike
Reply | Threaded
Open this post in threaded view
|

Re: Set stack size for main

Gary Thomas
On 03/10/2011 12:47 PM, Michael Bergandi wrote:

> Hi all,
>
> I have a test app that seems to crash in random locations. After
> probing with gdb for a bit, it appears that an interupt occurs at some
> point and then the app crashes with:
>
> ASSERT FAIL:<3240>sched.cxx[160]static void
> Cyg_Scheduler::unlock_inner() Bad current thread
>
> I am thinking that this is probably a corrupt stack problem, but I am
> not sure how to know for sure. Assuming it is a stack problem and it
> is just too small, can someone explain how I can set/check the stack
> size of main()?

Set this variable:
   cdl_option CYGNUM_LIBC_MAIN_DEFAULT_STACK_SIZE {
       user_value 65536
   };

--
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------
Reply | Threaded
Open this post in threaded view
|

Re: Set stack size for main

Michael Bergandi
> Set this variable:
>  cdl_option CYGNUM_LIBC_MAIN_DEFAULT_STACK_SIZE {
>      user_value 65536
>  };

Thank you. The app now runs fine. I guess that is confirmation that it
was a stack problem :)

--
Mike