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"],

bazel/util/transition.bzl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ kitchen_sink_test_binary = declare_transtion(
114114
attrs = {
115115
"bt_stack_config": attr.label(mandatory = True),
116116
"lwip_config": attr.label(mandatory = True),
117+
"mbedtls_config": attr.label(mandatory = True),
117118
"enable_ble": attr.bool(default = False),
118119
"enable_bt_classic": attr.bool(default = False),
119120
# This could be shared, but we don't in order to make it clearer that
@@ -127,6 +128,7 @@ kitchen_sink_test_binary = declare_transtion(
127128
"@pico-sdk//bazel/config:PICO_LWIP_CONFIG": "lwip_config",
128129
"@pico-sdk//bazel/config:PICO_BT_ENABLE_BLE": "enable_ble",
129130
"@pico-sdk//bazel/config:PICO_BT_ENABLE_CLASSIC": "enable_bt_classic",
131+
"@pico-sdk//bazel/config:PICO_MBEDTLS_CONFIG": "mbedtls_config",
130132
},
131133
)
132134

cmake/generic_board.cmake

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,22 @@ if (EXISTS ${PICO_BOARD_HEADER_FILE})
2020

2121
while(HEADER_FILE_CONTENTS)
2222
list(POP_FRONT HEADER_FILE_CONTENTS LINE)
23-
if (LINE MATCHES "^[ \t\]*//[ \t\]*pico_cmake_set[ \t\]*([a-zA-Z_][a-zA-Z0-9_]*)[ \t\]*=[ \t\]*(.*)")
23+
# pico_board_cmake_set(var, value)
24+
if (LINE MATCHES "^[ \t]*pico_board_cmake_set[ \t]*\\([ \t]*([a-zA-Z_][a-zA-Z0-9_]*)[ \t]*,[ \t]*(.*)[ \t]*\\)[ \t]*")
2425
set("${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}")
25-
endif()
26-
if (LINE MATCHES "^[ \t\]*//[ \t\]*pico_cmake_set_default[ \t\]*([a-zA-Z_][a-zA-Z0-9_]*)[ \t\]*=[ \t\]*(.*)")
26+
# pico_board_cmake_set_default(var, value)
27+
elseif (LINE MATCHES "^[ \t]*pico_board_cmake_set_default[ \t]*\\([ \t]*([a-zA-Z_][a-zA-Z0-9_]*)[ \t]*,[ \t]*(.*)[ \t]*\\)[ \t]*")
28+
if (NOT DEFINED "${CMAKE_MATCH_1}")
29+
set("${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}")
30+
else()
31+
list(APPEND PICO_BOARD_CMAKE_OVERRIDES ${CMAKE_MATCH_1})
32+
endif()
33+
# continue to support these for now
34+
# // pico_cmake_set var = value
35+
elseif (LINE MATCHES "^[ \t]*//[ \t]*pico_cmake_set[ \t]*([a-zA-Z_][a-zA-Z0-9_]*)[ \t]*=[ \t]*(.*)")
36+
set("${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}")
37+
# // pico_cmake_set_default var = value
38+
elseif (LINE MATCHES "^[ \t]*//[ \t]*pico_cmake_set_default[ \t]*([a-zA-Z_][a-zA-Z0-9_]*)[ \t]*=[ \t]*(.*)")
2739
if (NOT DEFINED "${CMAKE_MATCH_1}")
2840
set("${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}")
2941
else()

cmake/pico_pre_load_platform.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ if (PICO_PREVIOUS_PLATFORM AND NOT PICO_PREVIOUS_PLATFORM STREQUAL PICO_PLATFORM
122122
The best practice is to use separate build directories for different platforms.")
123123
endif()
124124
set(PICO_PLATFORM ${PICO_PLATFORM} CACHE STRING "PICO Build platform (e.g. rp2040, rp2350, rp2350-riscv, host)" FORCE)
125-
set(PICO_PREVIOUS_PLATFORM ${PICO_PLATFORM} CACHE STRING "Saved PICO Build platform (e.g. rp2040, rp2350, rp2350-riscv, host)" INTERNAL)
125+
set(PICO_PREVIOUS_PLATFORM ${PICO_PLATFORM} CACHE INTERNAL "Saved PICO Build platform (e.g. rp2040, rp2350, rp2350-riscv, host)")
126126

127127
# PICO_CMAKE_CONFIG: PICO_CMAKE_PRELOAD_PLATFORM_FILE, Custom CMake file to use to set up the platform environment, type=string, group=build
128128
set(PICO_CMAKE_PRELOAD_PLATFORM_FILE ${PICO_CMAKE_PRELOAD_PLATFORM_FILE} CACHE INTERNAL "")

docs/index.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@
4848
* \cond hardware_watchdog \defgroup hardware_watchdog hardware_watchdog \endcond
4949
* \cond hardware_xip_cache \defgroup hardware_xip_cache hardware_xip_cache \endcond
5050
* \cond hardware_xosc \defgroup hardware_xosc hardware_xosc \endcond
51-
* \cond hardware_powman hardware_powman
52-
* \cond hardware_hazard3 hardware_hazard3
53-
* \cond hardware_riscv hardware_riscv
51+
* \cond hardware_powman \defgroup hardware_powman hardware_powman \endcond
52+
* \cond hardware_hazard3 \defgroup hardware_hazard3 hardware_hazard3 \endcond
53+
* \cond hardware_riscv \defgroup hardware_riscv hardware_riscv \endcond
5454
5555
* @}
5656
*
@@ -80,6 +80,7 @@
8080
* \defgroup tinyusb_device tinyusb_device
8181
* \defgroup tinyusb_host tinyusb_host
8282
* \endcond
83+
* \cond pico_mbedtls \defgroup pico_mbedtls pico_mbedtls \endcond
8384
* @}
8485
*
8586
* \defgroup networking Networking Libraries

