Skip to content

Commit efe2103

Browse files
committed
SDK 2.0.0 release
1 parent 45984e2 commit efe2103

File tree

933 files changed

+349994
-66341
lines changed

Some content is hidden

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

933 files changed

+349994
-66341
lines changed

.bazelignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Don't accidentally pick up external CMake deps with Bazel build files.
2+
build
3+
# Don't treat submodules as part of this project.
4+
lib

.bazelrc

+4
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,9 @@
22
build --incompatible_enable_cc_toolchain_resolution
33
build --@rules_cc//cc/toolchains:experimental_enable_rule_based_toolchains
44

5+
# Silence all C/C++ warnings in external code.
6+
common --per_file_copt=external/.*@-w
7+
common --host_per_file_copt=external/.*@-w
8+
59
# Produce useful output when the build fails.
610
common --verbose_failures

.bazelversion

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7.0.2
1+
7.2.1

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
cmake-*
44
.DS_Store
55
build
6+
build-*
67

78
bazel-*
89

910
# Ignore until https://github.com/bazelbuild/bazel/issues/20369 is fixed.
1011
MODULE.bazel.lock
12+
__pycache__/

CMakeLists.txt

+8
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ if (NOT TARGET _pico_sdk_inclusion_marker)
1515
pico_register_common_scope_var(PICO_C_COMPILER_IS_CLANG)
1616
pico_register_common_scope_var(PICO_C_COMPILER_IS_GNU)
1717
pico_register_common_scope_var(PICO_C_COMPILER_IS_IAR)
18+
pico_register_common_scope_var(PICO_SDK_VERSION_MAJOR)
19+
pico_register_common_scope_var(PICO_SDK_VERSION_MINOR)
20+
pico_register_common_scope_var(PICO_SDK_VERSION_REVISION)
21+
pico_register_common_scope_var(PICO_SDK_VERSION_PRE_RELEASE_ID)
22+
pico_register_common_scope_var(PICO_SDK_VERSION_STRING)
1823

1924
message("Build type is ${CMAKE_BUILD_TYPE}")
2025
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
@@ -38,6 +43,9 @@ if (NOT TARGET _pico_sdk_inclusion_marker)
3843
add_sub_list_dirs(PICO_SDK_PRE_LIST_DIRS)
3944
add_sub_list_files(PICO_SDK_PRE_LIST_FILES)
4045

46+
# needed by certain functions
47+
set(PICO_TOOLS_DIR "${CMAKE_CURRENT_LIST_DIR}/tools" CACHE INTERNAL "")
48+
4149
add_subdirectory(tools)
4250
add_subdirectory(src)
4351

MODULE.bazel

+72-29
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
module(name = "pico-sdk", version = "1.6.0-rc1")
2-
3-
bazel_dep(name = "platforms", version = "0.0.8")
1+
module(
2+
name = "pico-sdk",
3+
version = "2.0.0",
4+
)
45

6+
bazel_dep(name = "platforms", version = "0.0.9")
57
bazel_dep(name = "bazel_skylib", version = "1.6.1")
8+
bazel_dep(name = "rules_python", version = "0.22.1")
9+
bazel_dep(name = "picotool", version = "2.0.0")
610

711
# Note: rules_cc is special-cased repository; a dependency on rules_cc in a
812
# module will not ensure that the root Bazel module has that same version of
@@ -15,84 +19,123 @@ bazel_dep(name = "rules_cc", version = "0.0.9")
1519
# project's MODULE.bazel too.
1620
archive_override(
1721
module_name = "rules_cc",
18-
urls = "https://github.com/bazelbuild/rules_cc/archive/1acf5213b6170f1f0133e273cb85ede0e732048f.zip",
22+
integrity = "sha256-zdQo/pQWKdIAPKSflBxOSWZNwCbc86T7SechKZo/3Xw=",
1923
strip_prefix = "rules_cc-1acf5213b6170f1f0133e273cb85ede0e732048f",
20-
integrity = "sha256-NddP6xi6LzsIHT8bMSVJ2NtoURbN+l3xpjvmIgB6aSg=",
24+
urls = "https://github.com/bazelbuild/rules_cc/archive/1acf5213b6170f1f0133e273cb85ede0e732048f.tar.gz",
2125
)
2226

2327
http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
2428

2529
http_archive(
2630
name = "arm_gcc_linux-x86_64",
27-
url = "https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-eabi.tar.xz",
28-
strip_prefix = "arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi",
2931
build_file = "//bazel/toolchain:gcc_arm_none_eabi.BUILD",
3032
sha256 = "6cd1bbc1d9ae57312bcd169ae283153a9572bd6a8e4eeae2fedfbc33b115fdbb",
33+
strip_prefix = "arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi",
34+
url = "https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-eabi.tar.xz",
3135
)
3236

3337
http_archive(
3438
name = "arm_gcc_win-x86_64",
35-
url = "https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-mingw-w64-i686-arm-none-eabi.zip",
36-
strip_prefix = "arm-gnu-toolchain-13.2.Rel1-mingw-w64-i686-arm-none-eabi",
3739
build_file = "//bazel/toolchain:gcc_arm_none_eabi.BUILD",
3840
sha256 = "51d933f00578aa28016c5e3c84f94403274ea7915539f8e56c13e2196437d18f",
41+
strip_prefix = "arm-gnu-toolchain-13.2.Rel1-mingw-w64-i686-arm-none-eabi",
42+
url = "https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-mingw-w64-i686-arm-none-eabi.zip",
3943
)
4044

4145
http_archive(
4246
name = "arm_gcc_mac-x86_64",
43-
url = "https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-darwin-x86_64-arm-none-eabi.tar.xz",
44-
strip_prefix = "arm-gnu-toolchain-13.2.Rel1-darwin-x86_64-arm-none-eabi",
4547
build_file = "//bazel/toolchain:gcc_arm_none_eabi.BUILD",
4648
sha256 = "075faa4f3e8eb45e59144858202351a28706f54a6ec17eedd88c9fb9412372cc",
49+
strip_prefix = "arm-gnu-toolchain-13.2.Rel1-darwin-x86_64-arm-none-eabi",
50+
url = "https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-darwin-x86_64-arm-none-eabi.tar.xz",
4751
)
4852

4953
http_archive(
5054
name = "arm_gcc_mac-aarch64",
51-
url = "https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-darwin-arm64-arm-none-eabi.tar.xz",
52-
strip_prefix = "arm-gnu-toolchain-13.2.Rel1-darwin-arm64-arm-none-eabi",
5355
build_file = "//bazel/toolchain:gcc_arm_none_eabi.BUILD",
5456
sha256 = "39c44f8af42695b7b871df42e346c09fee670ea8dfc11f17083e296ea2b0d279",
57+
strip_prefix = "arm-gnu-toolchain-13.2.Rel1-darwin-arm64-arm-none-eabi",
58+
url = "https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-darwin-arm64-arm-none-eabi.tar.xz",
59+
)
60+
61+
http_archive(
62+
name = "clang_linux-x86_64",
63+
build_file = "//bazel/toolchain:clang.BUILD",
64+
sha256 = "e12ee0db9226f5b4a4400c5eb2c0f757d7056181b651622b5453acb00105fd87",
65+
type = "zip",
66+
url = "https://chrome-infra-packages.appspot.com/dl/fuchsia/third_party/clang/linux-amd64/+/git_revision:248c53429427034f45705af60d47f3b1090c4799",
67+
)
68+
69+
http_archive(
70+
name = "clang_win-x86_64",
71+
build_file = "//bazel/toolchain:clang.BUILD",
72+
sha256 = "8c41e8b507f4dfede80842f98a716cac209f552064088fa1b7f4c64a1e547534",
73+
type = "zip",
74+
# Windows doesn't like `:` in the produced filename, so replace it with `%3A`.
75+
url = "https://chrome-infra-packages.appspot.com/dl/fuchsia/third_party/clang/windows-amd64/+/git_revision:248c53429427034f45705af60d47f3b1090c4799".replace("git_revision:", "git_revision%3A"),
76+
)
77+
78+
http_archive(
79+
name = "clang_mac-x86_64",
80+
build_file = "//bazel/toolchain:clang.BUILD",
81+
sha256 = "1d92f52609d3c1e958fd56f5e9a68ab99b2042ddcc6e90a5eb5009cf7ac4897d",
82+
type = "zip",
83+
url = "https://chrome-infra-packages.appspot.com/dl/fuchsia/third_party/clang/mac-amd64/+/git_revision:248c53429427034f45705af60d47f3b1090c4799",
84+
)
85+
86+
http_archive(
87+
name = "clang_mac-aarch64",
88+
build_file = "//bazel/toolchain:clang.BUILD",
89+
sha256 = "53184680db7e0043a8fba1556c7644b8f5e6c8cdffa4436a92a8e8adb0f45b8d",
90+
type = "zip",
91+
url = "https://chrome-infra-packages.appspot.com/dl/fuchsia/third_party/clang/mac-arm64/+/git_revision:248c53429427034f45705af60d47f3b1090c4799",
5592
)
5693

5794
# TODO: Provide tinyusb as a proper Bazel module.
5895
http_archive(
5996
name = "tinyusb",
60-
url = "https://github.com/hathach/tinyusb/archive/86c416d4c0fb38432460b3e11b08b9de76941bf5.zip",
61-
strip_prefix = "tinyusb-86c416d4c0fb38432460b3e11b08b9de76941bf5",
6297
build_file = "//src/rp2_common/tinyusb:tinyusb.BUILD",
63-
sha256 = "ac57109bba00d26ffa33312d5f334990ec9a9a4d82bf890ed8b825b4610d1da2",
98+
sha256 = "d64728aef58b80d5ce3747cad133f520da46e2b7ea3aadfda0e981aba6b658b3",
99+
strip_prefix = "tinyusb-4232642899362fa5e9cf0dc59bad6f1f6d32c563",
100+
url = "https://github.com/hathach/tinyusb/archive/4232642899362fa5e9cf0dc59bad6f1f6d32c563.tar.gz",
64101
)
65102

66103
# TODO: Provide btstack as a proper Bazel module.
67104
http_archive(
68105
name = "btstack",
69-
url = "https://github.com/bluekitchen/btstack/archive/72ef1732c954d938091467961e41f4aa9b976b34.zip",
70-
strip_prefix = "btstack-72ef1732c954d938091467961e41f4aa9b976b34",
71106
build_file = "//src/rp2_common/pico_btstack:btstack.BUILD",
72-
sha256 = "f45d72b5d404dd2f8e311287de6f2ba3561fc8ae956737eeb611b277aadc2391",
107+
sha256 = "64e86d9cf82b346e743fe1d4818b9380712b17abdb3f2c3524e92464b5ef3d19",
108+
strip_prefix = "btstack-2b49e57bd1fae85ac32ac1f41cdb7c794de335f6",
109+
url = "https://github.com/bluekitchen/btstack/archive/2b49e57bd1fae85ac32ac1f41cdb7c794de335f6.tar.gz",
73110
)
74111

75112
# TODO: Provide btstack as a proper Bazel module.
76113
http_archive(
77114
name = "cyw43-driver",
78-
url = "https://github.com/georgerobotics/cyw43-driver/archive/8ef38a6d32c54f850bff8f189bdca19ded33792a.zip",
79-
strip_prefix = "cyw43-driver-8ef38a6d32c54f850bff8f189bdca19ded33792a",
80115
build_file = "//src/rp2_common/pico_cyw43_driver:cyw43-driver.BUILD",
81-
sha256 = "0b44a19ea58537ee954357606cde5ed20c3a42be77adfebb07b7c0e4740f6228",
116+
sha256 = "0fcc7707fef95dd562d5572604713266613a27caeeae2f10afeccee9592a53ce",
117+
strip_prefix = "cyw43-driver-faf36381bad1f668a30172b6336c9a970966ef4c",
118+
url = "https://github.com/georgerobotics/cyw43-driver/archive/faf36381bad1f668a30172b6336c9a970966ef4c.tar.gz",
82119
)
83120

84121
# TODO: Provide lwip as a proper Bazel module.
85122
http_archive(
86123
name = "lwip",
87-
url = "https://github.com/lwip-tcpip/lwip/archive/239918ccc173cb2c2a62f41a40fd893f57faf1d6.zip",
88-
strip_prefix = "lwip-239918ccc173cb2c2a62f41a40fd893f57faf1d6",
89124
build_file = "//src/rp2_common/pico_lwip:lwip.BUILD",
90-
sha256 = "7ee9e02f2719c0422377e1fcce5a21716ca2e2e855cca56695f9ef7cb020e5dd",
125+
sha256 = "72856d557f72911cf6826ef745c23c54822df83a474557823241164a1d1361aa",
126+
strip_prefix = "lwip-0a0452b2c39bdd91e252aef045c115f88f6ca773",
127+
url = "https://github.com/lwip-tcpip/lwip/archive/0a0452b2c39bdd91e252aef045c115f88f6ca773.tar.gz",
91128
)
92129

93130
register_toolchains(
94-
"//bazel/toolchain:arm_gcc_linux-x86_64",
95-
"//bazel/toolchain:arm_gcc_win-x86_64",
96-
"//bazel/toolchain:arm_gcc_mac-x86_64",
97-
"//bazel/toolchain:arm_gcc_mac-aarch64",
131+
"//bazel/toolchain:linux-x86_64-rp2040",
132+
"//bazel/toolchain:linux-x86_64-rp2350",
133+
"//bazel/toolchain:win-x86_64-rp2040",
134+
"//bazel/toolchain:win-x86_64-rp2350",
135+
"//bazel/toolchain:mac-x86_64-rp2040",
136+
"//bazel/toolchain:mac-x86_64-rp2350",
137+
"//bazel/toolchain:mac-aarch64-rp2040",
138+
"//bazel/toolchain:mac-aarch64-rp2350",
139+
# Require users to opt-in to the Pico SDK's toolchains.
140+
dev_dependency = True,
98141
)

README.md

+28-19
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
# Raspberry Pi Pico SDK
22

33
The Raspberry Pi Pico SDK (henceforth the SDK) provides the headers, libraries and build system
4-
necessary to write programs for the RP2040-based devices such as the Raspberry Pi Pico
4+
necessary to write programs for the RP-series microcontroller-based devices such as the Raspberry Pi Pico or Raspberry Pi Pico 2
55
in C, C++ or assembly language.
66

77
The SDK is designed to provide an API and programming environment that is familiar both to non-embedded C developers and embedded C developers alike.
88
A single program runs on the device at a time and starts with a conventional `main()` method. Standard C/C++ libraries are supported along with
9-
C level libraries/APIs for accessing all of the RP2040's hardware include PIO (Programmable IO).
9+
C-level libraries/APIs for accessing all of the RP-series microcontroller's hardware including PIO (Programmable IO).
1010

11-
Additionally the SDK provides higher level libraries for dealing with timers, synchronization, USB (TinyUSB) and multi-core programming
12-
along with various utilities.
11+
Additionally, the SDK provides higher level libraries for dealing with timers, synchronization, Wi-Fi and Bluetooth networking, USB and multicore programming. These libraries should be comprehensive enough that your application code rarely, if at all, needs to access hardware registers directly. However, if you do need or prefer to access the raw hardware registers, you will also find complete and fully-commented register definition headers in the SDK. There's no need to look up addresses in the datasheet.
1312

14-
The SDK can be used to build anything from simple applications, to fully fledged runtime environments such as MicroPython, to low level software
15-
such as RP2040's on-chip bootrom itself.
13+
The SDK can be used to build anything from simple applications, fully-fledged runtime environments such as MicroPython, to low level software
14+
such as the RP-series microcontroller's on-chip bootrom itself.
15+
16+
The design goal for entire SDK is to be simple but powerful.
1617

