Add Bazel label flag for overriding tusb_config.h (#2264)

This adds `//bazel/config:PICO_TINYUSB_CONFIG`, which is used to select
which tusb_config.h gets linked into the tinyUSB port. This defaults to
the tusb_config.h from the pico_stdio_usb (same as before), but allows
Bazel users to override this config with their own.
This commit is contained in:
Michael Brase 2025-03-18 13:41:14 -05:00 committed by GitHub
parent 6d8588d62c
commit 26e7dc5c48
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 5 deletions

View file

@ -186,6 +186,12 @@ int_flag(
build_setting_default = 0,
)
# PICO_BAZEL_CONFIG: PICO_TINYUSB_CONFIG, [Bazel only] The library that provides TinyUSB config header (e.g. tusb_config.h), default=//src/rp2_common/pico_stdio_usb:tusb_config, group=build
label_flag(
name = "PICO_TINYUSB_CONFIG",
build_setting_default = "//src/rp2_common/pico_stdio_usb:tusb_config",
)
# PICO_BAZEL_CONFIG: PICO_TINYUSB_LIB, [Bazel only] The library that provides TinyUSB, default=@tinyusb//:tinyusb, group=build
label_flag(
name = "PICO_TINYUSB_LIB",

View file

@ -24,6 +24,9 @@ cc_library(
hdrs = ["include/tusb_config.h"],
includes = ["include"],
target_compatible_with = compatible_with_rp2(),
deps = [
":pico_stdio_usb_headers",
],
)
pico_sdk_define(
@ -43,10 +46,6 @@ cc_library(
hdrs = ["include/pico/stdio_usb.h"],
includes = ["include"],
target_compatible_with = compatible_with_rp2(),
visibility = [
":__pkg__",
"//src/rp2_common/tinyusb:__pkg__",
],
deps = [
":LIB_PICO_STDIO_USB",
":PICO_STDIO_USB_CONNECT_WAIT_TIMEOUT_MS",

View file

@ -15,6 +15,7 @@ cc_library(
includes = ["include"],
target_compatible_with = compatible_with_rp2(),
deps = [
"//bazel/config:PICO_TINYUSB_CONFIG",
"//src/common/pico_binary_info",
"//src/common/pico_stdlib_headers",
"//src/common/pico_sync",
@ -30,7 +31,6 @@ cc_library(
"//src/rp2_common/pico_stdio_semihosting",
"//src/rp2_common/pico_stdio_uart",
"//src/rp2_common/pico_stdio_usb:pico_stdio_usb_headers",
"//src/rp2_common/pico_stdio_usb:tusb_config",
"//src/rp2_common/pico_unique_id",
],
)