Skip to content

Commit 8e58012

Browse files
committed
Merge develop into min-vtor
2 parents d271b86 + e43b753 commit 8e58012

File tree

123 files changed

+4178
-428
lines changed

Some content is hidden

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

123 files changed

+4178
-428
lines changed
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
33
<package id="gcc-arm-embedded" version="10.2.1" />
4-
<package id="cmake" version="3.31.0" installArguments="ADD_CMAKE_TO_PATH=System" />
54
<package id="mingw" version="12.2.0" />
65
<package id="ninja" version="1.11.1" />
76
</packages>

.github/workflows/multi-gcc.yml

Lines changed: 344 additions & 78 deletions
Large diffs are not rendered by default.

.github/workflows/scripts/generate_multi_gcc_workflow.py

Lines changed: 96 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,52 @@
55
import subprocess
66
import re
77

8-
toolchain_dir = "/opt/arm"
9-
toolchains = os.listdir(toolchain_dir)
8+
toolchains = [os.path.join("/opt/arm", x) for x in os.listdir("/opt/arm")]
9+
toolchains += [os.path.join("/opt/riscv", x) for x in os.listdir("/opt/riscv")]
1010

11-
gcc_versions = OrderedDict()
11+
compilers = []
12+
class Compiler:
13+
def __init__(self, version, path, type):
14+
self.version = version
15+
self.path = path
16+
self.type = type
1217

18+
@property
19+
def gcc(self):
20+
return self.type == "GCC"
21+
22+
@property
23+
def llvm(self):
24+
return self.type == "LLVM"
25+
26+
@property
27+
def riscv(self):
28+
return "RISCV" in self.type
29+
30+
def __repr__(self):
31+
return self.version
32+
33+
seen_versions = []
1334
for toolchain in toolchains:
14-
fullpath = os.path.join(toolchain_dir, toolchain)
15-
gcc_path = os.path.join(fullpath, "bin/arm-none-eabi-gcc")
16-
version = subprocess.run([gcc_path, "--version"], capture_output=True)
35+
gcc_path = os.path.join(toolchain, "bin/arm-none-eabi-gcc")
36+
llvm_path = os.path.join(toolchain, "bin/clang")
37+
riscv_gcc_path = os.path.join(toolchain, "bin/riscv32-unknown-elf-gcc")
38+
39+
type = None
40+
path = None
41+
if os.path.exists(gcc_path):
42+
path = gcc_path
43+
type = "GCC"
44+
elif os.path.exists(llvm_path):
45+
path = llvm_path
46+
type = "LLVM"
47+
elif os.path.exists(riscv_gcc_path):
48+
path = riscv_gcc_path
49+
type = "RISCV GCC"
50+
else:
51+
raise Exception("Unknown compiler type")
52+
53+
version = subprocess.run([path, "--version"], capture_output=True)
1754
stdout = version.stdout.decode('utf-8')
1855
stderr = version.stderr.decode('utf-8')
1956
assert(len(stderr) == 0)
@@ -23,14 +60,13 @@
2360
assert(m is not None)
2461
version = m.group(1)
2562

26-
if version in gcc_versions:
27-
raise Exception("Already have version {} in versions current path {}, this path {}".format(version, gcc_versions[version], fullpath))
28-
29-
gcc_versions[version] = fullpath
63+
if version in seen_versions:
64+
raise Exception("Already have version {} in versions current path {}, this path {}".format(version, gcc_versions[version], path))
3065

31-
# Sort by major version
32-
gcc_versions_sorted = OrderedDict(sorted(gcc_versions.items(), key=lambda item: int(item[0].replace(".", ""))))
66+
compilers.append(Compiler(version, toolchain, type))
67+
seen_versions.append(version)
3368

69+
compilers_sorted = sorted(compilers, key=lambda x: int(x.version.replace(".", "")))
3470

3571
# Create output
3672
output = '''
@@ -59,14 +95,55 @@
5995
6096
- name: Checkout submodules
6197
run: git submodule update --init
98+
99+
- name: Host Release
100+
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Release -DPICO_NO_PICOTOOL=1 -DPICO_PLATFORM=host; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
101+
102+
- name: Host Debug
103+
run: cd ${{github.workspace}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE=Debug -DPICO_NO_PICOTOOL=1 -DPICO_PLATFORM=host; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)
62104
'''
63105