1718
Additional libraries/APIs that are not yet ready for inclusion in the SDK can be found in [pico-extras](https://github.com/raspberrypi/pico-extras).
1819

1920
# Documentation
2021

21-
See [Getting Started with the Raspberry Pi Pico](https://rptl.io/pico-get-started) for information on how to setup your
22-
hardware, IDE/environment and for how to build and debug software for the Raspberry Pi Pico
23-
and other RP2040-based devices.
22+
See [Getting Started with the Raspberry Pi Pico-Series](https://rptl.io/pico-get-started) for information on how to setup your
23+
hardware, IDE/environment and how to build and debug software for the Raspberry Pi Pico and other RP-series microcontroller based devices.
2424

2525
See [Connecting to the Internet with Raspberry Pi Pico W](https://rptl.io/picow-connect) to learn more about writing
2626
applications for your Raspberry Pi Pico W that connect to the internet.
2727

28-
See [Raspberry Pi Pico C/C++ SDK](https://rptl.io/pico-c-sdk) to learn more about programming using the
28+
See [Raspberry Pi Pico-Series C/C++ SDK](https://rptl.io/pico-c-sdk) to learn more about programming using the
2929
SDK, to explore more advanced features, and for complete PDF-based API documentation.
3030

3131
See [Online Raspberry Pi Pico SDK API docs](https://rptl.io/pico-doxygen) for HTML-based API documentation.
@@ -42,10 +42,16 @@ _latest stable release_ of the SDK. If you need or want to test upcoming feature
4242

4343
# Quick-start your own project
4444

45+
## Using Visual Studio Code
46+
47+
You can install the [Raspberry Pi Pico Visual Studio Code extension](https://marketplace.visualstudio.com/items?itemName=raspberry-pi.raspberry-pi-pico) in VS Code.
48+
49+
## Unix command line
50+
4551
These instructions are extremely terse, and Linux-based only. For detailed steps,
46-
instructions for other platforms, and just in general, we recommend you see [Raspberry Pi Pico C/C++ SDK](https://rptl.io/pico-c-sdk)
52+
instructions for other platforms, and just in general, we recommend you see [Raspberry Pi Pico-Series C/C++ SDK](https://rptl.io/pico-c-sdk)
4753

48-
1. Install CMake (at least version 3.13), and GCC cross compiler
54+
1. Install CMake (at least version 3.13), and a GCC cross compiler
4955
```
5056
sudo apt install cmake gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib
5157
```
@@ -137,7 +143,7 @@ instructions for other platforms, and just in general, we recommend you see [Ras
137143
# rest of your project
138144
139145
```
140-
1. Write your code (see [pico-examples](https://github.com/raspberrypi/pico-examples) or the [Raspberry Pi Pico C/C++ SDK](https://rptl.io/pico-c-sdk) documentation for more information)
146+
1. Write your code (see [pico-examples](https://github.com/raspberrypi/pico-examples) or the [Raspberry Pi Pico-Series C/C++ SDK](https://rptl.io/pico-c-sdk) documentation for more information)
141147
142148
About the simplest you can do is a single source file (e.g. hello_world.c)
143149
@@ -146,7 +152,7 @@ instructions for other platforms, and just in general, we recommend you see [Ras
146152
#include "pico/stdlib.h"
147153
148154
int main() {
149-
setup_default_uart();
155+
stdio_init_all();
150156
printf("Hello, world!\n");
151157
return 0;
152158
}
@@ -176,12 +182,11 @@ instructions for other platforms, and just in general, we recommend you see [Ras
176182
$ cmake ..
177183
```
178184
179-
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=pico_w ..`
180-
to configure the SDK and build options accordingly for that particular board.
185+
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.
181186
182-
Doing so sets up various compiler defines (e.g. default pin numbers for UART and other hardware) and in certain
187+
Specifying `PICO_BOARD=<booardname>` sets up various compiler defines (e.g. default pin numbers for UART and other hardware) and in certain
183188
cases also enables the use of additional libraries (e.g. wireless support when building for `PICO_BOARD=pico_w`) which cannot
184-
be built without a board which provides the requisite functionality.
189+
be built without a board which provides the requisite hardware functionality.
185190
186191
For a list of boards defined in the SDK itself, look in [this directory](src/boards/include/boards) which has a
187192
header for each named board.
@@ -191,4 +196,8 @@ instructions for other platforms, and just in general, we recommend you see [Ras
191196
$ make hello_world
192197
```
193198
194-
1. You now have `hello_world.elf` to load via a debugger, or `hello_world.uf2` that can be installed and run on your Raspberry Pi Pico via drag and drop.
199+
1. You now have `hello_world.elf` to load via a debugger, or `hello_world.uf2` that can be installed and run on your Raspberry Pi Pico-series device via drag and drop.
200+
201+
# RISC-V support on RP2350
202+
203+
See [Raspberry Pi Pico-series C/C++ SDK](https://rptl.io/pico-c-sdk) for information on setting up a build environment for RISC-V on RP2350.

WORKSPACE

Whitespace-only changes.

bazel/BUILD.bazel

+6
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,9 @@ cc_library(
5555
cc_library(
5656
name = "empty_cc_lib",
5757
)
58+
59+
# A library incompatible with everything. Use to mark an invalid configuration.
60+
cc_library(
61+
name = "incompatible_cc_lib",
62+
target_compatible_with = ["@platforms//:incompatible"],
63+
)

0 commit comments

Comments
 (0)