Skip to content

Commit

Permalink
tests: drivers: build_all: Add a build_all test for flash
Browse files Browse the repository at this point in the history
The test targets the following devices at this time.

- atmel,at45
- jedec,spi-nor

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
  • Loading branch information
soburi authored and nashif committed Oct 11, 2024
1 parent 60dc055 commit eebed14
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/drivers/build_all/flash/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
37 changes: 37 additions & 0 deletions tests/drivers/build_all/flash/app.overlay
Original file line number Diff line number Diff line change
@@ -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"
};
};
};
2 changes: 2 additions & 0 deletions tests/drivers/build_all/flash/prj.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CONFIG_FLASH=y
CONFIG_GPIO=y
26 changes: 26 additions & 0 deletions tests/drivers/build_all/flash/spi.dtsi
Original file line number Diff line number Diff line change
@@ -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];
};
6 changes: 6 additions & 0 deletions tests/drivers/build_all/flash/src/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* Copyright (c) 2024 TOKITA Hiroshi
* SPDX-License-Identifier: Apache-2.0
*/

/* It is okay if main() is not included since just checking the build. */
17 changes: 17 additions & 0 deletions tests/drivers/build_all/flash/testcase.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright (c) 2024 TOKITA hiroshi
# SPDX-License-Identifier: Apache-2.0

common:
build_only: true
tags:
- drivers
- flash
tests:
drivers.flash.build:
platform_allow:
- native_sim
drivers.flash.emul.build:
platform_allow:
- native_sim
extra_configs:
- CONFIG_EMUL=y

0 comments on commit eebed14

Please sign in to comment.