diff options
author | Jack Rosenthal <jrosenth@chromium.org> | 2020-09-23 08:47:51 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-10-01 19:13:58 +0000 |
commit | 1f46aa758e3bee111cb6274eebbbf70bdbf00838 (patch) | |
tree | fd933122d77c4c073a059430c4d55432c5d80fff | |
parent | 0925bb2ba8afc40d7becd571a89c4bb062311680 (diff) | |
download | chrome-ec-1f46aa758e3bee111cb6274eebbbf70bdbf00838.tar.gz |
zephyr: add base files for Zephyr module
This adds the minimum files necessary for platform/ec to be considered
a Zephyr module, as well as some of the discussed CMakeLists files
from go/zephyr-shim.
BUG=b:167590251
BRANCH=none
TEST=Append platform/ec dir to ZEPHYR_MODULES, build for posix-ec
To replicate:
$ export ZEPHYR_TOOLCHAIN_VARIANT=llvm
$ export ZEPHYR_BASE=...
$ ZEPHYR_CHROME=...
$ PLATFORM_EC=...
$ cmake -S ${ZEPHYR_CHROME}/projects/experimental/posix-ec \
-B /tmp/zephyr-build \
-D ZEPHYR_MODULES="${ZEPHYR_CHROME};${PLATFORM_EC}"
$ ninja -C /tmp/zephyr-build
$ /tmp/zephyr-build/zephyr/zephyr.elf
Signed-off-by: Jack Rosenthal <jrosenth@chromium.org>
Change-Id: Id5eb4e4d3b761a9499e876dfe2178be7f7961e93
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2427089
Reviewed-by: Jett Rink <jettrink@chromium.org>
-rw-r--r-- | zephyr/CMakeLists.txt | 27 | ||||
-rw-r--r-- | zephyr/Kconfig | 17 | ||||
-rw-r--r-- | zephyr/module.yml | 7 | ||||
-rw-r--r-- | zephyr/shim/src/CMakeLists.txt | 5 |
4 files changed, 56 insertions, 0 deletions
diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt new file mode 100644 index 0000000000..5c0866bd74 --- /dev/null +++ b/zephyr/CMakeLists.txt @@ -0,0 +1,27 @@ +# Copyright 2020 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. + +# Note: this cmake system implements only a zephyr module, and is not +# intended to build a complete EC. To build projects in platform/ec, +# you should continue to use the Makefile system. +# +# Googlers can find the design doc at go/zephyr-shim. + +if(NOT DEFINED ZEPHYR_CURRENT_MODULE_DIR) + message(FATAL_ERROR "This Cmake system implements only a Zephyr module, and + should not be invoked directly. Please continue to use the Makefile + system for non-Zephyr builds.") +endif() + +set(PLATFORM_EC "${ZEPHYR_CURRENT_MODULE_DIR}/.." CACHE PATH + "Path to the platform/ec repo.") + +zephyr_include_directories_ifdef( + CONFIG_PLATFORM_EC + "${PLATFORM_EC}/zephyr/shim/include" + "${PLATFORM_EC}/fuzz" + "${PLATFORM_EC}/test" + "${PLATFORM_EC}/include") + +add_subdirectory_ifdef(CONFIG_PLATFORM_EC "shim/src") diff --git a/zephyr/Kconfig b/zephyr/Kconfig new file mode 100644 index 0000000000..be011de867 --- /dev/null +++ b/zephyr/Kconfig @@ -0,0 +1,17 @@ +# Copyright 2020 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. + +menuconfig PLATFORM_EC + bool "Enable building code from the platform/ec Zephyr module" + imply PRINTK + imply SHELL + help + The platform/ec Zephyr module allows some code from the + existing Chrome OS EC project to be "shimmed" into Zephyr. + +if PLATFORM_EC + +# Nothing here yet. + +endif # PLATFORM_EC diff --git a/zephyr/module.yml b/zephyr/module.yml new file mode 100644 index 0000000000..a8ea98bece --- /dev/null +++ b/zephyr/module.yml @@ -0,0 +1,7 @@ +# Copyright 2020 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. + +build: + cmake: zephyr/ + kconfig: zephyr/Kconfig diff --git a/zephyr/shim/src/CMakeLists.txt b/zephyr/shim/src/CMakeLists.txt new file mode 100644 index 0000000000..d3db874f71 --- /dev/null +++ b/zephyr/shim/src/CMakeLists.txt @@ -0,0 +1,5 @@ +# Copyright 2020 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. + +# Nothing here yet. |