summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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