Skip to content

Commit 26e7dc5

Browse files
authored
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.
1 parent 6d8588d commit 26e7dc5

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

bazel/config/BUILD.bazel

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,12 @@ int_flag(
186186
build_setting_default = 0,
187187
)
188188

189+
# 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
190+
label_flag(
191+
name = "PICO_TINYUSB_CONFIG",
192+
build_setting_default = "//src/rp2_common/pico_stdio_usb:tusb_config",
193+
)
194+
189195
# PICO_BAZEL_CONFIG: PICO_TINYUSB_LIB, [Bazel only] The library that provides TinyUSB, default=@tinyusb//:tinyusb, group=build
190196
label_flag(
191197
name = "PICO_TINYUSB_LIB",

src/rp2_common/pico_stdio_usb/BUILD.bazel

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ cc_library(
2424
hdrs = ["include/tusb_config.h"],
2525
includes = ["include"],
2626
target_compatible_with = compatible_with_rp2(),
27+
deps = [
28+
":pico_stdio_usb_headers",
29+
],
2730
)
2831

2932
pico_sdk_define(
@@ -43,10 +46,6 @@ cc_library(
4346
hdrs = ["include/pico/stdio_usb.h"],
4447
includes = ["include"],
4548
target_compatible_with = compatible_with_rp2(),
46-
visibility = [
47-
":__pkg__",
48-
"//src/rp2_common/tinyusb:__pkg__",
49-
],
5049
deps = [
5150
":LIB_PICO_STDIO_USB",
5251
":PICO_STDIO_USB_CONNECT_WAIT_TIMEOUT_MS",

src/rp2_common/tinyusb/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ cc_library(
1515
includes = ["include"],
1616
target_compatible_with = compatible_with_rp2(),
1717
deps = [
18+
"//bazel/config:PICO_TINYUSB_CONFIG",
1819
"//src/common/pico_binary_info",
1920
"//src/common/pico_stdlib_headers",
2021
"//src/common/pico_sync",
@@ -30,7 +31,6 @@ cc_library(
3031
"//src/rp2_common/pico_stdio_semihosting",
3132
"//src/rp2_common/pico_stdio_uart",
3233
"//src/rp2_common/pico_stdio_usb:pico_stdio_usb_headers",
33-
"//src/rp2_common/pico_stdio_usb:tusb_config",
3434
"//src/rp2_common/pico_unique_id",
3535
],
3636
)

0 commit comments

Comments
 (0)