diff options
author | Fabio Baltieri <fabiobaltieri@google.com> | 2021-04-26 14:26:40 +0000 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-04-27 16:54:32 +0000 |
commit | 19bde9a628c0395aef7560a914ea421c20eeb3cb (patch) | |
tree | 441dab9f6a33411c322167eaebe0d2f2eb8318ed /zephyr/app | |
parent | 92fcaf7cc7dcf69a2518dfb235a335932a0572a3 (diff) | |
download | chrome-ec-19bde9a628c0395aef7560a914ea421c20eeb3cb.tar.gz |
zephyr: shim: do not return from main if thread monitoring is enabled
Returning from main causes the corresponding thread structure to be
skipped from the thread list, so that it does not get displayed by
commands such as "kernel stacks". The structure is statically allocated
though, so it is convenient to keep it active when thread monitoring is
enabled so that the corresponding stack can be tuned.
After this patch:
uart:~$ kernel stacks
...
0x200c76f8 main (real size 1024): unused 148 usage 876 / 1024 (85 %)
...
BUG=b:183748844
BRANCH=none
TEST=kernel stacks
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Change-Id: Iee34fac36f5e8989e9d7c761b7cc6b9a14a7b987
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2853598
Reviewed-by: Keith Short <keithshort@chromium.org>
Reviewed-by: Yuval Peress <peress@chromium.org>
Commit-Queue: Yuval Peress <peress@chromium.org>
Diffstat (limited to 'zephyr/app')
-rw-r--r-- | zephyr/app/ec/main_shim.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/zephyr/app/ec/main_shim.c b/zephyr/app/ec/main_shim.c index 83e58e67b8..35f45e0286 100644 --- a/zephyr/app/ec/main_shim.c +++ b/zephyr/app/ec/main_shim.c @@ -3,11 +3,20 @@ * found in the LICENSE file. */ +#include <kernel.h> #include "ec_app_main.h" /** A stub main to call the real ec app main function. LCOV_EXCL_START */ void main(void) { ec_app_main(); + +#ifdef CONFIG_THREAD_MONITOR + /* + * Avoid returning so that the main stack is displayed by the + * "kernel stacks" shell command. + */ + k_sleep(K_FOREVER); +#endif } /* LCOV_EXCL_STOP */ |