diff options
author | Keith Short <keithshort@chromium.org> | 2021-06-11 11:40:59 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-06-11 22:37:34 +0000 |
commit | 5dc635ecc03c33ac7deee780ba45aa2581f8c88d (patch) | |
tree | 808b1d9addff175fa4f109902d7eb2da0f50a198 | |
parent | 3ba97e28cf05c1cca689e28ed57245f1335b79dd (diff) | |
download | chrome-ec-5dc635ecc03c33ac7deee780ba45aa2581f8c88d.tar.gz |
zephyr: Conditionally remove the task name
The names stored in the shimmed task list are not accessible unless
CONFIG_THREAD_NAME is defined. Compile out the task names unless
CONFIG_THREAD_NAME is enabled.
This provides a modest 300 byte savings.
BUG=none
BRANCH=none
TEST=zmake testall
Signed-off-by: Keith Short <keithshort@chromium.org>
Change-Id: Iaf6bc8a1a7311ed42221a89fc9520e962cdf1b7f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2956829
Reviewed-by: Yuval Peress <peress@chromium.org>
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
-rw-r--r-- | zephyr/shim/src/tasks.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/zephyr/shim/src/tasks.c b/zephyr/shim/src/tasks.c index 10b2987724..34be422db9 100644 --- a/zephyr/shim/src/tasks.c +++ b/zephyr/shim/src/tasks.c @@ -32,8 +32,10 @@ CROS_EC_TASK_LIST /** Context for each CROS EC task that is run in its own zephyr thread */ struct task_ctx { +#ifdef CONFIG_THREAD_NAME /** Name of thread (for debugging) */ const char *name; +#endif /** Zephyr thread structure that hosts EC tasks */ struct k_thread zephyr_thread; /** Zephyr thread id for above thread */ @@ -57,6 +59,7 @@ struct task_ctx { struct k_timer timer; }; +#ifdef CONFIG_THREAD_NAME #define CROS_EC_TASK(_name, _entry, _parameter, _size) \ { \ .entry = _entry, \ @@ -65,6 +68,15 @@ struct task_ctx { .stack_size = _size, \ .name = #_name, \ }, +#else +#define CROS_EC_TASK(_name, _entry, _parameter, _size) \ + { \ + .entry = _entry, \ + .parameter = _parameter, \ + .stack = _name##_STACK, \ + .stack_size = _size, \ + }, +#endif /* CONFIG_THREAD_NAME */ #define TASK_TEST(_name, _entry, _parameter, _size) \ CROS_EC_TASK(_name, _entry, _parameter, _size) static struct task_ctx shimmed_tasks[] = { CROS_EC_TASK_LIST }; @@ -188,8 +200,11 @@ static void task_entry(void *task_contex, void *unused1, void *unused2) ARG_UNUSED(unused2); struct task_ctx *const ctx = (struct task_ctx *)task_contex; + +#ifdef CONFIG_THREAD_NAME /* Name thread for debugging */ k_thread_name_set(ctx->zephyr_tid, ctx->name); +#endif /* Call into task entry point */ ctx->entry((void *)ctx->parameter); |