This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Idle thread min stack size
- From: "Brian Karr" <brian at briankarr dot com>
- To: <ecos-discuss at ecos dot sourceware dot org>
- Date: Sun, 31 Jan 2010 22:59:23 -0800
- Subject: [ECOS] Idle thread min stack size
- References:
- Reply-to: <brian at briankarr dot com>
Hi All,
For applications with limited RAM, it's useful to optimize the minimum
allowed stack size for the Idle thread.
It has been identified that the eCos CYGNUM_HAL_STACK_SIZE_MINIMUM which is
used for the Idle thread and for ASSERT of thread creation is too high when
the system is set to CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK.
A suggested change for ARM is included in the diff below (with hg-ecos
trunk). A search of the list archives did not turn up an equivalent change
for this.
Without this the minimum stack size and the size of the idle stack will be
1120 bytes assuming a nesting level of 4.
Best,
Brian
diff -r d6c0c0e0431c packages/hal/arm/arch/current/include/hal_arch.h
--- a/packages/hal/arm/arch/current/include/hal_arch.h Tue Jan 26 11:27:47
2010 +0000
+++ b/packages/hal/arm/arch/current/include/hal_arch.h Sun Jan 31 22:52:44
2010 -0800
@@ -400,9 +400,14 @@
// Space for the maximum number of nested interrupts, plus room to call
functions
#define CYGNUM_HAL_MAX_INTERRUPT_NESTING 4
-#define CYGNUM_HAL_STACK_SIZE_MINIMUM \
- (CYGNUM_HAL_MAX_INTERRUPT_NESTING * CYGNUM_HAL_STACK_INTERRUPT_SIZE
+ \
- 2 * CYGNUM_HAL_STACK_FRAME_SIZE)
+#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK
+#define CYGNUM_HAL_STACK_SIZE_MINIMUM \
+ (2 * CYGNUM_HAL_STACK_FRAME_SIZE)
+#else
+#define CYGNUM_HAL_STACK_SIZE_MINIMUM \
+ (CYGNUM_HAL_MAX_INTERRUPT_NESTING * CYGNUM_HAL_STACK_INTERRUPT_SIZE
+ \
+ 2 * CYGNUM_HAL_STACK_FRAME_SIZE)
+#endif
#define CYGNUM_HAL_STACK_SIZE_TYPICAL \
(CYGNUM_HAL_STACK_SIZE_MINIMUM + \
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss