Skip to content

Commit f65e644

Browse files
committed
Merge remote-tracking branch 'origin/develop' into bazel-missing-configs
2 parents f44cfce + 2376a35 commit f65e644

412 files changed

Lines changed: 16807 additions & 4018 deletions

File tree

Some content is hidden

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

.github/workflows/bazel_build.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,34 @@ jobs:
7373
path: lib/picotool
7474
- name: Other Bazel checks
7575
run: python3 tools/run_all_bazel_checks.py --program=other --picotool-dir=lib/picotool
76+
77+
bazel-9-build-check:
78+
runs-on: ubuntu-latest
79+
steps:
80+
- name: Checkout
81+
uses: actions/checkout@v4
82+
with:
83+
fetch-depth: 0
84+
- name: Get Bazel
85+
uses: bazel-contrib/setup-bazel@0.9.0
86+
with:
87+
bazelisk-cache: true
88+
disk-cache: ${{ github.workflow }}-bazel9
89+
repository-cache: true
90+
- name: Setup Python
91+
uses: actions/setup-python@v5
92+
with:
93+
python-version: '3.10'
94+
- name: Fetch latest Picotool
95+
uses: actions/checkout@v4
96+
with:
97+
repository: raspberrypi/picotool
98+
ref: develop
99+
fetch-depth: 0
100+
path: lib/picotool
101+
- name: Full Bazel build with Bazel 9
102+
env:
103+
# Use the latest released 9.x version
104+
# Ref https://github.com/bazelbuild/bazelisk/blob/master/README.md#how-does-bazelisk-know-which-bazel-version-to-run
105+
USE_BAZEL_VERSION: '9.x'
106+
run: python3 tools/run_all_bazel_checks.py --program=build --picotool-dir=lib/picotool
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Check floating-point tests
2+
3+
on:
4+
push:
5+
paths:
6+
- .github/workflows/check_float_tests.yml
7+
- tools/check_float_test_names.py
8+
- src/rp2_common/pico_float/include/pico/float.h
9+
- src/rp2_common/pico_double/include/pico/double.h
10+
- test/pico_float_test/custom_float_funcs_test.c
11+
- test/pico_float_test/custom_double_funcs_test.c
12+
pull_request:
13+
paths:
14+
- .github/workflows/check_float_tests.yml
15+
- tools/check_float_test_names.py
16+
- src/rp2_common/pico_float/include/pico/float.h
17+
- src/rp2_common/pico_double/include/pico/double.h
18+
- test/pico_float_test/custom_float_funcs_test.c
19+
- test/pico_float_test/custom_double_funcs_test.c
20+
21+
jobs:
22+
check-float-tests:
23+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
29+
- name: Check float tests
30+
run: |
31+
tools/check_float_test_names.py
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Check Memmap Annotations
2+
3+
on:
4+
push:
5+
paths:
6+
- 'src/*/pico_platform/memmap*.ld'
7+
- 'src/*/pico_platform/script_include/**'
8+
- 'src/rp2_common/pico_standard_link/script_include/**'
9+
- 'tools/memmap_annotate.py'
10+
- 'tools/memmap_include_tree.py'
11+
pull_request:
12+
paths:
13+
- 'src/*/pico_platform/memmap*.ld'
14+
- 'src/*/pico_platform/script_include/**'
15+
- 'src/rp2_common/pico_standard_link/script_include/**'
16+
- 'tools/memmap_annotate.py'
17+
- 'tools/memmap_include_tree.py'
18+
19+
jobs:
20+
check-memmap-annotations:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Check Memmap Annotations
27+
run: |
28+
tools/memmap_annotate.py --ci

MODULE.bazel

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ bazel_dep(name = "rules_python", version = "0.36.0")
99
bazel_dep(name = "picotool", version = "2.2.0")
1010
bazel_dep(name = "rules_cc", version = "0.0.10")
1111

12+
bazel_dep(name = "buildifier_prebuilt", version = "8.5.1.2", dev_dependency = True)
13+
1214
http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
1315

