Skip to content

Commit b2b37c5

Browse files
committed
Merge branch 'develop' of https://github.com/raspberrypi/pico-sdk into adafruit-fruit-jam
2 parents f67b678 + a9851a1 commit b2b37c5

File tree

265 files changed

+4929
-1183
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

265 files changed

+4929
-1183
lines changed

.bazelignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

.bazelrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@ common --host_per_file_copt=external/.*@-w
44

55
# Produce useful output when the build fails.
66
common --verbose_failures
7+
8+
# Silence warnings about old bazel_dep pins. Bazel 8 brings along newer ones,
9+
# but we can support Bazel 7 (for now).
10+
common --check_direct_dependencies=off

.bazelversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7.2.1
1+
8.1.0

.github/workflows/choco_packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
<packages>
33
<package id="gcc-arm-embedded" version="10.2.1" />
44
<package id="mingw" version="12.2.0" />
5-
<package id="ninja" version="1.11.1" />
5+
<package id="ninja" version="1.12.1" />
66
</packages>

.github/workflows/cmake.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
uses: actions/checkout@v4
2727

2828
- name: Checkout submodules
29-
run: git submodule update --init
29+
run: git submodule update --init --recursive
3030

3131
- name: Create Build Environment
3232
# Some projects don't allow in-source building, so create a separate build directory

MODULE.bazel

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module(
22
name = "pico-sdk",
3-
version = "2.1.1",
3+
version = "2.1.2-develop",
44
)
55

