| # Copyright 2023 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//build/bind/bind.gni") |
| import("//build/components.gni") |
| import("//build/devicetree/devicetree.gni") |
| import("//build/drivers.gni") |
| import("//build/test.gni") |
| import("//build/zbi/zbi_input.gni") |
| |
| driver_bind_rules("example-board-bind") { |
| rules = "example-board.bind" |
| header_output = "example-board-bind.h" |
| deps = [ |
| "//src/devices/bind/fuchsia.hardware.platform.bus", |
| "//src/devices/bind/fuchsia.test.platform", |
| ] |
| } |
| |
| fuchsia_driver("example-board-driver") { |
| output_name = "example-board" |
| sources = [ "example-board.cc" ] |
| deps = [ |
| ":example-board-bind", |
| "//sdk/fidl/fuchsia.boot:fuchsia.boot_cpp", |
| "//sdk/fidl/fuchsia.hardware.platform.bus:fuchsia.hardware.platform.bus_cpp_driver", |
| "//sdk/lib/driver/component/cpp:cpp", |
| "//sdk/lib/driver/devicetree", |
| "//sdk/lib/driver/runtime:driver_runtime_cpp", |
| "//src/devices/bin/driver_runtime", |
| ] |
| } |
| |
| fuchsia_driver_component("example-board") { |
| deps = [ ":example-board-driver" ] |
| info = "example-board-info.json" |
| manifest = "meta/example-board.cml" |
| } |
| |
| devicetree("example-board-dt") { |
| sources = [ "../../test-data/basic-properties.dts" ] |
| golden = "../../test-data/basic-properties.golden.dts" |
| outputs = [ "$target_out_dir/basic-properties.dtb" ] |
| } |
| |
| # Add this target to |kernel_zbi_extra_deps| to include the devicetree blob |
| # (dtb) in the kernel ZBI. Typically the bootloader will pass down the dtb. |
| # This method should only be used during board bringup. |
| zbi_input("example-board-dtb") { |
| deps = [ ":example-board-dt" ] |
| type = "devicetree" |
| sources = [ "$target_out_dir/basic-properties.dtb" ] |
| } |
| |
| test("example-board-test") { |
| sources = [ "integration-test.cc" ] |
| deps = [ |
| "//sdk/lib/driver/devicetree/testing", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| "//zircon/system/ulib/ddk-platform-defs", |
| "//zircon/system/ulib/zxtest", |
| ] |
| } |
| |
| resource("test-dtb") { |
| sources = [ "$target_out_dir/basic-properties.dtb" ] |
| outputs = [ "test-data/{{source_file_part}}" ] |
| deps = [ ":example-board-dt" ] |
| } |
| |
| fuchsia_unittest_package("example-board-test-package") { |
| package_name = "example-board-test" |
| deps = [ |
| ":example-board", |
| ":example-board-test", |
| ":test-dtb", |
| ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ ":example-board-test-package" ] |
| } |