summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2021-02-11 09:56:28 -0700
committerCommit Bot <commit-bot@chromium.org>2021-02-11 19:51:31 +0000
commita56c816a329d4c78d54518c16f995bcf21d4a714 (patch)
treef20aa79979417f1f6627243320c928d6ea7742cc
parent794fd7a8a43a9e63065af00e6b5eb2411539c7e7 (diff)
downloadchrome-ec-a56c816a329d4c78d54518c16f995bcf21d4a714.tar.gz
zephyr: clean up CONFIG_ZEPHYR thing
Move CONFIG_ZEPHYR from Kconfig to CMakeLists.txt since it really makes no sense in Kconfig (should always be set to y). This allows us to pluck it out of config_chip.h as well. BUG=none BRANCH=none TEST=zmake testall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Iafb20c4b373e2c344e7c856d454080b7f008f1d9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2690987 Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r--include/config.h4
-rw-r--r--zephyr/CMakeLists.txt4
-rw-r--r--zephyr/Kconfig16
-rw-r--r--zephyr/shim/include/config_chip.h2
4 files changed, 8 insertions, 18 deletions
diff --git a/include/config.h b/include/config.h
index 4e4c81f357..8d7c0d34d6 100644
--- a/include/config.h
+++ b/include/config.h
@@ -5025,8 +5025,12 @@
/*
* This build is not a complete platform/ec based EC, but instead
* using the platform/ec zephyr module.
+ *
+ * Note: this is here purely for stylistic purposes and documentation.
*/
+#ifndef CONFIG_ZEPHYR
#undef CONFIG_ZEPHYR
+#endif
/*****************************************************************************/
/*
diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt
index 77541029c3..0fbb7b6b99 100644
--- a/zephyr/CMakeLists.txt
+++ b/zephyr/CMakeLists.txt
@@ -51,6 +51,10 @@ if(DEFINED CONFIG_PLATFORM_EC)
# determine that the header is being compiled for the EC instead of
# by another third-party C codebase.
zephyr_compile_definitions("CHROMIUM_EC")
+
+ # Add CONFIG_ZEPHYR, which is commonly used to guard code for use
+ # with Zephyr builds only.
+ zephyr_compile_definitions("CONFIG_ZEPHYR")
endif()
# If a header is needed (should only be set for npcx) run the ecst.py script to
diff --git a/zephyr/Kconfig b/zephyr/Kconfig
index 8656d37c6b..966b5ecec0 100644
--- a/zephyr/Kconfig
+++ b/zephyr/Kconfig
@@ -42,22 +42,6 @@ rsource "Kconfig.motionsense"
rsource "Kconfig.tasks"
rsource "Kconfig.usbc"
-# 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.
-
# Define PLATFORM_EC_... options to enable EC features. Each Kconfig should be
# matched by a line in zephyr/shim/include/config_chip.h which #defines the
# corresponding EC CONFIG if this Kconfig is enabled.
diff --git a/zephyr/shim/include/config_chip.h b/zephyr/shim/include/config_chip.h
index 608e9df1aa..e9983421e6 100644
--- a/zephyr/shim/include/config_chip.h
+++ b/zephyr/shim/include/config_chip.h
@@ -18,8 +18,6 @@
* common/config.h.
*/
-#define CONFIG_ZEPHYR
-
/*
* Obsolete configs - these are options that are not needed, either because
* Zephyr features directly replace the option, or because the config option