From 52283fb3cd79be23f3a4e5e9b4ec1ba91dc574ea Mon Sep 17 00:00:00 2001 From: Michael Bauer Date: Tue, 11 Nov 2025 19:39:24 -0800 Subject: [PATCH 1/2] Add bazel target for picocan and binary for it --- src/picocan/BUILD | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/picocan/BUILD diff --git a/src/picocan/BUILD b/src/picocan/BUILD new file mode 100644 index 0000000..d0c2a8b --- /dev/null +++ b/src/picocan/BUILD @@ -0,0 +1,35 @@ +load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") + +cc_library( + name = "picocan", + srcs = [ + "app.c", + "drv_canfdspi_api.c", + "drv_spi.c", + "led.c", + ], + hdrs = [ + "app.h", + "common.h", + "drv_canfdspi_api.h", + "drv_canfdspi_defines.h", + "drv_canfdspi_register.h", + "drv_spi.h", + "led.h", + ], + copts = ["-DMCP25xxFD"], + deps = [ + "@pico-sdk//src/rp2_common/hardware_i2c", + "@pico-sdk//src/rp2_common/hardware_spi", + "@pico-sdk//src/rp2_common/pico_stdio_usb", + "@pico-sdk//src/rp2_common/pico_stdlib", + ], +) + +cc_binary( + name = "picocan_main.elf", + srcs = ["main.c"], + deps = [ + ":picocan", + ], +) From 237d92f460067841e0e424deb3168b1dfc4b193c Mon Sep 17 00:00:00 2001 From: Michael Bauer Date: Tue, 11 Nov 2025 21:16:18 -0800 Subject: [PATCH 2/2] Fix usb printing --- .bazelrc | 2 ++ src/picocan/BUILD | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.bazelrc b/.bazelrc index 81632a0..b685c72 100755 --- a/.bazelrc +++ b/.bazelrc @@ -3,3 +3,5 @@ common --enable_bzlmod=true common --incompatible_strict_action_env build --platforms=@pico-sdk//bazel/platform:rp2350 +build --@pico-sdk//bazel/config:PICO_STDIO_USB +build --no@pico-sdk//bazel/config:PICO_STDIO_UART \ No newline at end of file diff --git a/src/picocan/BUILD b/src/picocan/BUILD index d0c2a8b..3f8f7fa 100644 --- a/src/picocan/BUILD +++ b/src/picocan/BUILD @@ -17,7 +17,9 @@ cc_library( "drv_spi.h", "led.h", ], - copts = ["-DMCP25xxFD"], + defines = [ + "MCP25xxFD", + ], deps = [ "@pico-sdk//src/rp2_common/hardware_i2c", "@pico-sdk//src/rp2_common/hardware_spi",