summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2020-09-17 09:51:39 -0600
committerCommit Bot <commit-bot@chromium.org>2020-10-01 19:14:01 +0000
commitf8c8ab55241620fe047077f02ae0cce1d8e56d19 (patch)
tree9942ab344158293ad07eff129bde55adc637216c
parent1f46aa758e3bee111cb6274eebbbf70bdbf00838 (diff)
downloadchrome-ec-f8c8ab55241620fe047077f02ae0cce1d8e56d19.tar.gz
config: add CONFIG_ZEPHYR
This adds a new configuration option, CONFIG_ZEPHYR, which gets enabled during a build of the platform/ec Zephyr module. BUG=b:167590251 BRANCH=none TEST=compiles Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I157928720d9d6ec0b71c2138298f46c64723fe0b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2427090 Reviewed-by: Jett Rink <jettrink@chromium.org>
-rw-r--r--include/config.h6
-rw-r--r--zephyr/Kconfig16
2 files changed, 21 insertions, 1 deletions
diff --git a/include/config.h b/include/config.h
index ab713c7a5d..057046517d 100644
--- a/include/config.h
+++ b/include/config.h
@@ -4820,6 +4820,12 @@
/* Define to enable USB State Machine framework. */
#undef CONFIG_TEST_SM
+/*
+ * This build is not a complete platform/ec based EC, but instead
+ * using the platform/ec zephyr module.
+ */
+#undef CONFIG_ZEPHYR
+
/*****************************************************************************/
/*
* Include board and core configs, since those hold the CONFIG_ constants for a
diff --git a/zephyr/Kconfig b/zephyr/Kconfig
index be011de867..e70bb57fc7 100644
--- a/zephyr/Kconfig
+++ b/zephyr/Kconfig
@@ -12,6 +12,20 @@ menuconfig PLATFORM_EC
if PLATFORM_EC
-# Nothing here yet.
+# Below is a hack to use CONFIG_ZEPHYR in platform/ec code before
+# config.h has been included. There is some tricky ordering in some
+# header files that we cannot use config.h (e.g., common.h and
+# compile_time_macros.h), as many board.h and config_chip.h files
+# use these macros, and thus would be included by an include of
+# config.h. We work around this by initially defining CONFIG_ZEPHYR
+# in Kconfig as an invisible symbol (it should always be enabled).
+# Then, once config.h gets included, it subsequently gets undef'ed by
+# config.h, and then redefined by config_chip.h in the Zephyr shim.
+config ZEPHYR
+ bool
+ default y
+ help
+ This should always be enabled. It's a workaround for
+ config.h not being available in some headers.
endif # PLATFORM_EC