| # Copyright 2019 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/cipd.gni") |
| import("//build/config/fuchsia/rules.gni") |
| import("//build/driver_package.gni") |
| |
| driver_module("ot-radio") { |
| output_name = "ot-radio-driver" |
| |
| sources = [ |
| "ot_radio.cc", |
| "ot_radio_tests.cc", |
| ] |
| |
| deps = [ |
| "//sdk/banjo/ddk.protocol.composite", |
| "//sdk/fidl/fuchsia.lowpan.spinel:fuchsia.lowpan.spinel_llcpp", |
| "//src/connectivity/openthread/third_party", |
| "//src/devices/lib/driver", |
| "//zircon/public/lib/async-cpp", |
| "//zircon/public/lib/async-loop-cpp", |
| "//zircon/public/lib/async-loop-default", |
| "//zircon/public/lib/ddk", |
| "//zircon/public/lib/ddktl", |
| "//zircon/public/lib/fbl", |
| "//zircon/public/lib/fidl-async-cpp", |
| "//zircon/public/lib/sync", |
| "//zircon/public/lib/zircon-internal", |
| "//zircon/public/lib/zx", |
| "//zircon/public/lib/zxtest", |
| "//zircon/system/banjo/ddk.protocol.gpio", |
| "//zircon/system/banjo/ddk.protocol.spi", |
| "//zircon/system/ulib/driver-unit-test", |
| ] |
| |
| include_dirs = |
| [ "//src/connectivity/openthread/third_party/openthread/spinel-framer" ] |
| |
| if (internal_access) { |
| sources += [ "ot_radio_bootloader.cc" ] |
| defines = [ "INTERNAL_ACCESS" ] |
| deps += [ ":version-string" ] |
| } |
| |
| configs -= [ "//build/config/fuchsia:no_cpp_standard_library" ] |
| configs += [ "//build/config/fuchsia:static_cpp_standard_library" ] |
| } |
| |
| if (internal_access) { |
| source_set("version-string") { |
| sources = [ "$target_gen_dir/ot_radio_firmware_version_string.cc" ] |
| |
| deps = [ ":gen-version-string" ] |
| } |
| |
| copy("ot-radio-firmware") { |
| sources = [ "//prebuilt/connectivity/openthread/radio-firmware/ot-ncp-app-release.bin" ] |
| outputs = [ "$root_out_dir/firmware/{{source_file_part}}" ] |
| } |
| |
| action("gen-version-string") { |
| visibility = [ ":version-string" ] |
| outputs = [ "$target_gen_dir/ot_radio_firmware_version_string.cc" ] |
| sources = [ "//prebuilt/connectivity/openthread/radio-firmware/ot-ncp-app-release.bin" ] |
| script = "gen-version-string.sh" |
| args = rebase_path(outputs, root_build_dir) + |
| rebase_path(sources, root_build_dir) |
| } |
| } |
| |
| driver_package("openthread") { |
| # Fuchsia does not yet support loading drivers out of packages. |
| |
| deps = [ ":ot-radio" ] |
| |
| drivers = [ |
| { |
| name = "ot-radio-driver.so" |
| }, |
| ] |
| |
| if (internal_access) { |
| deps += [ |
| # The copy step has to be in the shared-library toolchain to use the |
| # expected output directory, since we treat firmware blobs as if they |
| # were libraries which always use the shared-library toolchain to build. |
| ":ot-radio-firmware($shlib_toolchain)", |
| ] |
| |
| libraries = [ |
| { |
| name = "firmware/ot-ncp-app-release.bin" |
| }, |
| ] |
| } |
| } |