X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=config_kern.h;h=2dcbae90c4eceec7c3e64d87b7d25f0821a7b6fb;hb=3fc75747c81395f9027b6b27cd03037e2a8eec08;hp=06779c27685d37de73f9c9c30f6efa2f5488e483;hpb=bcf38f772b397e7a8ba781a69aacb9380e54b32a;p=bertos.git diff --git a/config_kern.h b/config_kern.h old mode 100755 new mode 100644 index 06779c27..2dcbae90 --- a/config_kern.h +++ b/config_kern.h @@ -1,9 +1,34 @@ /** * \file * * * \brief Kernel configuration parameters @@ -72,15 +97,54 @@ #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(cpustack_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 - #define CONFIG_KERN_MEMFILLCODE 0xDBDB + #include + #if (SIZEOF_CPUSTACK_T == 1) + /* 8bit cpustack_t */ + #define CONFIG_KERN_STACKFILLCODE 0xA5 + #define CONFIG_KERN_MEMFILLCODE 0xDB + #elif (SIZEOF_CPUSTACK_T == 2) + /* 16bit cpustack_t */ + #define CONFIG_KERN_STACKFILLCODE 0xA5A5 + #define CONFIG_KERN_MEMFILLCODE 0xDBDB + #elif (SIZEOF_CPUSTACK_T == 4) + /* 16bit cpustack_t */ + #define CONFIG_KERN_STACKFILLCODE 0xA5A5A5A5UL + #define CONFIG_KERN_MEMFILLCODE 0xDBDBDBDBUL + #else + #error No cpustack_t size supported! + #endif #endif