[ECOS] CYGNUM_KERNEL_THREADS_IDLE_STACK_SIZE on ARM architectures (and others)

Andrew Lunn andrew@lunn.ch
Tue Feb 10 16:51:00 GMT 2004


On Tue, Feb 10, 2004 at 05:06:50PM +0100, heinricg@esiee.fr wrote:
> Hi all,
> I've just been slightly confused with the way
> CYGNUM_KERNEL_THREADS_IDLE_STACK_SIZE works. As I was hunting for
> spare bytes of RAM on my platform, I noticed that the idle thread
> stack was larger than what I set it to in the configuration tool.
> After reading the source code in thread.cxx, I realised that there is
> a minimum value for the idle thread stack size - and the build system
> does not warn even though the stack is made larger than expected.
> 
> The minimum value is computed as follows:
> 
> #define CYGNUM_HAL_STACK_SIZE_MINIMUM \
>         (CYGNUM_HAL_MAX_INTERRUPT_NESTING *
> CYGNUM_HAL_STACK_INTERRUPT_SIZE + \
>          2 * CYGNUM_HAL_STACK_FRAME_SIZE)
> 
> with:
>  CYGNUM_HAL_MAX_INTERRUPT_NESTING = 4
>  CYGNUM_HAL_STACK_INTERRUPT_SIZE = 240
>  CYGNUM_HAL_STACK_FRAME_SIZE = 80
> therefore, by default we have CYGNUM_HAL_STACK_SIZE_MINIMUM = 1120.
> 
> In order to make things clearer, I suggest two things:
> 
> - set CYGNUM_HAL_MAX_INTERRUPT_NESTING to 1 if interrupt nesting is
> not allowed. In hal_arch.h this leads to something like that:
>  + #ifdef CYGSEM_HAL_COMMON_INTERRUPTS_ALLOW_NESTING
>    #define CYGNUM_HAL_MAX_INTERRUPT_NESTING 4
>  + #else
>  + #define CYGNUM_HAL_MAX_INTERRUPT_NESTING 1
>  + #endif
> 
> - warn if the idle thread stack size has to be expanded. We jhust have
> to add the following line at the right place in thread.cxx:
> 
> #warning "CYGNUM_KERNEL_THREADS_IDLE_STACK_SIZE <
> CYGNUM_HAL_STACK_SIZE_MINIMUM. Increasing
> CYGNUM_KERNEL_THREADS_IDLE_STACK_SIZE"
> 	

Actually, i think the correct way to do this is have it all in the
CDL. CYGNUM_KERNEL_THREADS_IDLE_STACK_SIZE should have a requires statement
something like

          requires ( CYGNUM_KERNEL_THREADS_IDLE_STACK_SIZE > (CYGNUM_HAL_MAX_INTERRUPT_NESTING * CYGNUM_HAL_STACK_INTERRUPT_SIZE + 2 * CYGNUM_HAL_STACK_FRAME_SIZE) )

If you then set the stack size too low, the CDL inference engine would
complain and tell you there is a problem.

You other macro magic can also be stated in terms of CDL.

Patches welcome.

        Andrew
 

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



More information about the Ecos-discuss mailing list