xref: /aosp_15_r20/external/pigweed/targets/rp2040/py/BUILD.bazel (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1# Copyright 2024 The Pigweed Authors
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4# use this file except in compliance with the License. You may obtain a copy of
5# the License at
6#
7#     https://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations under
13# the License.
14
15load("@rules_platform//platform_data:defs.bzl", "platform_data")
16load("@rules_python//python:defs.bzl", "py_library")
17load("//pw_build:python.bzl", "pw_py_binary")
18
19package(default_visibility = ["//visibility:public"])
20
21pw_py_binary(
22    name = "flash",
23    srcs = [
24        "rp2040_utils/flasher.py",
25    ],
26    main = "rp2040_utils/flasher.py",
27    tags = ["manual"],
28    deps = [
29        ":rp2040_utils",
30        "@rules_python//python/runfiles",
31    ],
32)
33
34py_library(
35    name = "rp2040_utils",
36    srcs = [
37        "rp2040_utils/__init__.py",
38        "rp2040_utils/device_detector.py",
39        "rp2040_utils/flasher.py",
40        "rp2040_utils/unit_test_client.py",
41        "rp2040_utils/unit_test_server.py",
42    ],
43    data = [
44        "@libusb//:libusb_dynamic",
45        "@picotool",
46        "@probe_rs//:probe-rs",
47    ],
48    imports = ["."],
49    tags = ["manual"],
50    deps = [
51        "//pw_cli/py:pw_cli",
52        "//pw_hdlc/py:pw_hdlc",
53        "//pw_log:log_proto_py_pb2",
54        "//pw_log/py:pw_log",
55        "//pw_log_rpc/py:pw_log_rpc",
56        "//pw_system/py:pw_system_lib",
57        "//pw_tokenizer:tokenizer_proto_py_pb2",
58        "//pw_tokenizer/py:pw_tokenizer",
59        "//pw_unit_test:unit_test_py_pb2",
60        "//pw_unit_test/py:pw_unit_test",
61        "@python_packages//pyusb",
62        "@rules_python//python/runfiles",
63    ],
64)
65
66pw_py_binary(
67    name = "rpc_unit_test_runner",
68    srcs = [
69        "rp2040_utils/rpc_unit_test_runner.py",
70    ],
71    main = "rp2040_utils/rpc_unit_test_runner.py",
72    tags = ["manual"],
73    deps = [
74        ":rp2040_utils",
75    ],
76)
77
78pw_py_binary(
79    name = "unit_test_server",
80    srcs = [
81        "rp2040_utils/unit_test_server.py",
82    ],
83    data = [
84        ":rpc_unit_test_runner",
85        "//pw_target_runner/go/cmd:server",
86    ],
87    main = "rp2040_utils/unit_test_server.py",
88    tags = ["manual"],
89    deps = [
90        ":rp2040_utils",
91        "@rules_python//python/runfiles",
92    ],
93)
94
95pw_py_binary(
96    name = "_unit_test_client",
97    srcs = [
98        "rp2040_utils/unit_test_client.py",
99    ],
100    data = ["//pw_target_runner/go/cmd:client"],
101    main = "rp2040_utils/unit_test_client.py",
102    tags = ["manual"],
103    deps = [
104        ":rp2040_utils",
105        "@rules_python//python/runfiles",
106    ],
107)
108
109platform_data(
110    name = "unit_test_client",
111    platform = "@local_config_platform//:host",
112    target = ":_unit_test_client",
113)
114