64-
for gcc_version, toolchain_path in gcc_versions_sorted.items():
65-
for build_type in ["Debug", "Release"]:
66-
output += "\n"
67-
output += " - name: GCC {} {}\n".format(gcc_version, build_type)
68-
output += " if: always()\n"
69-
output += " shell: bash\n"
70-
output += " run: cd ${{{{github.workspace}}}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE={} -DPICO_TOOLCHAIN_PATH={} -DPICO_BOARD=pico_w; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)\n".format(build_type, toolchain_path)
106+
platforms = []
107+
class Platform:
108+
def __init__(self, name, platform, board, minimum_gcc_version=None):
109+
self.name = name
110+
self.board = board
111+
self.platform = platform
112+
self.riscv = "riscv" in platform
113+
self.minimum_gcc_version = minimum_gcc_version
114+
115+
def cmake_string(self, compiler):
116+
opts = []
117+
# Temporary while private repo
118+
opts.append("-DPICO_NO_PICOTOOL=1")
119+
if self.board: opts.append(f"-DPICO_BOARD={self.board}")
120+
opts.append(f"-DPICO_PLATFORM={self.platform}")
121+
if compiler.llvm: opts.append("-DPICO_COMPILER=pico_arm_clang")
122+
opts.append(f"-DPICO_TOOLCHAIN_PATH={compiler.path}")
123+
return " ".join(opts)
124+
125+
def compiler_valid(self, compiler):
126+
if compiler.riscv != self.riscv:
127+
return False
128+
129+
if self.minimum_gcc_version and compiler.gcc:
130+
if int(compiler.version.split(".")[0]) < self.minimum_gcc_version:
131+
return False
71132

133+
return True
134+
135+
136+
platforms.append(Platform("Pico W", "rp2040", "pico_w"))
137+
platforms.append(Platform("RP2350", "rp2350", None, 9))
138+
platforms.append(Platform("RP2350 RISCV", "rp2350-riscv", None))
139+
140+
for compiler in compilers_sorted:
141+
for build_type in ["Debug", "Release"]:
142+
for p in platforms:
143+
if not p.compiler_valid(compiler): continue
144+
output += "\n"
145+
output += " - name: {} {} {} {}\n".format(compiler.type, compiler.version, build_type, p.name)
146+
output += " if: always()\n"
147+
output += " shell: bash\n"
148+
output += " run: cd ${{{{github.workspace}}}}; mkdir -p build; rm -rf build/*; cd build; cmake ../ -DPICO_SDK_TESTS_ENABLED=1 -DCMAKE_BUILD_TYPE={} {}; make --output-sync=target --no-builtin-rules --no-builtin-variables -j$(nproc)\n".format(build_type, p.cmake_string(compiler))
72149
print(output)

MODULE.bazel

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

66
bazel_dep(name = "platforms", version = "0.0.9")
77
bazel_dep(name = "bazel_skylib", version = "1.6.1")
88
bazel_dep(name = "rules_python", version = "0.36.0")
9-
bazel_dep(name = "picotool", version = "2.1.0")
9+
bazel_dep(name = "picotool", version = "2.1.1")
1010
bazel_dep(name = "rules_cc", version = "0.0.10")
1111

