blob: 9304a23167b89bf4440976d60fbcc52b9e1034d3 [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_build:compatibility.bzl", "host_backend_alias")
load("@pigweed//targets/host_device_simulator:transition.bzl", "host_device_simulator_binary")
load("@pigweed//targets/rp2040:flash.bzl", "flash_rp2040")
load("//targets/rp2:binary.bzl", "rp2040_binary", "rp2350_binary")
load("//tools:tools.bzl", "sense_device_console", "sense_host_console")
package(default_visibility = ["//visibility:public"])
cc_binary(
name = "production",
srcs = ["main.cc"],
deps = [
"//modules/air_sensor:service",
"//modules/board:service",
"//modules/event_timers",
"//modules/morse_code:encoder",
"//modules/proximity:manager",
"//modules/pubsub:service",
"//modules/state_manager",
"//modules/state_manager:service",
"//system:pubsub",
"//system:worker",
"//system",
":threads",
"@pigweed//pw_assert:check",
"@pigweed//pw_log",
"@pigweed//pw_system:async",
"@pigweed//pw_thread:thread",
"//modules/sampling_thread",
# 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",
],
)
cc_library(
name = "threads_headers",
hdrs = ["threads.h"],
deps = ["@pigweed//pw_thread:thread"],
)
label_flag(
name = "threads",
build_setting_default = ":unspecified_backend",
)
host_backend_alias(
name = "unspecified_backend",
backend = "//targets/host:production_app_threads",
)
# Create an rp2040 flashable ELF
rp2040_binary(
name = "rp2040.elf",
binary = ":production",
)
# Create an rp2350 flashable ELF
rp2350_binary(
name = "rp2350.elf",
binary = ":production",
)
# Create a host binary using the Pigweed upstream pw_system host_device_simulator.
host_device_simulator_binary(
name = "simulator",
binary = ":production",
)
sense_host_console(
name = "simulator_console",
binary = ":simulator",
)
sense_host_console(
name = "simulator_webconsole",
binary = ":simulator",
extra_args = ["--browser"],
)
sense_device_console(
name = "rp2040_console",
binary = ":rp2040.elf",
)
sense_device_console(
name = "rp2040_webconsole",
binary = ":rp2040.elf",
extra_args = ["--browser"],
)
sense_device_console(
name = "rp2350_console",
binary = ":rp2350.elf",
)
sense_device_console(
name = "rp2350_webconsole",
binary = ":rp2350.elf",
extra_args = ["--browser"],
)
alias(
name = "flash",
actual = ":flash_rp2040",
)
flash_rp2040(
name = "flash_rp2040",
rp2040_binary = "rp2040.elf",
)
# Note: Despite the name, the rule works for the 2350.
flash_rp2040(
name = "flash_rp2350",
rp2040_binary = "rp2350.elf",
)