Remove CVS logs. Add ASSERT.
[bertos.git] / config_kern.h
index c84e07e4d79cff18fd006f982e4f97ff08c9c965..1edbabe9dc389952ec577edca23635638efd86b9 100644 (file)
@@ -28,7 +28,7 @@
  *
  * Copyright 2001,2004 Develer S.r.l. (http://www.develer.com/)
  * Copyright 1999,2000,2001 Bernardo Innocenti <bernie@develer.com>
- * This file is part of DevLib - See README.devlib for information.
+ *
  * -->
  *
  * \brief Kernel configuration parameters
 #define CONFIG_KERN_QUANTUM     50    /**< Time sharing quantum in timer ticks. */
 
 #if (ARCH & ARCH_EMUL)
-       #define CONFIG_KERN_DEFSTACKSIZE  65536
+       /* We need a large stack because system libraries are bloated */
+       #define CONFIG_PROC_DEFSTACKSIZE  65536
 #else
-       #define CONFIG_KERN_DEFSTACKSIZE  128  /**< Default stack size for each thread. */
+       /**
+        * Default stack size for each thread, in bytes.
+        *
+        * The goal here is to allow a minimal task to save all of its
+        * registers twice, plus push a maximum of 32 variables on the
+        * stack.
+        *
+        * The actual size computed by the default formula is:
+        *   AVR:    102
+        *   i386:   156
+        *   ARM:    164
+        *   x86_64: 184
+        *
+        * Note that on most 16bit architectures, interrupts will also
+        * run on the stack of the currently running process.  Nested
+        * interrupts will greatly increases the amount of stack space
+        * required per process.  Use irqmanager to minimize stack
+        * usage.
+        */
+       #define CONFIG_PROC_DEFSTACKSIZE  \
+           (CPU_SAVED_REGS_CNT * 2 * sizeof(cpu_stack_t) \
+           + 32 * sizeof(int))
 #endif
 
+/* OBSOLETE */
+#define CONFIG_KERN_DEFSTACKSIZE CONFIG_PROC_DEFSTACKSIZE
+
 /* Memory fill codes to help debugging */
 #if CONFIG_KERN_MONITOR
        #define CONFIG_KERN_STACKFILLCODE  0xA5A5