1416
http_archive(
@@ -99,41 +101,41 @@ http_archive(
99101
url = "https://chrome-infra-packages.appspot.com/dl/fuchsia/third_party/clang/mac-arm64/+/git_revision:910be4ff90d7d07bd4518ea03b85c0974672bf9c",
100102
)
101103

102-
new_git_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository")
104+
git_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
103105

104106
# TODO: Provide tinyusb as a proper Bazel module.
105-
new_git_repository(
107+
git_repository(
106108
name = "tinyusb",
107109
build_file = "//src/rp2_common/tinyusb:tinyusb.BUILD",
108110
commit = "86ad6e56c1700e85f1c5678607a762cfe3aa2f47", # keep-in-sync-with-submodule: lib/tinyusb
109111
remote = "https://github.com/hathach/tinyusb.git",
110112
)
111113

112114
# TODO: Provide btstack as a proper Bazel module.
113-
new_git_repository(
115+
git_repository(
114116
name = "btstack",
115117
build_file = "//src/rp2_common/pico_btstack:btstack.BUILD",
116118
commit = "420dc137399796c88b0013ee09f157046018923e", # keep-in-sync-with-submodule: lib/btstack
117119
remote = "https://github.com/bluekitchen/btstack.git",
118120
)
119121

120122
# TODO: Provide cyw43-driver as a proper Bazel module.
121-
new_git_repository(
123+
git_repository(
122124
name = "cyw43-driver",
123125
build_file = "//src/rp2_common/pico_cyw43_driver:cyw43-driver.BUILD",
124126
commit = "dd7568229f3bf7a37737b9e1ef250c26efe75b23", # keep-in-sync-with-submodule: lib/cyw43-driver
125127
remote = "https://github.com/georgerobotics/cyw43-driver.git",
126128
)
127129

128130
# TODO: Provide lwip as a proper Bazel module.
129-
new_git_repository(
131+
git_repository(
130132
name = "lwip",
131133
build_file = "//src/rp2_common/pico_lwip:lwip.BUILD",
132134
commit = "77dcd25a72509eb83f72b033d219b1d40cd8eb95", # keep-in-sync-with-submodule: lib/lwip
133135
remote = "https://github.com/lwip-tcpip/lwip.git",
134136
)
135137

136-
new_git_repository(
138+
git_repository(
137139
name = "mbedtls",
138140
build_file = "//src/rp2_common/pico_mbedtls:mbedtls.BUILD",
139141
commit = "107ea89daaefb9867ea9121002fbbdf926780e98", # keep-in-sync-with-submodule: lib/mbedtls
@@ -160,12 +162,13 @@ python.toolchain(
160162
configure_coverage_tool = True,
161163
python_version = "3.9",
162164
)
163-
164165
use_repo(python, "pythons_hub")
166+
165167
register_toolchains(
166168
"@pythons_hub//:all",
167169
dev_dependency = True,
168170
)
171+
169172
register_toolchains(
170173
"@rules_python//python/runtime_env_toolchains:all",
171174
dev_dependency = True,

REPO.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""Global settings for the Pico SDK Bazel build."""
2+
13
ignore_directories(
24
[
35
# Don't accidentally pick up external CMake deps with Bazel build files.

bazel/config/BUILD.bazel

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ string_flag(
140140
],
141141
)
142142

143-
# PICO_BAZEL_CONFIG: PICO_DEFAULT_PRINTF_IMPL, The default implementation for pico_printf to link. compiler lets the compiler control printf behavior while pico provides a pico-specific implementation, type=string, default=double, group=build
143+
# PICO_BAZEL_CONFIG: PICO_DEFAULT_PRINTF_IMPL, The default implementation for pico_printf to link. compiler lets the compiler control printf behavior while pico provides a pico-specific implementation, type=string, default=pico, group=build
144144
string_flag(
145145
name = "PICO_DEFAULT_PRINTF_IMPL",
146146
build_setting_default = "pico",
@@ -151,6 +151,17 @@ string_flag(
151151
],
152152
)
153153

154+
# PICO_BAZEL_CONFIG: PICO_DEFAULT_THREAD_LOCAL_IMPL, The default implementation for pico_thread_local to link; per_thread provides per thread locals while global provides shared global values, type=string, default=per_thread, group=build
155+
string_flag(
156+
name = "PICO_DEFAULT_THREAD_LOCAL_IMPL",
157+
build_setting_default = "per_thread",
158+
values = [
159+
"per_thread",
160+
"global",
161+
"none",
162+
],
163+
)
164+
154165
# PICO_BAZEL_CONFIG: PICO_ASYNC_CONTEXT_IMPL, The default implementation for pico_async_context to link, type=string, default=threadsafe_background, group=build
155166
string_flag(
156167
name = "PICO_ASYNC_CONTEXT_IMPL",
@@ -217,10 +228,23 @@ string_flag(
217228
build_setting_default = "Debug",
218229
)
219230

220-
# PICO_BAZEL_CONFIG: PICO_DEFAULT_LINKER_SCRIPT, [Bazel only] The library that provides a linker script to link into all binaries, default=//src/rp2_common/pico_crt0:default_linker_script, group=pico_standard_link
231+
# PICO_BAZEL_CONFIG: PICO_DEFAULT_BINARY_TYPE, The default binary type to use, type=string, default=default, group=build
232+
string_flag(
233+
name = "PICO_DEFAULT_BINARY_TYPE",
234+
build_setting_default = "default",
235+
values = [
236+
"default",
237+
"no_flash",
238+
"copy_to_ram",
239+
"blocked_ram",
240+
"xip_ram",
241+
],
242+
)
243+
244+
# PICO_BAZEL_CONFIG: PICO_DEFAULT_LINKER_SCRIPT, [Bazel only] The library that provides a linker script to link into all binaries, default=//src/rp2_common/pico_standard_link:default_linker_script, group=pico_standard_link
221245
label_flag(
222246
name = "PICO_DEFAULT_LINKER_SCRIPT",
223-
build_setting_default = "//src/rp2_common/pico_crt0:default_linker_script",
247+
build_setting_default = "//src/rp2_common/pico_standard_link:default_linker_script",
224248
)
225249

226250
# PICO_BAZEL_CONFIG: PICO_NO_TARGET_NAME, Don't define PICO_TARGET_NAME, type=bool, default=0, group=build
@@ -318,3 +342,9 @@ bool_flag(
318342
name = "PICO_COMPILATION_NO_FASTBUILD_ARGS",
319343
build_setting_default = False,
320344
)
345+
346+
# PICO_BAZEL_CONFIG: PICO_HARD_FLOAT_ABI, use hard floating point ABI, type=bool, default=0, group=build, docref=cmake-toolchain-config
347+
bool_flag(
348+
name = "PICO_HARD_FLOAT_ABI",
349+
build_setting_default = False,
350+
)

bazel/constraint/BUILD.bazel

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,16 @@ config_setting(
180180
flag_values = {"//bazel/config:PICO_DEFAULT_PRINTF_IMPL": "compiler"},
181181
)
182182

183+
config_setting(
184+
name = "pico_thread_local_per_thread_enabled",
185+
flag_values = {"//bazel/config:PICO_DEFAULT_THREAD_LOCAL_IMPL": "per_thread"},
186+
)
187+
188+
config_setting(
189+
name = "pico_thread_local_global_enabled",
190+
flag_values = {"//bazel/config:PICO_DEFAULT_THREAD_LOCAL_IMPL": "global"},
191+
)
192+
183193
config_setting(
184194
name = "pico_async_context_poll_enabled",
185195
flag_values = {"//bazel/config:PICO_ASYNC_CONTEXT_IMPL": "poll"},
@@ -273,3 +283,28 @@ config_setting(
273283
name = "pico_compilation_no_fastbuild_args_set",
274284
flag_values = {"//bazel/config:PICO_COMPILATION_NO_FASTBUILD_ARGS": "True"},
275285
)
286+
287+
config_setting(
288+
name = "pico_hard_float_abi_enabled",
289+
flag_values = {"//bazel/config:PICO_HARD_FLOAT_ABI": "True"},
290+
)
291+
292+
config_setting(
293+
name = "pico_binary_type_no_flash",
294+
flag_values = {"//bazel/config:PICO_DEFAULT_BINARY_TYPE": "no_flash"},
295+
)
296+
297+
config_setting(
298+
name = "pico_binary_type_copy_to_ram",
299+
flag_values = {"//bazel/config:PICO_DEFAULT_BINARY_TYPE": "copy_to_ram"},
300+
)
301+
302+
config_setting(
303+
name = "pico_binary_type_blocked_ram",
304+
flag_values = {"//bazel/config:PICO_DEFAULT_BINARY_TYPE": "blocked_ram"},
305+
)
306+
307+
config_setting(
308+
name = "pico_binary_type_xip_ram",
309+
flag_values = {"//bazel/config:PICO_DEFAULT_BINARY_TYPE": "xip_ram"},
310+
)

bazel/defs.bzl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""Defines common rules and macros for the Pico SDK Bazel build."""
2+
13
load("@bazel_skylib//rules:write_file.bzl", "write_file")
24
load("@rules_cc//cc:defs.bzl", "cc_library")
35
load("@rules_cc//cc/common:cc_common.bzl", "cc_common")
@@ -101,6 +103,11 @@ def pico_board_config(name, platform_includes, **kwargs):
101103
includes provided in `platform_includes`, and the final artifact is
102104
a cc_library that you can configure //bazel/config:PICO_CONFIG_HEADER to
103105
point to.
106+
107+
Args:
108+
name: The name of the rule.
109+
platform_includes: A list of platform include paths.
110+
**kwargs: Additional attributes to pass through to cc_library.
104111
"""
105112
_hdr_dir = "{}_generated_includes".format(name)
106113
_hdr_path = "{}/pico_config_platform_headers.h".format(_hdr_dir)

bazel/pico_btstack_make_gatt_header.bzl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
"""Rule to generate Bluetooth GATT header files for BTstack."""
2+
13
load("@rules_cc//cc:find_cc_toolchain.bzl", "find_cpp_toolchain", "use_cc_toolchain")
24
load("@rules_cc//cc/common:cc_common.bzl", "cc_common")
35
load("@rules_cc//cc/common:cc_info.bzl", "CcInfo")
46

57
def _pico_btstack_make_gatt_header_impl(ctx):
68
cc_toolchain = find_cpp_toolchain(ctx)
7-
feature_configuration = cc_common.configure_features(
9+
cc_common.configure_features(
810
ctx = ctx,
911
cc_toolchain = cc_toolchain,
1012
requested_features = ctx.features,

bazel/toolchain/BUILD.bazel

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,12 @@ cc_args(
4545
args = [
4646
"-mcpu=cortex-m33",
4747
"-march=armv8-m.main+fp+dsp",
48-
"-mfloat-abi=softfp",
4948
"-mthumb",
5049
"-mcmse",
51-
],
50+
] + select({
51+
"//bazel/constraint:pico_hard_float_abi_enabled": ["-mfloat-abi=hard"],
52+
"//conditions:default": ["-mfloat-abi=softfp"],
53+
}),
5254
)
5355

5456
# :no_canonical_system_headers and :no_canonical_prefixes both prevent built-in

0 commit comments

Comments
 (0)