lib/lwip

Submodule lwip updated 103 files

lib/mbedtls

Submodule mbedtls updated 1568 files

pico_sdk_version.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ set(PICO_SDK_VERSION_MAJOR 2)
66
set(PICO_SDK_VERSION_MINOR 1)
77
# PICO_BUILD_DEFINE: PICO_SDK_VERSION_REVISION, SDK version revision, type=int, default=Current SDK revision, group=pico_base
88
# PICO_CMAKE_CONFIG: PICO_SDK_VERSION_REVISION, SDK version revision, type=int, default=Current SDK revision, group=pico_base
9-
set(PICO_SDK_VERSION_REVISION 1)
9+
set(PICO_SDK_VERSION_REVISION 2)
1010
# PICO_BUILD_DEFINE: PICO_SDK_VERSION_PRE_RELEASE_ID, Optional SDK pre-release version identifier, default=Current SDK pre-release identifier, type=string, group=pico_base
1111
# PICO_CMAKE_CONFIG: PICO_SDK_VERSION_PRE_RELEASE_ID, Optional SDK pre-release version identifier, default=Current SDK pre-release identifier, type=string, group=pico_base
12-
# set(PICO_SDK_VERSION_PRE_RELEASE_ID develop)
12+
set(PICO_SDK_VERSION_PRE_RELEASE_ID develop)
1313

1414
# PICO_BUILD_DEFINE: PICO_SDK_VERSION_STRING, SDK version string, type=string, default=Current SDK version string, group=pico_base
1515
# PICO_CMAKE_CONFIG: PICO_SDK_VERSION_STRING, SDK version string, type=string, default=Current SDK version string, group=pico_base

src/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ alias(
1919
"//src/rp2_common/boot_bootrom_headers:__pkg__",
2020
"//src/rp2_common/hardware_boot_lock:__pkg__",
2121
"//src/rp2_common/pico_flash:__pkg__",
22+
"//src/rp2_common/hardware_rcp:__pkg__",
2223
],
2324
)
2425

src/boards/include/boards/0xcb_helios.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
//------------------------------------------------------------------------------------------
1313
// Board definition for the 0xCB Helios
1414

15-
// pico_cmake_set PICO_PLATFORM=rp2040
16-
1715
#ifndef _BOARDS_0XCB_HELIOS_H
1816
#define _BOARDS_0XCB_HELIOS_H
1917

18+
pico_board_cmake_set(PICO_PLATFORM, rp2040)
19+
2020
// For board detection
2121
#define _0XCB_HELIOS
2222

@@ -73,7 +73,7 @@
7373
#endif
7474

7575
// board has 16M onboard flash
76-
// pico_cmake_set_default PICO_FLASH_SIZE_BYTES = (16 * 1024 * 1024)
76+
pico_board_cmake_set_default(PICO_FLASH_SIZE_BYTES, (16 * 1024 * 1024))
7777
#ifndef PICO_FLASH_SIZE_BYTES
7878
#define PICO_FLASH_SIZE_BYTES (16 * 1024 * 1024)
7979
#endif

0 commit comments

Comments
 (0)