diff options
-rw-r--r-- | include/config.h | 4 | ||||
-rw-r--r-- | zephyr/CMakeLists.txt | 4 | ||||
-rw-r--r-- | zephyr/Kconfig | 16 | ||||
-rw-r--r-- | zephyr/shim/include/config_chip.h | 2 |
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 |