[En-Nut-Discussion] Large auto variable called from main thread crashed programm

Philipp Burch phip at hb9etc.ch
Fri Jan 9 14:40:54 CET 2015


Hi Uwe!

On 09.01.2015 14:33, Uwe Bonnes wrote:
>>>>>> "Philipp" == Philipp Burch <phip at hb9etc.ch> writes:
> 
> 
>     ...
> 
> Reading enmem21e.pdf and arch/cm3/os/nutinit.c
> 
> #ifndef NUT_THREAD_MAINSTACK
> #define NUT_THREAD_MAINSTACK    1024
> #endif
> 
> make things clear: Main stack is only for idle thread, main program stack as
> thread stack is allocated in pre-defined size from heap.

'main' and 'idle' are two different threads with different stacks. You
can specify sizes for both with the configurator:

RTOS Kernel -> Multithreading -> Idle/Main Thread Stack Size

> 
> To cite enmen21e:
> 
>> To avoid wasting stack space, the application should...
>>        ...
>>        ...not declare large non-static arrays or structures within functions.
> 

Keeping large structures in static memory is probably always a good
idea, no matter if or which OS is in use ;)

Could you fix the problem?

Regards,
Philipp


More information about the En-Nut-Discussion mailing list