diff options
author | Randall Spangler <rspangler@chromium.org> | 2012-09-07 13:48:23 -0700 |
---|---|---|
committer | Gerrit <chrome-bot@google.com> | 2012-09-09 11:00:34 -0700 |
commit | a3d62a3700206b9cd34e129f6a04967bed5e46e4 (patch) | |
tree | 7961d109a7bf74d000f283a678ed757b0bf0989b /core/cortex-m | |
parent | 22d13781dcd006f9305956d33bf1ce1581454d2e (diff) | |
download | chrome-ec-a3d62a3700206b9cd34e129f6a04967bed5e46e4.tar.gz |
Switch to variable-size stacks
Increase stack size slightly for vboot hash task since the vboot
SHA256 function allocates ~300 bytes of stack data. Reduce stack size
for watchdog, power LED, and a few other tasks with simple call trees
where we can be sure an error path isn't going to blow past the
reduced stack.
This frees up ~1KB of RAM on STM32.
BUG=chrome-os-partner:13814
BRANCH=all
TEST=boot system; shmem should show more unused RAM; taskinfo should show
tasks still have unused stack
Change-Id: I47d6b77564a0180d15d86667cc0566a8919b776e
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/32608
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'core/cortex-m')
-rw-r--r-- | core/cortex-m/task.c | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/core/cortex-m/task.c b/core/cortex-m/task.c index 77573a3e14..ba6e374501 100644 --- a/core/cortex-m/task.c +++ b/core/cortex-m/task.c @@ -15,15 +15,6 @@ #include "uart.h" #include "util.h" -/** - * Global memory size for a task : 512 bytes - * including its contexts and its stack - */ -#define TASK_SIZE 512 - -/* Size of stack */ -#define STACK_SIZE 488 - typedef union { struct { /* @@ -41,14 +32,14 @@ typedef union { #define STACK_UNUSED_VALUE 0xdeadd00d /* declare task routine prototypes */ -#define TASK(n, r, d) int r(void *); +#define TASK(n, r, d, s) int r(void *); #include TASK_LIST void __idle(void); CONFIG_TASK_LIST #undef TASK /* Task names for easier debugging */ -#define TASK(n, r, d) #n, +#define TASK(n, r, d, s) #n, #include TASK_LIST static const char * const task_names[] = { "<< idle >>", @@ -98,10 +89,10 @@ static void task_exit_trap(void) /* Startup parameters for all tasks. */ -#define TASK(n, r, d) { \ +#define TASK(n, r, d, s) { \ .r0 = (uint32_t)d, \ .pc = (uint32_t)r, \ - .stack_size = STACK_SIZE, \ + .stack_size = s, \ }, #include TASK_LIST static const struct { @@ -109,7 +100,7 @@ static const struct { uint32_t pc; uint16_t stack_size; } const tasks_init[] = { - TASK(IDLE, __idle, 0) + TASK(IDLE, __idle, 0, IDLE_TASK_STACK_SIZE) CONFIG_TASK_LIST }; #undef TASK @@ -119,10 +110,10 @@ static task_ tasks[TASK_ID_COUNT]; /* Stacks for all tasks */ /* TODO: variable-size stacks */ -#define TASK(n, r, d) + STACK_SIZE +#define TASK(n, r, d, s) + s #include TASK_LIST -uint8_t task_stacks[ - STACK_SIZE +uint8_t task_stacks[0 + TASK(IDLE, __idle, 0, IDLE_TASK_STACK_SIZE) CONFIG_TASK_LIST ] __attribute__((aligned(8))); |