blob: 41c8d5505c1213ba932d7496a4db54e170ff45d3 [file] [log] [blame]
# Copyright 2024 The Pigweed Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
load(
"@pigweed//pw_protobuf_compiler:pw_proto_library.bzl",
"nanopb_proto_library",
"nanopb_rpc_proto_library",
)
load("@pigweed//targets/rp2040:flash.bzl", "flash_rp2040")
load("@rules_python//python:proto.bzl", "py_proto_library")
load("//targets/rp2:binary.bzl", "rp2040_binary", "rp2350_binary")
load("//tools:tools.bzl", "sense_device_console", "sense_device_script")
package(default_visibility = ["//visibility:public"])
cc_binary(
name = "factory",
srcs = ["main.cc"],
deps = [
"//modules/air_sensor:service",
"//modules/blinky:service",
"//modules/board:service",
"//modules/pubsub:service",
"//modules/proximity:manager",
"//system:pubsub",
"//system:worker",
"//system",
"@pigweed//pw_log",
"@pigweed//pw_system:async",
"@pigweed//pw_thread:thread",
":service",
# These should be provided by pw_system:async.
"@pigweed//pw_assert:assert_backend_impl",
"@pigweed//pw_assert:check_backend_impl",
"@pigweed//pw_log:backend_impl",
"@pigweed//pw_system:extra_platform_libs",
],
)
rp2040_binary(
name = "rp2040.elf",
binary = ":factory",
)
rp2350_binary(
name = "rp2350.elf",
binary = ":factory",
)
sense_device_console(
name = "rp2040_console",
binary = ":rp2040.elf",
)
sense_device_console(
name = "rp2350_console",
binary = ":rp2350.elf",
)
sense_device_script(
name = "rp2040_factory_test",
src = "//tools:factory",
binary = ":rp2040.elf",
)
sense_device_script(
name = "rp2350_factory_test",
src = "//tools:factory",
binary = ":rp2350.elf",
)
flash_rp2040(
name = "flash",
rp2040_binary = "rp2040.elf",
)
# Note: Despite the name, the rule works for the 2350.
flash_rp2040(
name = "flash_rp2350",
rp2040_binary = "rp2350.elf",
)
cc_library(
name = "service",
srcs = ["service.cc"],
hdrs = ["service.h"],
implementation_deps = [
"@pigweed//pw_log",
],
deps = [
":nanopb_rpc",
"//modules/air_sensor",
"//modules/board",
"//modules/buttons:manager",
"//modules/light:sensor",
"//modules/proximity:sensor",
],
)
proto_library(
name = "proto",
srcs = ["factory.proto"],
import_prefix = "factory_pb",
strip_import_prefix = "/apps/factory",
deps = [
"@pigweed//pw_protobuf:common_proto",
],
)
nanopb_proto_library(
name = "nanopb",
deps = [":proto"],
)
nanopb_rpc_proto_library(
name = "nanopb_rpc",
nanopb_proto_library_deps = [":nanopb"],
deps = [":proto"],
)
py_proto_library(
name = "py_pb2",
deps = [":proto"],
)