| # 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("@bazel_skylib//rules:native_binary.bzl", "native_binary") |
| load("@pigweed//targets/host_device_simulator:transition.bzl", "host_device_simulator_binary") |
| load("//targets:transition.bzl", "rp2040_binary") |
| |
| package(default_visibility = ["//visibility:public"]) |
| |
| cc_binary( |
| name = "badge", |
| srcs = [ |
| "heart_8x8.h", |
| "hello_my_name_is65x42.h", |
| "kudzu_isometric_text_sprite.h", |
| "main.cc", |
| "name_tag.h", |
| "pw_banner46x10.h", |
| "pw_logo5x7.h", |
| ], |
| copts = ["-Wno-unused-function"], |
| malloc = "//targets:malloc", |
| deps = [ |
| "//applications/app_common", |
| "//lib/framecounter", |
| "//lib/kudzu_imu", |
| "//lib/random", |
| "@pigweed-experimental//pw_graphics/pw_color", |
| "@pigweed-experimental//pw_graphics/pw_display", |
| "@pigweed-experimental//pw_graphics/pw_draw", |
| "@pigweed-experimental//pw_graphics/pw_framebuffer", |
| "@pigweed//pw_log", |
| "@pigweed//pw_random", |
| "@pigweed//pw_ring_buffer", |
| "@pigweed//pw_string", |
| "@pigweed//pw_sys_io", |
| "@pigweed//pw_system", |
| "@pigweed//pw_thread:thread", |
| "@thirtytwo-blit-sdk//:32blit", |
| ], |
| ) |
| |
| # Create an rp2040 flashable ELF |
| rp2040_binary( |
| name = "rp2040_badge.elf", |
| binary = ":badge", |
| ) |
| |
| # bazel run //applications/badge:rp2040_console |
| native_binary( |
| name = "rp2040_console", |
| src = "//tools:console", |
| args = [ |
| # TODO(343949763): Remove device path specification if possible. |
| "-d", |
| "/dev/ttyACM0", |
| "-b", |
| "115200", |
| "--token-databases", |
| "$(rootpath //applications/badge:rp2040_badge.elf)", |
| ], |
| data = [":rp2040_badge.elf"], |
| ) |
| |
| # Create a host binary using the Pigweed upstream pw_system host_device_simulator. |
| # This can be executed with: |
| # bazel run //applications/badge:simulator_badge |
| host_device_simulator_binary( |
| name = "simulator_badge", |
| binary = ":badge", |
| ) |
| |
| # Connect to a running badge host_device_simulator_binary with: |
| # bazel run //applications/badge:simulator_console |
| native_binary( |
| name = "simulator_console", |
| src = "//tools:console", |
| args = [ |
| "--socket", |
| "default", |
| ], |
| ) |