| # Copyright 2026 The Pigweed Authors |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| # use this file except in compliance with the License. You may obtain a copy of |
| # the License at |
| # |
| # https://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| # License for the specific language governing permissions and limitations under |
| # the License. |
| |
| module( |
| name = "nrf52_pw_clang_example", |
| version = "0.0.1", |
| ) |
| |
| bazel_dep(name = "bazel_skylib", version = "1.8.2") |
| bazel_dep(name = "platforms", version = "1.0.0") |
| bazel_dep(name = "rules_platform", version = "0.1.0") |
| bazel_dep(name = "rules_python", version = "1.8.3") |
| bazel_dep(name = "rules_cc", version = "0.2.16") |
| bazel_dep(name = "zephyr-bazel") |
| bazel_dep(name = "protobuf", version = "33.4") |
| |
| include("//:pigweed_dep.MODULE.bazel") |
| |
| # Toolchain registration |
| # ====================== |
| # Register Pigweed's C++ toolchains. |
| register_toolchains( |
| "@pigweed//pw_toolchain/arm_clang:arm_clang_cc_toolchain_cortex-m4", |
| "@pigweed//pw_toolchain/host_clang:host_cc_toolchain_linux", |
| "@pigweed//pw_toolchain/host_clang:host_cc_toolchain_macos", |
| dev_dependency = True, |
| ) |
| |
| local_path_override( |
| module_name = "zephyr-bazel", |
| path = "../../", |
| ) |
| |
| # Zephyr setup |
| # ============ |
| |
| zephyr_patch = use_extension("@zephyr-bazel//:setup.bzl", "zephyr_patch_file") |
| zephyr_patch.checkout( |
| # The autoroller is broken. Manually update on 2026-5-8. |
| commit = "684c9e8f32e4373a21098559f748f06915f950c9", |
| ) |
| |
| # Get access to the patched zephyr repo. |
| use_repo(zephyr_patch, "zephyr", "zephyr_version") |
| |
| inject_repo(zephyr_patch, "hal_nordic") |
| |
| inject_repo(zephyr_patch, "cmsis_6") |
| |
| new_git_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository") |
| |
| new_git_repository( |
| name = "hal_nordic", |
| build_file = "@zephyr-bazel//modules:hal_nordic.BUILD", |
| commit = "7858281d843468fe53c829995fb63f45a227387a", |
| remote = "https://github.com/zephyrproject-rtos/hal_nordic.git", |
| ) |
| |
| new_git_repository( |
| name = "cmsis_6", |
| build_file = "@zephyr-bazel//modules:cmsis_6.BUILD", |
| commit = "30a859f44ef8ab4dc8f84b03ed586fd16ccf9d74", |
| remote = "https://github.com/zephyrproject-rtos/CMSIS_6.git", |
| ) |
| |
| python = use_extension("@rules_python//python/extensions:python.bzl", "python") |
| python.toolchain( |
| configure_coverage_tool = True, |
| # Only set when you have multiple toolchain versions. |
| is_default = True, |
| python_version = "3.11", |
| ) |
| use_repo(python, "pythons_hub") |
| |
| zephyr_setup = use_extension("@zephyr-bazel//:setup.bzl", "zephyr_setup") |
| zephyr_setup.env( |
| apps_dirs = ["//:MODULE.bazel"], |
| boards_dirs = ["@zephyr//boards"], |
| ) |
| use_repo( |
| zephyr_setup, |
| "zephyr_index", |
| "zephyr_kconfig", |
| "zephyr_state", |
| ) |
| |
| zephyr_setup_apps = use_extension("@zephyr-bazel//:setup.bzl", "zephyr_setup_apps") |