This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

CYGNUM_KERNEL_THREADS_IDLE_STACK_SIZE on ARM architectures (and others)


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"
	

I know people can work it out by themselves but it just makes things
slightly clearer. It can also occur on other achitectures.

Cheers,
Gregory Heinrich.

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]