summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabio Baltieri <fabiobaltieri@google.com>2021-04-01 15:12:13 +0000
committerCommit Bot <commit-bot@chromium.org>2021-04-01 19:55:46 +0000
commitb02b3dd22d634a5bdd7e2285b5cff6b637989aa7 (patch)
tree64ab47d2a929a29f791423cc28bd0b0677ce65b9
parentd936645464835e970901c0b8e8476382a51d498b (diff)
downloadchrome-ec-b02b3dd22d634a5bdd7e2285b5cff6b637989aa7.tar.gz
zephyr: config: trim down task stacks for NPCX7
Reset the various task stack sizes based on the current build setup. This aims to keep the stack watermarks to ~75% based on the numbers observed after booting and running few EC commands. Current output: PD_INT_C1 (real size 736): unused 192 usage 544 / 736 (73 %) PD_INT_C0 (real size 736): unused 264 usage 472 / 736 (64 %) PD_C1 (real size 1184): unused 272 usage 912 / 1184 (77 %) PD_C0 (real size 1184): unused 520 usage 664 / 1184 (56 %) KEYSCAN (real size 640): unused 176 usage 464 / 640 (72 %) POWERBTN (real size 672): unused 176 usage 496 / 672 (73 %) KEYPROTO (real size 640): unused 208 usage 432 / 640 (67 %) HOSTCMD (real size 672): unused 216 usage 456 / 672 (67 %) MOTIONSENSE (real size 800): unused 216 usage 584 / 800 (73 %) CHIPSET (real size 1056): unused 280 usage 776 / 1056 (73 %) CHARGER (real size 704): unused 184 usage 520 / 704 (73 %) USB_CHG_P1 (real size 544): unused 152 usage 392 / 544 (72 %) USB_CHG_P0 (real size 544): unused 152 usage 392 / 544 (72 %) CHG_RAMP (real size 608): unused 144 usage 464 / 608 (76 %) HOOKS (real size 672): unused 200 usage 472 / 672 (70 %) workqueue (real size 704): unused 200 usage 504 / 704 (71 %) shell_uart (real size 960): unused 256 usage 704 / 960 (73 %) idle 00 (real size 128): unused 56 usage 72 / 128 (56 %) IRQ 00 (real size 1024): unused 384 usage 640 / 1024 (62 %) Total footprint before: SRAM: 58560 B 62 KB 92.24% and after: SRAM: 48640 B 62 KB 76.61% The settings are in a Kconfig block and override the default ones, this allows extending and changing the defaults depending on the architecture, board or any other combination. The same method is already widely used in Zephyr (such as for boards and shields). BUG=b:183748844 BRANCH=none TEST=kernel stacks on the EC shell Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: I31d901218993bb0d7a67169fd2f57033f00e5ccc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2799680 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
-rw-r--r--zephyr/Kconfig1
-rw-r--r--zephyr/Kconfig.stacks55
2 files changed, 56 insertions, 0 deletions
diff --git a/zephyr/Kconfig b/zephyr/Kconfig
index c9f447c05c..ec956ef49a 100644
--- a/zephyr/Kconfig
+++ b/zephyr/Kconfig
@@ -40,6 +40,7 @@ rsource "Kconfig.keyboard"
rsource "Kconfig.led"
rsource "Kconfig.powerseq"
rsource "Kconfig.motionsense"
+rsource "Kconfig.stacks"
rsource "Kconfig.system"
rsource "Kconfig.tasks"
rsource "Kconfig.temperature"
diff --git a/zephyr/Kconfig.stacks b/zephyr/Kconfig.stacks
new file mode 100644
index 0000000000..6bcb52fd18
--- /dev/null
+++ b/zephyr/Kconfig.stacks
@@ -0,0 +1,55 @@
+if SOC_SERIES_NPCX7
+
+# Zephyr internal stack sizes
+
+config IDLE_STACK_SIZE
+ default 128
+
+config ISR_STACK_SIZE
+ default 1024
+
+config SHELL_STACK_SIZE
+ default 960
+
+# Chromium EC stack sizes
+
+config DEFERRED_STACK_SIZE
+ default 704
+
+config TASK_CHARGER_STACK_SIZE
+ default 704
+
+config TASK_CHG_RAMP_STACK_SIZE
+ default 608
+
+config TASK_CHIPSET_STACK_SIZE
+ default 1056
+
+config TASK_HOOKS_STACK_SIZE
+ default 672
+
+config TASK_HOSTCMD_STACK_SIZE
+ default 672
+
+config TASK_KEYPROTO_STACK_SIZE
+ default 640
+
+config TASK_KEYSCAN_STACK_SIZE
+ default 640
+
+config TASK_MOTIONSENSE_STACK_SIZE
+ default 800
+
+config TASK_POWERBTN_STACK_SIZE
+ default 672
+
+config TASK_PD_STACK_SIZE
+ default 1184
+
+config TASK_PD_INT_STACK_SIZE
+ default 736
+
+config TASK_USB_CHG_STACK_SIZE
+ default 544
+
+endif # SOC_SERIES_NPCX7