diff options
author | Jeremy Bettis <jbettis@google.com> | 2021-04-01 10:54:49 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-04-02 17:10:22 +0000 |
commit | 00d0b8d09d5cfc75dbf6252b87990e0646caeb22 (patch) | |
tree | 3786fd206f94bae71352f72fff144e17e3f13e06 /zephyr/app/ec | |
parent | d7d83e19a725e43301606b26c08c0358fca43833 (diff) | |
download | chrome-ec-00d0b8d09d5cfc75dbf6252b87990e0646caeb22.tar.gz |
zephyr: New test of ec app
Change zephy/app/ec/main.c:main to instead be named ec_app_main, so
that it can be called from tests, and created a trivial stub main to
call it. Fix up the CMake files for this change.
Add a new ec_app test which calls the ec_app_main() and verifies
that hooks of HOOK_INIT type are called. The CONFIG_PLATFORM_EC_HOOKS is
the only config currently enabled in tests, so that is the only thing
tested for now.
BUG=b:184273560
TEST=zmake configure --test zephyr/test/ec_app
BRANCH=none
Change-Id: I84ca9b36d3f387629ff5bd83463429d762cc2301
Signed-off-by: Jeremy Bettis <jbettis@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2799914
Tested-by: Jeremy Bettis <jbettis@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Keith Short <keithshort@chromium.org>
Commit-Queue: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'zephyr/app/ec')
-rw-r--r-- | zephyr/app/ec/CMakeLists.txt | 4 | ||||
-rw-r--r-- | zephyr/app/ec/ec_app_main.c (renamed from zephyr/app/ec/main.c) | 6 | ||||
-rw-r--r-- | zephyr/app/ec/include/ec_app_main.h | 6 | ||||
-rw-r--r-- | zephyr/app/ec/main_shim.c | 13 |
4 files changed, 27 insertions, 2 deletions
diff --git a/zephyr/app/ec/CMakeLists.txt b/zephyr/app/ec/CMakeLists.txt index 43f4ff2fe2..f12067a5b5 100644 --- a/zephyr/app/ec/CMakeLists.txt +++ b/zephyr/app/ec/CMakeLists.txt @@ -2,6 +2,8 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +zephyr_library_include_directories(include) +zephyr_library_sources(ec_app_main.c) if(NOT DEFINED CONFIG_ZTEST) - zephyr_library_sources(main.c) + zephyr_library_sources(main_shim.c) endif() diff --git a/zephyr/app/ec/main.c b/zephyr/app/ec/ec_app_main.c index 44f272e0d6..ad8498efc6 100644 --- a/zephyr/app/ec/main.c +++ b/zephyr/app/ec/ec_app_main.c @@ -16,8 +16,12 @@ #include "vboot.h" #include "watchdog.h" #include "zephyr_espi_shim.h" +#include "ec_app_main.h" -void main(void) +/* For testing purposes this is not named main. See main_shim.c for the real + * main() function. + */ +void ec_app_main(void) { printk("Hello from a Chrome EC!\n"); printk(" BOARD=%s\n", CONFIG_BOARD); diff --git a/zephyr/app/ec/include/ec_app_main.h b/zephyr/app/ec/include/ec_app_main.h new file mode 100644 index 0000000000..a5043be84a --- /dev/null +++ b/zephyr/app/ec/include/ec_app_main.h @@ -0,0 +1,6 @@ +/* Copyright 2021 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +void ec_app_main(void); diff --git a/zephyr/app/ec/main_shim.c b/zephyr/app/ec/main_shim.c new file mode 100644 index 0000000000..83e58e67b8 --- /dev/null +++ b/zephyr/app/ec/main_shim.c @@ -0,0 +1,13 @@ +/* Copyright 2021 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#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(); +} +/* LCOV_EXCL_STOP */ |