blob: 192cbfb4efc5e859a11c875c70573d93e69d58d4 [file] [log] [blame] [edit]
# Copyright 2023 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("@bazel_skylib//rules:native_binary.bzl", "native_binary")
load("@pigweed//pw_system/py:console.bzl", "device_console", "device_simulator_console")
load("@pigweed//targets/host_device_simulator:transition.bzl", "host_device_simulator_binary")
load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
load("//targets:transition.bzl", "rp2040_binary", "stm32_binary")
package(default_visibility = ["//visibility:public"])
cc_binary(
name = "blinky",
srcs = ["main.cc"],
deps = [
"//libraries/pw_board_led",
"@pigweed//pw_assert:check",
"@pigweed//pw_chrono:system_clock",
"@pigweed//pw_chrono:system_timer",
"@pigweed//pw_log",
"@pigweed//pw_system",
],
)
stm32_binary(
name = "stm32_blinky.elf",
binary = ":blinky",
)
rp2040_binary(
name = "rp2040_blinky.elf",
binary = ":blinky",
)
native_binary(
name = "flash_stm32",
src = "//tools:flash_device",
args = [
"--device",
"STM32-Discovery",
"$(rootpath //examples/01_blinky:stm32_blinky.elf)",
],
data = [":stm32_blinky.elf"],
)
device_console(
name = "console_stm32",
binary = ":stm32_blinky.elf",
pw_console_config = "//:pw_console_config",
script = "//tools:console",
)
device_console(
name = "console_rp2040",
binary = ":rp2040_blinky.elf",
pw_console_config = "//:pw_console_config",
script = "//tools:console",
)
# Create a host binary using the Pigweed upstream pw_system host_device_simulator.
host_device_simulator_binary(
name = "simulator_blinky",
binary = ":blinky",
)
# Start :simulator_blinky and connect to it with pw console by running:
# bazel run //examples/01_blinky:simulator_console
device_simulator_console(
name = "simulator_console",
host_binary = ":simulator_blinky",
pw_console_config = "//:pw_console_config",
script = "//tools:device_sim",
)