1212
http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
@@ -54,34 +54,34 @@ http_archive(
5454
http_archive(
5555
name = "clang_linux-x86_64",
5656
build_file = "//bazel/toolchain:clang.BUILD",
57-
sha256 = "dd4b3b0fc7186a4da2b52796b251e0757aefac4813f9f635982954fec3337d2e",
57+
sha256 = "82302f8f0d9cb1062e60756147403c1525e965e1d7b777fab8076c74c7a5a19b",
5858
type = "zip",
59-
url = "https://chrome-infra-packages.appspot.com/dl/fuchsia/third_party/clang/linux-amd64/+/git_revision:9d3f9f47e6e630b8308562297757e0911be03a18",
59+
url = "https://chrome-infra-packages.appspot.com/dl/fuchsia/third_party/clang/linux-amd64/+/git_revision:910be4ff90d7d07bd4518ea03b85c0974672bf9c",
6060
)
6161

6262
http_archive(
6363
name = "clang_win-x86_64",
6464
build_file = "//bazel/toolchain:clang.BUILD",
65-
sha256 = "21092395df915ee5a899a832a592b137c9ea07fbc91e49ac6069ea0083d31899",
65+
sha256 = "2e9b8ac889838754e5305b6fd73c7bba7a6ec7364f1ce8ac60268b6d3bc61e6c",
6666
type = "zip",
6767
# Windows doesn't like `:` in the produced filename, so replace it with `%3A`.
68-
url = "https://chrome-infra-packages.appspot.com/dl/fuchsia/third_party/clang/windows-amd64/+/git_revision:9d3f9f47e6e630b8308562297757e0911be03a18".replace("git_revision:", "git_revision%3A"),
68+
url = "https://chrome-infra-packages.appspot.com/dl/fuchsia/third_party/clang/windows-amd64/+/git_revision:910be4ff90d7d07bd4518ea03b85c0974672bf9c".replace("git_revision:", "git_revision%3A"),
6969
)
7070

7171
http_archive(
7272
name = "clang_mac-x86_64",
7373
build_file = "//bazel/toolchain:clang.BUILD",
74-
sha256 = "bb397fdce21d068ea40fefa9618993baa4907a248f996f18316c8fa6ca24dee2",
74+
sha256 = "d3f2ef6f391ef66141092cfdf07facd18d2587a25616e1251e6e6b13b05ab3df",
7575
type = "zip",
76-
url = "https://chrome-infra-packages.appspot.com/dl/fuchsia/third_party/clang/mac-amd64/+/git_revision:9d3f9f47e6e630b8308562297757e0911be03a18",
76+
url = "https://chrome-infra-packages.appspot.com/dl/fuchsia/third_party/clang/mac-amd64/+/git_revision:910be4ff90d7d07bd4518ea03b85c0974672bf9c",
7777
)
7878

7979
http_archive(
8080
name = "clang_mac-aarch64",
8181
build_file = "//bazel/toolchain:clang.BUILD",
82-
sha256 = "dad5583f96eabc913c1930d923c53a105d6ed73f56ca32451ea79ad70e495b0f",
82+
sha256 = "61109b8464e9213ef8b9bfe55ce56298b94d4c66eaea308cf2b6556b0b85429e",
8383
type = "zip",
84-
url = "https://chrome-infra-packages.appspot.com/dl/fuchsia/third_party/clang/mac-arm64/+/git_revision:9d3f9f47e6e630b8308562297757e0911be03a18",
84+
url = "https://chrome-infra-packages.appspot.com/dl/fuchsia/third_party/clang/mac-arm64/+/git_revision:910be4ff90d7d07bd4518ea03b85c0974672bf9c",
8585
)
8686

8787
new_git_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository")
@@ -90,15 +90,15 @@ new_git_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:git.bzl"
9090
new_git_repository(
9191
name = "tinyusb",
9292
build_file = "//src/rp2_common/tinyusb:tinyusb.BUILD",
93-
commit = "5217cee5de4cd555018da90f9f1bcc87fb1c1d3a", # keep-in-sync-with-submodule: lib/tinyusb
93+
commit = "86ad6e56c1700e85f1c5678607a762cfe3aa2f47", # keep-in-sync-with-submodule: lib/tinyusb
9494
remote = "https://github.com/hathach/tinyusb.git",
9595
)
9696

9797
# TODO: Provide btstack as a proper Bazel module.
9898
new_git_repository(
9999
name = "btstack",
100100
build_file = "//src/rp2_common/pico_btstack:btstack.BUILD",
101-
commit = "2b49e57bd1fae85ac32ac1f41cdb7c794de335f6", # keep-in-sync-with-submodule: lib/btstack
101+
commit = "501e6d2b86e6c92bfb9c390bcf55709938e25ac1", # keep-in-sync-with-submodule: lib/btstack
102102
remote = "https://github.com/bluekitchen/btstack.git",
103103
)
104104

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ instructions for other platforms, and just in general, we recommend you see [Ras
184184
185185
When building for a board other than the Raspberry Pi Pico, you should pass `-DPICO_BOARD=board_name` to the `cmake` command above, e.g. `cmake -DPICO_BOARD=pico2 ..` or `cmake -DPICO_BOARD=pico_w ..` to configure the SDK and build options accordingly for that particular board.
186186
187-
Specifying `PICO_BOARD=<booardname>` sets up various compiler defines (e.g. default pin numbers for UART and other hardware) and in certain
187+
Specifying `PICO_BOARD=<boardname>` sets up various compiler defines (e.g. default pin numbers for UART and other hardware) and in certain
188188
cases also enables the use of additional libraries (e.g. wireless support when building for `PICO_BOARD=pico_w`) which cannot
189189
be built without a board which provides the requisite hardware functionality.
190190

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

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 "")

cmake/preload/toolchains/pico_arm_clang_arm.cmake

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# NOTE: THIS IS A WIP ONLY PICO_ARM_GCC IS CURRENTLY SUPPORTED
2-
# todo there is probably a more "cmake" way of doing this going thru the standard path with our "PICO" platform
31
# i.e. CMake<Lang>Information and whatnot
42
include(${CMAKE_CURRENT_LIST_DIR}/util/find_compiler.cmake)
53

cmake/preload/toolchains/pico_arm_cortex_m33_clang.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ set(CMAKE_SYSTEM_PROCESSOR cortex-m33)
44
set(PICO_CLANG_RUNTIMES armv8m.main_soft_nofp armv8m.main-unknown-none-eabi)
55

66
set(PICO_COMMON_LANG_FLAGS "-mcpu=cortex-m33 --target=armv8m.main-none-eabi -mfloat-abi=softfp -march=armv8m.main+fp+dsp")
7-
7+
set(PICO_DISASM_OBJDUMP_ARGS --mcpu=cortex-m33 --arch=armv8m.main+fp+dsp)
88
include(${CMAKE_CURRENT_LIST_DIR}/util/pico_arm_clang_common.cmake)

external/pico_sdk_import.cmake

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,28 @@
33
# This can be dropped into an external project to help locate this SDK
44
# It should be include()ed prior to project()
55

6+
# Copyright 2020 (c) 2020 Raspberry Pi (Trading) Ltd.
7+
#
8+
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
9+
# following conditions are met:
10+
#
11+
# 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
12+
# disclaimer.
13+
#
14+
# 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
15+
# disclaimer in the documentation and/or other materials provided with the distribution.
16+
#
17+
# 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products
18+
# derived from this software without specific prior written permission.
19+
#
20+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
21+
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22+
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24+
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25+
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26+
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27+
628
if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH))
729
set(PICO_SDK_PATH $ENV{PICO_SDK_PATH})
830
message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')")

0 commit comments

Comments
 (0)