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( 20 default_visibility = ["//visibility:public"], 21 features = ["-layering_check"], 22) 23 24pw_py_binary( 25 name = "flash", 26 srcs = [ 27 "rp2040_utils/flasher.py", 28 ], 29 main = "rp2040_utils/flasher.py", 30 tags = ["manual"], 31 deps = [ 32 ":rp2040_utils", 33 "@rules_python//python/runfiles", 34 ], 35) 36 37py_library( 38 name = "rp2040_utils", 39 srcs = [ 40 "rp2040_utils/__init__.py", 41 "rp2040_utils/device_detector.py", 42 "rp2040_utils/flasher.py", 43 "rp2040_utils/unit_test_client.py", 44 "rp2040_utils/unit_test_server.py", 45 ], 46 data = [ 47 "@libusb//:libusb_dynamic", 48 "@picotool", 49 "@probe_rs//:probe-rs", 50 ], 51 imports = ["."], 52 tags = ["manual"], 53 deps = [ 54 "//pw_cli/py:pw_cli", 55 "//pw_hdlc/py:pw_hdlc", 56 "//pw_log:log_proto_py_pb2", 57 "//pw_log/py:pw_log", 58 "//pw_log_rpc/py:pw_log_rpc", 59 "//pw_system/py:pw_system_lib", 60 "//pw_tokenizer:tokenizer_proto_py_pb2", 61 "//pw_tokenizer/py:pw_tokenizer", 62 "//pw_unit_test:unit_test_py_pb2", 63 "//pw_unit_test/py:pw_unit_test", 64 "@python_packages//pyusb", 65 "@rules_python//python/runfiles", 66 ], 67) 68 69pw_py_binary( 70 name = "rpc_unit_test_runner", 71 srcs = [ 72 "rp2040_utils/rpc_unit_test_runner.py", 73 ], 74 main = "rp2040_utils/rpc_unit_test_runner.py", 75 tags = ["manual"], 76 deps = [ 77 ":rp2040_utils", 78 ], 79) 80 81pw_py_binary( 82 name = "unit_test_server", 83 srcs = [ 84 "rp2040_utils/unit_test_server.py", 85 ], 86 data = [ 87 ":rpc_unit_test_runner", 88 "//pw_target_runner/go/cmd:server", 89 ], 90 main = "rp2040_utils/unit_test_server.py", 91 tags = ["manual"], 92 deps = [ 93 ":rp2040_utils", 94 "@rules_python//python/runfiles", 95 ], 96) 97 98pw_py_binary( 99 name = "_unit_test_client", 100 srcs = [ 101 "rp2040_utils/unit_test_client.py", 102 ], 103 data = ["//pw_target_runner/go/cmd:client"], 104 main = "rp2040_utils/unit_test_client.py", 105 tags = ["manual"], 106 deps = [ 107 ":rp2040_utils", 108 "@rules_python//python/runfiles", 109 ], 110) 111 112platform_data( 113 name = "unit_test_client", 114 platform = "@local_config_platform//:host", 115 target = ":_unit_test_client", 116) 117