From e62095dee121209f4a620f4361f940efcaa45af5 Mon Sep 17 00:00:00 2001 From: TOKITA Hiroshi Date: Sat, 28 Sep 2024 01:31:13 +0900 Subject: [PATCH] tests: drivers: build_all: Add a build_all test for flash The test targets the following devices at this time. - atmel,at45 - jedec,spi-nor Signed-off-by: TOKITA Hiroshi --- tests/drivers/build_all/flash/CMakeLists.txt | 8 +++++ tests/drivers/build_all/flash/app.overlay | 37 ++++++++++++++++++++ tests/drivers/build_all/flash/prj.conf | 2 ++ tests/drivers/build_all/flash/spi.dtsi | 26 ++++++++++++++ tests/drivers/build_all/flash/src/main.c | 9 +++++ tests/drivers/build_all/flash/testcase.yaml | 21 +++++++++++ 6 files changed, 103 insertions(+) create mode 100644 tests/drivers/build_all/flash/CMakeLists.txt create mode 100644 tests/drivers/build_all/flash/app.overlay create mode 100644 tests/drivers/build_all/flash/prj.conf create mode 100644 tests/drivers/build_all/flash/spi.dtsi create mode 100644 tests/drivers/build_all/flash/src/main.c create mode 100644 tests/drivers/build_all/flash/testcase.yaml diff --git a/tests/drivers/build_all/flash/CMakeLists.txt b/tests/drivers/build_all/flash/CMakeLists.txt new file mode 100644 index 00000000000000..3742cd1ce05c63 --- /dev/null +++ b/tests/drivers/build_all/flash/CMakeLists.txt @@ -0,0 +1,8 @@ +# Copyright (c) 2024 TOKITA Hiroshi +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(build_all) + +target_sources(app PRIVATE src/main.c) diff --git a/tests/drivers/build_all/flash/app.overlay b/tests/drivers/build_all/flash/app.overlay new file mode 100644 index 00000000000000..17bbec2f0aebea --- /dev/null +++ b/tests/drivers/build_all/flash/app.overlay @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 TOKITA Hiroshi + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + test { + #address-cells = <1>; + #size-cells = <1>; + + test_gpio: gpio@deadbeef { + compatible = "vnd,gpio"; + gpio-controller; + reg = <0xdeadbeef 0x1000>; + #gpio-cells = <0x2>; + status = "okay"; + }; + + test_spi: spi@33334444 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "vnd,spi"; + reg = <0x33334444 0x1000>; + status = "okay"; + clock-frequency = <2000000>; + + /* one entry for every devices at spi.dtsi */ + cs-gpios = <&test_gpio 0 0>, + <&test_gpio 0 0>, + <&test_gpio 0 0>, + <&test_gpio 0 0>, + <&test_gpio 0 0>; + + #include "spi.dtsi" + }; + }; +}; diff --git a/tests/drivers/build_all/flash/prj.conf b/tests/drivers/build_all/flash/prj.conf new file mode 100644 index 00000000000000..bb0a72808d0670 --- /dev/null +++ b/tests/drivers/build_all/flash/prj.conf @@ -0,0 +1,2 @@ +CONFIG_FLASH=y +CONFIG_GPIO=y diff --git a/tests/drivers/build_all/flash/spi.dtsi b/tests/drivers/build_all/flash/spi.dtsi new file mode 100644 index 00000000000000..e2c36f8180cf8e --- /dev/null +++ b/tests/drivers/build_all/flash/spi.dtsi @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2024 TOKITA Hiroshi + * SPDX-License-Identifier: Apache-2.0 + */ + +at45@0 { + compatible = "atmel,at45"; + reg = <0x0>; + status = "okay"; + spi-max-frequency = <5000000>; + jedec-id = [00 11 22]; + size = <1048576>; + sector-size = <1>; + sector-0a-pages = <1>; + block-size = <1>; + page-size = <1>; +}; + +spi-nor@1 { + compatible = "jedec,spi-nor"; + reg = <0x1>; + status = "okay"; + spi-max-frequency = <5000000>; + size = <1048576>; + jedec-id = [00 11 22]; +}; diff --git a/tests/drivers/build_all/flash/src/main.c b/tests/drivers/build_all/flash/src/main.c new file mode 100644 index 00000000000000..175b9065f67781 --- /dev/null +++ b/tests/drivers/build_all/flash/src/main.c @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2024 TOKITA Hiroshi + * SPDX-License-Identifier: Apache-2.0 + */ + +int main(void) +{ + return 0; +} diff --git a/tests/drivers/build_all/flash/testcase.yaml b/tests/drivers/build_all/flash/testcase.yaml new file mode 100644 index 00000000000000..82804a97abe2b7 --- /dev/null +++ b/tests/drivers/build_all/flash/testcase.yaml @@ -0,0 +1,21 @@ +# Copyright (c) 2024 TOKITA hiroshi +# SPDX-License-Identifier: Apache-2.0 + +tests: + drivers.flash.build: + tags: + - drivers + - flash + build_only: true + platform_allow: + - native_sim + + drivers.flash.emul.build: + tags: + - drivers + - flash + build_only: true + platform_allow: + - native_sim + extra_configs: + - CONFIG_EMUL=y