diff --git a/modules/pico-sdk/1.6.0-rc1/MODULE.bazel b/modules/pico-sdk/1.6.0-rc1/MODULE.bazel new file mode 100644 index 00000000000..6c2b70542b8 --- /dev/null +++ b/modules/pico-sdk/1.6.0-rc1/MODULE.bazel @@ -0,0 +1,102 @@ +module(name = "pico-sdk", version = "1.6.0-rc1") + +bazel_dep(name = "platforms", version = "0.0.8") + +bazel_dep(name = "bazel_skylib", version = "1.6.1") + +bazel_dep(name = "rules_python", version = "0.22.1") + +# Note: rules_cc is special-cased repository; a dependency on rules_cc in a +# module will not ensure that the root Bazel module has that same version of +# rules_cc. For that reason, this primarily acts as a FYI. You'll still need +# to explicitly list this dependency in your own project's MODULE.bazel file. +bazel_dep(name = "rules_cc", version = "0.0.9") + +# rules_cc v0.0.10 is not yet cut, so manually pull in the desired version. +# This does not apply to dependent projects, so it needs to be copied to your +# project's MODULE.bazel too. +archive_override( + module_name = "rules_cc", + urls = "https://github.com/bazelbuild/rules_cc/archive/1acf5213b6170f1f0133e273cb85ede0e732048f.zip", + strip_prefix = "rules_cc-1acf5213b6170f1f0133e273cb85ede0e732048f", + integrity = "sha256-NddP6xi6LzsIHT8bMSVJ2NtoURbN+l3xpjvmIgB6aSg=", +) + +http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +http_archive( + name = "arm_gcc_linux-x86_64", + 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", + strip_prefix = "arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi", + build_file = "//bazel/toolchain:gcc_arm_none_eabi.BUILD", + sha256 = "6cd1bbc1d9ae57312bcd169ae283153a9572bd6a8e4eeae2fedfbc33b115fdbb", +) + +http_archive( + name = "arm_gcc_win-x86_64", + 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", + strip_prefix = "arm-gnu-toolchain-13.2.Rel1-mingw-w64-i686-arm-none-eabi", + build_file = "//bazel/toolchain:gcc_arm_none_eabi.BUILD", + sha256 = "51d933f00578aa28016c5e3c84f94403274ea7915539f8e56c13e2196437d18f", +) + +http_archive( + name = "arm_gcc_mac-x86_64", + 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", + strip_prefix = "arm-gnu-toolchain-13.2.Rel1-darwin-x86_64-arm-none-eabi", + build_file = "//bazel/toolchain:gcc_arm_none_eabi.BUILD", + sha256 = "075faa4f3e8eb45e59144858202351a28706f54a6ec17eedd88c9fb9412372cc", +) + +http_archive( + name = "arm_gcc_mac-aarch64", + 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", + strip_prefix = "arm-gnu-toolchain-13.2.Rel1-darwin-arm64-arm-none-eabi", + build_file = "//bazel/toolchain:gcc_arm_none_eabi.BUILD", + sha256 = "39c44f8af42695b7b871df42e346c09fee670ea8dfc11f17083e296ea2b0d279", +) + +# TODO: Provide tinyusb as a proper Bazel module. +http_archive( + name = "tinyusb", + url = "https://github.com/hathach/tinyusb/archive/86c416d4c0fb38432460b3e11b08b9de76941bf5.zip", + strip_prefix = "tinyusb-86c416d4c0fb38432460b3e11b08b9de76941bf5", + build_file = "//src/rp2_common/tinyusb:tinyusb.BUILD", + sha256 = "ac57109bba00d26ffa33312d5f334990ec9a9a4d82bf890ed8b825b4610d1da2", +) + +# TODO: Provide btstack as a proper Bazel module. +http_archive( + name = "btstack", + url = "https://github.com/bluekitchen/btstack/archive/72ef1732c954d938091467961e41f4aa9b976b34.zip", + strip_prefix = "btstack-72ef1732c954d938091467961e41f4aa9b976b34", + build_file = "//src/rp2_common/pico_btstack:btstack.BUILD", + sha256 = "f45d72b5d404dd2f8e311287de6f2ba3561fc8ae956737eeb611b277aadc2391", +) + +# TODO: Provide btstack as a proper Bazel module. +http_archive( + name = "cyw43-driver", + url = "https://github.com/georgerobotics/cyw43-driver/archive/8ef38a6d32c54f850bff8f189bdca19ded33792a.zip", + strip_prefix = "cyw43-driver-8ef38a6d32c54f850bff8f189bdca19ded33792a", + build_file = "//src/rp2_common/pico_cyw43_driver:cyw43-driver.BUILD", + sha256 = "0b44a19ea58537ee954357606cde5ed20c3a42be77adfebb07b7c0e4740f6228", +) + +# TODO: Provide lwip as a proper Bazel module. +http_archive( + name = "lwip", + url = "https://github.com/lwip-tcpip/lwip/archive/239918ccc173cb2c2a62f41a40fd893f57faf1d6.zip", + strip_prefix = "lwip-239918ccc173cb2c2a62f41a40fd893f57faf1d6", + build_file = "//src/rp2_common/pico_lwip:lwip.BUILD", + sha256 = "7ee9e02f2719c0422377e1fcce5a21716ca2e2e855cca56695f9ef7cb020e5dd", +) + +register_toolchains( + "//bazel/toolchain:arm_gcc_linux-x86_64", + "//bazel/toolchain:arm_gcc_win-x86_64", + "//bazel/toolchain:arm_gcc_mac-x86_64", + "//bazel/toolchain:arm_gcc_mac-aarch64", + # Require users to opt-in to the Pico SDK's toolchains. + dev_dependency = True, +) diff --git a/modules/pico-sdk/1.6.0-rc1/patches/0001-Minimal-fixes-for-BCR.patch b/modules/pico-sdk/1.6.0-rc1/patches/0001-Minimal-fixes-for-BCR.patch new file mode 100644 index 00000000000..453e84961b7 --- /dev/null +++ b/modules/pico-sdk/1.6.0-rc1/patches/0001-Minimal-fixes-for-BCR.patch @@ -0,0 +1,20 @@ +diff --git a/MODULE.bazel b/MODULE.bazel +index 883fad7..6c2b705 100644 +--- a/MODULE.bazel ++++ b/MODULE.bazel +@@ -4,6 +4,8 @@ bazel_dep(name = "platforms", version = "0.0.8") + + bazel_dep(name = "bazel_skylib", version = "1.6.1") + ++bazel_dep(name = "rules_python", version = "0.22.1") ++ + # Note: rules_cc is special-cased repository; a dependency on rules_cc in a + # module will not ensure that the root Bazel module has that same version of + # rules_cc. For that reason, this primarily acts as a FYI. You'll still need +@@ -95,4 +97,6 @@ register_toolchains( + "//bazel/toolchain:arm_gcc_win-x86_64", + "//bazel/toolchain:arm_gcc_mac-x86_64", + "//bazel/toolchain:arm_gcc_mac-aarch64", ++ # Require users to opt-in to the Pico SDK's toolchains. ++ dev_dependency = True, + ) diff --git a/modules/pico-sdk/1.6.0-rc1/patches/0002-Add-Bazel-example-for-BCR.patch b/modules/pico-sdk/1.6.0-rc1/patches/0002-Add-Bazel-example-for-BCR.patch new file mode 100644 index 00000000000..25be21eafa2 --- /dev/null +++ b/modules/pico-sdk/1.6.0-rc1/patches/0002-Add-Bazel-example-for-BCR.patch @@ -0,0 +1,74 @@ +diff --git a/bazel/example/.bazelrc b/bazel/example/.bazelrc +new file mode 100644 +index 0000000..d30eca5 +--- /dev/null ++++ b/bazel/example/.bazelrc +@@ -0,0 +1 @@ ++build --@rules_cc//cc/toolchains:experimental_enable_rule_based_toolchains +diff --git a/bazel/example/BUILD.bazel b/bazel/example/BUILD.bazel +new file mode 100644 +index 0000000..1457241 +--- /dev/null ++++ b/bazel/example/BUILD.bazel +@@ -0,0 +1,5 @@ ++cc_binary( ++ name = "hello_world", ++ srcs = ["hello_world.c"], ++ deps = ["@pico-sdk//src/common/pico_stdlib:pico_stdlib"], ++) +diff --git a/bazel/example/MODULE.bazel b/bazel/example/MODULE.bazel +new file mode 100644 +index 0000000..d50c4bd +--- /dev/null ++++ b/bazel/example/MODULE.bazel +@@ -0,0 +1,28 @@ ++bazel_dep(name = "pico-sdk", version = "1.6.0-rc1") ++ ++# DO NOT copy this line to your project, this is just to make it so this example ++# can reference the rest of the repository. ++local_path_override(module_name = "pico-sdk", path = "../..") ++ ++# Note: rules_cc is special-cased repository; a dependency on rules_cc in a ++# module will not ensure that the root Bazel module has that same version of ++# rules_cc. For that reason, this primarily acts as a FYI. You'll still need ++# to explicitly list this dependency in your own project's MODULE.bazel file. ++bazel_dep(name = "rules_cc", version = "0.0.9") ++ ++# rules_cc v0.0.10 is not yet cut, so manually pull in the desired version. ++# This does not apply to dependent projects, so it needs to be copied to your ++# project's MODULE.bazel too. ++archive_override( ++ module_name = "rules_cc", ++ urls = "https://github.com/bazelbuild/rules_cc/archive/1acf5213b6170f1f0133e273cb85ede0e732048f.zip", ++ strip_prefix = "rules_cc-1acf5213b6170f1f0133e273cb85ede0e732048f", ++ integrity = "sha256-NddP6xi6LzsIHT8bMSVJ2NtoURbN+l3xpjvmIgB6aSg=", ++) ++ ++register_toolchains( ++ "@pico-sdk//bazel/toolchain:arm_gcc_linux-x86_64", ++ "@pico-sdk//bazel/toolchain:arm_gcc_win-x86_64", ++ "@pico-sdk//bazel/toolchain:arm_gcc_mac-x86_64", ++ "@pico-sdk//bazel/toolchain:arm_gcc_mac-aarch64", ++) +diff --git a/bazel/example/hello_world.c b/bazel/example/hello_world.c +new file mode 100644 +index 0000000..cf3dfd2 +--- /dev/null ++++ b/bazel/example/hello_world.c +@@ -0,0 +1,16 @@ ++/** ++ * Copyright (c) 2024 Raspberry Pi (Trading) Ltd. ++ * ++ * SPDX-License-Identifier: BSD-3-Clause ++ */ ++ ++#include ++#include "pico/stdlib.h" ++ ++int main() { ++ stdio_init_all(); ++ while (true) { ++ printf("Hello, world!\n"); ++ sleep_ms(1000); ++ } ++} diff --git a/modules/pico-sdk/1.6.0-rc1/patches/0003-Pioasm-MSVC-workaround.patch b/modules/pico-sdk/1.6.0-rc1/patches/0003-Pioasm-MSVC-workaround.patch new file mode 100644 index 00000000000..35b1c499b2f --- /dev/null +++ b/modules/pico-sdk/1.6.0-rc1/patches/0003-Pioasm-MSVC-workaround.patch @@ -0,0 +1,17 @@ +diff --git a/tools/pioasm/BUILD.bazel b/tools/pioasm/BUILD.bazel +index c9fd601..c9a252e 100644 +--- a/tools/pioasm/BUILD.bazel ++++ b/tools/pioasm/BUILD.bazel +@@ -4,6 +4,12 @@ package(default_visibility = ["//visibility:public"]) + + cc_library( + name = "pioasm_core", ++ # TODO: Only required for MSVC, but this will apply whenever Windows is ++ # targeted. ++ defines = select({ ++ "@platforms//os:windows": ["YY_NO_UNISTD_H=1"], ++ "//conditions:default": [], ++ }), + srcs = [ + "gen/lexer.cpp", + "gen/location.h", diff --git a/modules/pico-sdk/1.6.0-rc1/presubmit.yml b/modules/pico-sdk/1.6.0-rc1/presubmit.yml new file mode 100644 index 00000000000..d45bab2714d --- /dev/null +++ b/modules/pico-sdk/1.6.0-rc1/presubmit.yml @@ -0,0 +1,14 @@ +bcr_test_module: + module_path: bazel/example + matrix: + platform: ["debian10", "ubuntu2004", "macos", "macos_arm64", "windows"] + tasks: + run_test_module_build: + name: "Build test" + platform: ${{ platform }} + bazel: "7.x" + build_flags: + - "--platforms=@pico-sdk//bazel/platform:rp2040" + build_targets: + - "//:hello_world" + - "@pico-sdk//..." diff --git a/modules/pico-sdk/1.6.0-rc1/source.json b/modules/pico-sdk/1.6.0-rc1/source.json new file mode 100644 index 00000000000..ac8ef037903 --- /dev/null +++ b/modules/pico-sdk/1.6.0-rc1/source.json @@ -0,0 +1,11 @@ +{ + "integrity": "sha256-7coOEe7V7Y11X+n4qkAIPsR+OjB7Bibc9Ofxwb9ZSpA=", + "strip_prefix": "pico-sdk-6ff3e4fab27441de19fd53c0eb5aacbe83a18221", + "url": "https://github.com/raspberrypi/pico-sdk/archive/6ff3e4fab27441de19fd53c0eb5aacbe83a18221.tar.gz", + "patch_strip": 1, + "patches": { + "0001-Minimal-fixes-for-BCR.patch": "sha256-e9F+Avyz5U89+12sJxJ6PqytGw87UlGrBGI6W5SGLqw=", + "0002-Add-Bazel-example-for-BCR.patch": "sha256-tEUaoqOZrv9JsAycO9FQq9xHfbwqTvPCEqUt5XIYrwU=", + "0003-Pioasm-MSVC-workaround.patch": "sha256-fHBGTRUHYlKv01ajgdWjCkZChS8piVXICuZFFFUUE7I=" + } +} diff --git a/modules/pico-sdk/metadata.json b/modules/pico-sdk/metadata.json new file mode 100644 index 00000000000..642a71b754a --- /dev/null +++ b/modules/pico-sdk/metadata.json @@ -0,0 +1,28 @@ +{ + "homepage": "https://www.raspberrypi.com/documentation/pico-sdk/", + "maintainers": [ + { + "github": "armandomontanez", + "name": "Armando Montanez" + }, + { + "github": "kilograham", + "name": "Graham Sanderson" + }, + { + "github": "tpudlik", + "name": "Ted Pudlik" + }, + { + "email": "pigweed-team@googlegroups.com", + "name": "The Pigweed Team" + } + ], + "repository": [ + "github:raspberrypi/pico-sdk" + ], + "versions": [ + "1.6.0-rc1" + ], + "yanked_versions": {} +}