From f8c8ab55241620fe047077f02ae0cce1d8e56d19 Mon Sep 17 00:00:00 2001 From: Jack Rosenthal Date: Thu, 17 Sep 2020 09:51:39 -0600 Subject: 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 Change-Id: I157928720d9d6ec0b71c2138298f46c64723fe0b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2427090 Reviewed-by: Jett Rink --- include/config.h | 6 ++++++ zephyr/Kconfig | 16 +++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) 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 -- cgit v1.2.1