summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabio Baltieri <fabiobaltieri@google.com>2022-12-15 15:17:28 +0000
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-12-19 10:51:32 +0000
commit7e5283549f8be6c3efb610b55e3e37ac1da0c5e7 (patch)
tree6979c2a78898ceb3475e47046a2a0e307c42f38c
parente6911dd9112aafa482288d54f043792144c26a1f (diff)
downloadchrome-ec-7e5283549f8be6c3efb610b55e3e37ac1da0c5e7.tar.gz
zephyr: mock: always include the include directory
There's multiple emul drivers relying on include files, change the CMake include directive to always add that to the include search path. Fixes a build fail when PWM_MOCK is used but not EMUL_CROS_FLASH. Now though this ends up causing a collision since there's multiple flash_chip.h files in the system, one for every supported chip. Fix that by using a different name when running in NATIVE_POSIX, so that there's no ambiguity. Sort the build list while we are at it. BRANCH=none BUG=none TEST=cq dry run Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: I9858ab3ccea2631ff7b3a22ef2d1c79b4dc73b25 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4111305 Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
-rw-r--r--zephyr/emul/CMakeLists.txt34
-rw-r--r--zephyr/emul/include/flash_chip_native_posix.h (renamed from zephyr/emul/include/flash_chip.h)0
-rw-r--r--zephyr/shim/include/config_chip.h6
3 files changed, 23 insertions, 17 deletions
diff --git a/zephyr/emul/CMakeLists.txt b/zephyr/emul/CMakeLists.txt
index 3d268dde80..10a7be345a 100644
--- a/zephyr/emul/CMakeLists.txt
+++ b/zephyr/emul/CMakeLists.txt
@@ -4,28 +4,28 @@
add_subdirectory("tcpc")
-zephyr_library_sources_ifdef(CONFIG_EMUL_COMMON_I2C emul_common_i2c.c)
-zephyr_library_sources_ifdef(CONFIG_EMUL_SMART_BATTERY emul_smart_battery.c)
-zephyr_library_sources_ifdef(CONFIG_EMUL_BMA255 emul_bma255.c)
+cros_ec_library_include_directories(include)
+
+zephyr_library_sources_ifdef(CONFIG_EMUL_BB_RETIMER emul_bb_retimer.c)
zephyr_library_sources_ifdef(CONFIG_EMUL_BC12_DETECT_PI3USB9201 emul_pi3usb9201.c)
-zephyr_library_sources_ifdef(CONFIG_EMUL_PPC_SYV682X emul_syv682x.c)
+zephyr_library_sources_ifdef(CONFIG_EMUL_BMA255 emul_bma255.c)
zephyr_library_sources_ifdef(CONFIG_EMUL_BMI emul_bmi.c)
zephyr_library_sources_ifdef(CONFIG_EMUL_BMI emul_bmi160.c)
zephyr_library_sources_ifdef(CONFIG_EMUL_BMI emul_bmi260.c)
-zephyr_library_sources_ifdef(CONFIG_EMUL_TCS3400 emul_tcs3400.c)
-zephyr_library_sources_ifdef(CONFIG_EMUL_TUSB1064 emul_tusb1064.c)
-zephyr_library_sources_ifdef(CONFIG_EMUL_BB_RETIMER emul_bb_retimer.c)
-zephyr_library_sources_ifdef(CONFIG_EMUL_LN9310 emul_ln9310.c)
-zephyr_library_sources_ifdef(CONFIG_EMUL_LIS2DW12 emul_lis2dw12.c)
-zephyr_library_sources_ifdef(CONFIG_I2C_MOCK i2c_mock.c)
-zephyr_library_sources_ifdef(CONFIG_EMUL_ISL923X emul_isl923x.c)
zephyr_library_sources_ifdef(CONFIG_EMUL_CLOCK_CONTROL emul_clock_control.c)
-zephyr_library_sources_ifdef(CONFIG_EMUL_SN5S330 emul_sn5s330.c)
-zephyr_library_sources_ifdef(CONFIG_EMUL_KB_RAW emul_kb_raw.c)
+zephyr_library_sources_ifdef(CONFIG_EMUL_COMMON_I2C emul_common_i2c.c)
zephyr_library_sources_ifdef(CONFIG_EMUL_CROS_FLASH emul_flash.c)
-zephyr_library_sources_ifdef(CONFIG_EMUL_RTC emul_rtc.c)
+zephyr_library_sources_ifdef(CONFIG_EMUL_ISL923X emul_isl923x.c)
+zephyr_library_sources_ifdef(CONFIG_EMUL_KB_RAW emul_kb_raw.c)
+zephyr_library_sources_ifdef(CONFIG_EMUL_LIS2DW12 emul_lis2dw12.c)
+zephyr_library_sources_ifdef(CONFIG_EMUL_LN9310 emul_ln9310.c)
+zephyr_library_sources_ifdef(CONFIG_EMUL_PCT2075 emul_pct2075.c)
+zephyr_library_sources_ifdef(CONFIG_EMUL_PPC_SYV682X emul_syv682x.c)
zephyr_library_sources_ifdef(CONFIG_EMUL_RT9490 emul_rt9490.c)
+zephyr_library_sources_ifdef(CONFIG_EMUL_RTC emul_rtc.c)
+zephyr_library_sources_ifdef(CONFIG_EMUL_SMART_BATTERY emul_smart_battery.c)
+zephyr_library_sources_ifdef(CONFIG_EMUL_SN5S330 emul_sn5s330.c)
+zephyr_library_sources_ifdef(CONFIG_EMUL_TCS3400 emul_tcs3400.c)
+zephyr_library_sources_ifdef(CONFIG_EMUL_TUSB1064 emul_tusb1064.c)
+zephyr_library_sources_ifdef(CONFIG_I2C_MOCK i2c_mock.c)
zephyr_library_sources_ifdef(CONFIG_PWM_MOCK pwm_mock.c)
-zephyr_library_sources_ifdef(CONFIG_EMUL_PCT2075 emul_pct2075.c)
-
-cros_ec_library_include_directories_ifdef(CONFIG_EMUL_CROS_FLASH include)
diff --git a/zephyr/emul/include/flash_chip.h b/zephyr/emul/include/flash_chip_native_posix.h
index 947246867b..947246867b 100644
--- a/zephyr/emul/include/flash_chip.h
+++ b/zephyr/emul/include/flash_chip_native_posix.h
diff --git a/zephyr/shim/include/config_chip.h b/zephyr/shim/include/config_chip.h
index 4c646adf19..e9fd8727f0 100644
--- a/zephyr/shim/include/config_chip.h
+++ b/zephyr/shim/include/config_chip.h
@@ -561,7 +561,13 @@ extern char mock_jump_data[CONFIG_PLATFORM_EC_PRESERVED_END_OF_RAM_SIZE];
#undef CONFIG_MAPPED_STORAGE
#undef CONFIG_FLASH_PSTATE
#ifdef CONFIG_PLATFORM_EC_FLASH_CROS
+
+#ifdef CONFIG_BOARD_NATIVE_POSIX
+#include "flash_chip_native_posix.h"
+#else
#include "flash_chip.h"
+#endif
+
#define CONFIG_FLASH_CROS
/* Internal, don't use outside this header */