summaryrefslogtreecommitdiff
path: root/zephyr/test/i2c/CMakeLists.txt
diff options
context:
space:
mode:
authorYuval Peress <peress@chromium.org>2020-11-13 11:09:40 -0700
committerCommit Bot <commit-bot@chromium.org>2020-11-20 20:22:22 +0000
commit8abeefdccbc98eec5e24da971e0bfe0cb2fbf279 (patch)
treec63ebf756372506f4d7e11b5b05d4e9ee4ca3770 /zephyr/test/i2c/CMakeLists.txt
parent325910fad3177a443048a65177a0b17a58f95d4e (diff)
downloadchrome-ec-8abeefdccbc98eec5e24da971e0bfe0cb2fbf279.tar.gz
zephyr: add i2c_ports enum
This change adds an i2c_ports enum based on the devicetree phandle list 'named-i2c-ports'. Modeled after named-gpios. Currently, this is only enabled for ztests as it conflicts with the definitions in config_chip-npcx7.h. But once that dependency is removed, this enum will become publicly available. BUG=b:171302975 BRANCH=none TEST=../zephyr-chrome/firmware_builder.py test Cq-Depend: chromium:2546328 Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I8e763da0c867fed383eb333092f191079fb792ea Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2546997 Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'zephyr/test/i2c/CMakeLists.txt')
-rw-r--r--zephyr/test/i2c/CMakeLists.txt28
1 files changed, 28 insertions, 0 deletions
diff --git a/zephyr/test/i2c/CMakeLists.txt b/zephyr/test/i2c/CMakeLists.txt
new file mode 100644
index 0000000000..097c31f498
--- /dev/null
+++ b/zephyr/test/i2c/CMakeLists.txt
@@ -0,0 +1,28 @@
+# SPDX-License-Identifier: Apache-2.0
+
+cmake_minimum_required(VERSION 3.13.1)
+set(BOARD native_posix)
+project(base32)
+find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
+
+# Need to ensure that we are including only zephyr definitions in include files
+# We cannot set these via kconfig, since this unit test does not bring in the
+# zephyr-chrome repository
+zephyr_compile_definitions("CONFIG_ZEPHYR")
+zephyr_compile_definitions("CONFIG_PLATFORM_EC_I2C")
+
+# We need to include the EC include directory and this local test directory
+# for the task defines
+zephyr_include_directories(
+ "${PLATFORM_EC}/zephyr/shim/include"
+ "${PLATFORM_EC}/fuzz"
+ "${PLATFORM_EC}/test"
+ "${PLATFORM_EC}/include")
+
+# Include test file, test under test and console dependency
+target_sources(app PRIVATE
+ src/main.c
+ "${PLATFORM_EC}/zephyr/shim/src/console.c"
+ "${PLATFORM_EC}/zephyr/shim/src/i2c.c"
+ "${PLATFORM_EC}/zephyr/shim/src/util.c"
+ "${PLATFORM_EC}/common/i2c_master.c")