File tree Expand file tree Collapse file tree 6 files changed +77
-0
lines changed
tests/lib/devicetree/api_ext Expand file tree Collapse file tree 6 files changed +77
-0
lines changed Original file line number Diff line number Diff line change 1+ # SPDX-License-Identifier: Apache-2.0
2+
3+ cmake_minimum_required (VERSION 3.20)
4+
5+ find_package (Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} )
6+ project (devicetree_extensions)
7+
8+ FILE (GLOB app_sources src/*.c)
9+ target_sources (app PRIVATE ${app_sources} )
Original file line number Diff line number Diff line change 1+ Test cases for the devicetree.h extensions (GPIO, SPI, etc).
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (c) 2021, Commonwealth Scientific and Industrial Research
3+ * Organisation (CSIRO) ABN 41 687 119 230.
4+ *
5+ * SPDX-License-Identifier: Apache-2.0
6+ *
7+ * Application overlay for testing the devicetree.h extension API's.
8+ *
9+ * Names in this file should be chosen in a way that won't conflict
10+ * with real-world devicetree nodes, to allow these tests to run on
11+ * (and be extended to test) real hardware.
12+ */
13+
14+ / {
15+ test {
16+ #address-cells = < 0x1 >;
17+ #size-cells = < 0x1 >;
18+
19+ test_sram1: sram@20000000 {
20+ compatible = "mmio-sram";
21+ reg = < 0x20000000 0x1000 >;
22+ zephyr,memory-region = "SRAM_REGION";
23+ };
24+ test_sram2: sram@20001000 {
25+ compatible = "mmio-sram";
26+ reg = < 0x20001000 0x1000 >;
27+ };
28+ };
29+ };
Original file line number Diff line number Diff line change 1+ CONFIG_ZTEST=y
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (c) 2021, Commonwealth Scientific and Industrial Research
3+ * Organisation (CSIRO) ABN 41 687 119 230.
4+ *
5+ * SPDX-License-Identifier: Apache-2.0
6+ */
7+
8+ #include <ztest.h>
9+ #include <devicetree.h>
10+ #include <device.h>
11+ #include <drivers/gpio.h>
12+
13+ #include <linker/devicetree_regions.h>
14+
15+ #define TEST_SRAM1 DT_NODELABEL(test_sram1)
16+ #define TEST_SRAM2 DT_NODELABEL(test_sram2)
17+
18+ static void test_linker_regions (void )
19+ {
20+ zassert_true (!strcmp (LINKER_DT_NODE_REGION_NAME (TEST_SRAM1 ), "SRAM_REGION" ), "" );
21+ zassert_true (!strcmp (LINKER_DT_NODE_REGION_NAME (TEST_SRAM2 ), "/test/sram@20001000" ), "" );
22+ }
23+
24+ void test_main (void )
25+ {
26+ ztest_test_suite (devicetree_api_ext ,
27+ ztest_unit_test (test_linker_regions )
28+ );
29+ ztest_run_test_suite (devicetree_api_ext );
30+ }
Original file line number Diff line number Diff line change 1+ tests :
2+ libraries.devicetree_ext :
3+ tags : devicetree
4+ # We only need this to run on one platform so use native_posix as it
5+ # will mostly likely be the fastest.
6+ integration_platforms :
7+ - native_posix
You can’t perform that action at this time.
0 commit comments