66
bazel_dep(name = "platforms", version = "0.0.9")
@@ -106,18 +106,25 @@ new_git_repository(
106106
new_git_repository(
107107
name = "cyw43-driver",
108108
build_file = "//src/rp2_common/pico_cyw43_driver:cyw43-driver.BUILD",
109-
commit = "c1075d4bc440422cf2b2fd12c64a1f53f77660ee", # keep-in-sync-with-submodule: lib/cyw43-driver
109+
commit = "dd7568229f3bf7a37737b9e1ef250c26efe75b23", # keep-in-sync-with-submodule: lib/cyw43-driver
110110
remote = "https://github.com/georgerobotics/cyw43-driver.git",
111111
)
112112

113113
# TODO: Provide lwip as a proper Bazel module.
114114
new_git_repository(
115115
name = "lwip",
116116
build_file = "//src/rp2_common/pico_lwip:lwip.BUILD",
117-
commit = "0a0452b2c39bdd91e252aef045c115f88f6ca773", # keep-in-sync-with-submodule: lib/lwip
117+
commit = "77dcd25a72509eb83f72b033d219b1d40cd8eb95", # keep-in-sync-with-submodule: lib/lwip
118118
remote = "https://github.com/lwip-tcpip/lwip.git",
119119
)
120120

121+
new_git_repository(
122+
name = "mbedtls",
123+
build_file = "//src/rp2_common/pico_mbedtls:mbedtls.BUILD",
124+
commit = "107ea89daaefb9867ea9121002fbbdf926780e98", # keep-in-sync-with-submodule: lib/mbedtls
125+
remote = "https://github.com/Mbed-TLS/mbedtls.git",
126+
)
127+
121128
register_toolchains(
122129
"//bazel/toolchain:linux-aarch64-rp2040",
123130
"//bazel/toolchain:linux-aarch64-rp2350",

REPO.bazel

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
ignore_directories(
2+
[
3+
# Don't accidentally pick up external CMake deps with Bazel build files.
4+
"cmake-*",
5+
"build",
6+
"build-*",
7+
# Don't treat submodules as part of this project.
8+
"lib",
9+
],
10+
)

bazel/config/BUILD.bazel

Lines changed: 30 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",
@@ -288,3 +294,27 @@ label_flag(
288294
name = "PICO_FREERTOS_LIB",
289295
build_setting_default = "//bazel:empty_cc_lib",
290296
)
297+
298+
# PICO_BAZEL_CONFIG: PICO_MBEDTL_CONFIG, [Bazel only] The cc_library that provides mbedtls_config.h, default=//bazel:empty_cc_lib, group=pico_mbedtls
299+
label_flag(
300+
name = "PICO_MBEDTLS_CONFIG",
301+
build_setting_default = "//bazel:empty_cc_lib",
302+
)
303+
304+
# PICO_BAZEL_CONFIG: PICO_COMPILATION_NO_OPT_ARGS, Makes the opt compilation mode a no-op so custom optimization arguments can be injected via the --copt flag instead, type=bool, default=0, group=build
305+
bool_flag(
306+
name = "PICO_COMPILATION_NO_OPT_ARGS",
307+
build_setting_default = False,
308+
)
309+
310+
# PICO_BAZEL_CONFIG: PICO_COMPILATION_NO_DEBUG_ARGS, Makes the debug compilation mode a no-op so custom debug arguments can be injected via the --copt flag instead, type=bool, default=0, group=build
311+
bool_flag(
312+
name = "PICO_COMPILATION_NO_DEBUG_ARGS",
313+
build_setting_default = False,
314+
)
315+
316+
# PICO_BAZEL_CONFIG: PICO_COMPILATION_NO_FASTBUILD_ARGS, Makes the fastbuild compilation mode a no-op so custom fastbuild arguments can be injected via the --copt flag instead, type=bool, default=0, group=build
317+
bool_flag(
318+
name = "PICO_COMPILATION_NO_FASTBUILD_ARGS",
319+
build_setting_default = False,
320+
)

bazel/constraint/BUILD.bazel

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,3 +252,24 @@ label_flag_matches(
252252
flag = "//bazel/config:PICO_FREERTOS_LIB",
253253
value = "//bazel:empty_cc_lib",
254254
)
255+
256+
label_flag_matches(
257+
name = "pico_mbedtls_config_unset",
258+
flag = "//bazel/config:PICO_MBEDTLS_CONFIG",
259+
value = "//bazel:empty_cc_lib",
260+
)
261+
262+
config_setting(
263+
name = "pico_compilation_no_opt_args_set",
264+
flag_values = {"//bazel/config:PICO_COMPILATION_NO_OPT_ARGS": "True"},
265+
)
266+
267+
config_setting(
268+
name = "pico_compilation_no_debug_args_set",
269+
flag_values = {"//bazel/config:PICO_COMPILATION_NO_DEBUG_ARGS": "True"},
270+
)
271+
272+
config_setting(
273+
name = "pico_compilation_no_fastbuild_args_set",
274+
flag_values = {"//bazel/config:PICO_COMPILATION_NO_FASTBUILD_ARGS": "True"},
275+
)

bazel/toolchain/BUILD.bazel

Lines changed: 55 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,46 @@ cc_args(
8989
)
9090

9191
cc_args(
92-
name = "opt_debug_args",
92+
name = "debug_args",
9393
actions = [
9494
"@rules_cc//cc/toolchains/actions:compile_actions",
9595
"@rules_cc//cc/toolchains/actions:link_actions",
9696
],
97-
args = [
98-
"-Og", # TODO: Make this configurable.
99-
"-g3",
97+
args = select({
98+
"//bazel/constraint:pico_compilation_no_debug_args_set": [],
99+
"//conditions:default": [
100+
"-Og",
101+
"-g3",
102+
],
103+
})
104+
)
105+
106+
cc_args(
107+
name = "opt_args",
108+
actions = [
109+
"@rules_cc//cc/toolchains/actions:compile_actions",
110+
"@rules_cc//cc/toolchains/actions:link_actions",
111+
],
112+
args = select({
113+
"//bazel/constraint:pico_compilation_no_opt_args_set": [],
114+
"//conditions:default": [
115+
"-O2",
116+
"-DNDEBUG",
117+
],
118+
})
119+
)
120+
121+
cc_args(
122+
name = "fastbuild_args",
123+
actions = [
124+
"@rules_cc//cc/toolchains/actions:compile_actions",
125+
"@rules_cc//cc/toolchains/actions:link_actions",
100126
],
127+
args = select({
128+
"//bazel/constraint:pico_compilation_no_fastbuild_args_set": [],
129+
# The conditions default are kept as nothing here, The bazel docs default are -gmlt -Wl,-S.
130+
"//conditions:default": [],
131+
})
101132
)
102133

103134
configurable_toolchain_feature(
@@ -132,18 +163,25 @@ configurable_toolchain_feature(
132163
linkopts = ["-Wl,-z,max-page-size=4096"],
133164
)
134165

135-
# TODO: Make this shim unnecessary.
136-
cc_args_list(
137-
name = "all_opt_debug_args",
138-
args = [":opt_debug_args"],
139-
)
140166

141167
cc_feature(
142-
name = "override_debug",
143-
args = [":all_opt_debug_args"],
168+
name = "dbg",
169+
args = [":debug_args"],
144170
overrides = "@rules_cc//cc/toolchains/features:dbg",
145171
)
146172

173+
cc_feature(
174+
name = "opt",
175+
args = [":opt_args"],
176+
overrides = "@rules_cc//cc/toolchains/features:opt",
177+
)
178+
179+
cc_feature(
180+
name = "fastbuild",
181+
args = [":fastbuild_args"],
182+
overrides = "@rules_cc//cc/toolchains/features:fastbuild",
183+
)
184+
147185
HOSTS = (
148186
("linux", "x86_64"),
149187
("linux", "aarch64"),
@@ -180,7 +218,9 @@ _HOST_CPU_CONSTRAINTS = {
180218
tags = ["manual"], # Don't try to build this in wildcard builds.
181219
known_features = [
182220
"@rules_cc//cc/toolchains/args:experimental_replace_legacy_action_config_features",
183-
"@pico-sdk//bazel/toolchain:override_debug",
221+
"@pico-sdk//bazel/toolchain:dbg",
222+
"@pico-sdk//bazel/toolchain:opt",
223+
"@pico-sdk//bazel/toolchain:fastbuild",
184224
"@pico-sdk//bazel/toolchain:gc_sections",
185225
"@pico-sdk//bazel/toolchain:cxx_no_exceptions",
186226
"@pico-sdk//bazel/toolchain:cxx_no_rtti",
@@ -189,7 +229,6 @@ _HOST_CPU_CONSTRAINTS = {
189229
],
190230
enabled_features = [
191231
"@rules_cc//cc/toolchains/args:experimental_replace_legacy_action_config_features",
192-
"@pico-sdk//bazel/toolchain:override_debug",
193232
] + select({
194233
"//bazel/constraint:pico_no_gc_sections_enabled": [],
195234
"//conditions:default": [":gc_sections"],
@@ -232,7 +271,9 @@ _HOST_CPU_CONSTRAINTS = {
232271
tags = ["manual"], # Don't try to build this in wildcard builds.
233272
known_features = [
234273
"@rules_cc//cc/toolchains/args:experimental_replace_legacy_action_config_features",
235-
"@pico-sdk//bazel/toolchain:override_debug",
274+
"@pico-sdk//bazel/toolchain:dbg",
275+
"@pico-sdk//bazel/toolchain:opt",
276+
"@pico-sdk//bazel/toolchain:fastbuild",
236277
"@pico-sdk//bazel/toolchain:gc_sections",
237278
"@pico-sdk//bazel/toolchain:cxx_no_exceptions",
238279
"@pico-sdk//bazel/toolchain:cxx_no_rtti",
@@ -241,7 +282,6 @@ _HOST_CPU_CONSTRAINTS = {
241282
],
242283
enabled_features = [
243284
"@rules_cc//cc/toolchains/args:experimental_replace_legacy_action_config_features",
244-
"@pico-sdk//bazel/toolchain:override_debug",
245285
] + select({
246286
"//bazel/constraint:pico_no_gc_sections_enabled": [],
247287
"//conditions:default": [":gc_sections"],

0 commit comments

Comments
 (0)