blob: 92188d2451541454aecdfe83fb07aec2f91e0844 [file]
# 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 = "zephyr-bazel",
version = "0.0.1",
)
bazel_dep(name = "bazel_skylib", version = "1.8.2")
bazel_dep(name = "gperf", version = "3.1.bcr.1")
bazel_dep(name = "platforms", version = "1.0.0")
bazel_dep(name = "rules_cc", version = "0.2.17")
bazel_dep(name = "rules_python", version = "1.8.3")
# Pigweed is used to ensure that builds use the same toolchains
include("//:pigweed_dep.MODULE.bazel")
# Toolchain registration
# ======================
# Register Pigweed's C++ toolchains.
register_toolchains(
"@pigweed//pw_toolchain/host_clang:host_cc_toolchain_linux",
"@pigweed//pw_toolchain/host_clang:host_cc_toolchain_macos",
"//toolchain:all",
dev_dependency = True,
)
http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "zephyr_sdk_xtensa_dc233c",
build_file = "//toolchain/xtensa:zephyr_sdk_xtensa_dc233c.BUILD",
sha256 = "d5dcce629d7cc24b1d0a367447340c1d9fbcedc0a6ed99ee105c8f1fe87060b2",
strip_prefix = "xtensa-dc233c_zephyr-elf",
urls = ["https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v1.0.1/toolchain_gnu_linux-x86_64_xtensa-dc233c_zephyr-elf.tar.xz"],
)
http_archive(
name = "zephyr_sdk_arm",
build_file = "//toolchain/arm:zephyr_sdk_arm.BUILD",
sha256 = "21b85981cb5a1818d9bc53d82af80f208946ec038b982ff1907287572ed3a634",
strip_prefix = "arm-zephyr-eabi",
urls = ["https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v1.0.1/toolchain_gnu_linux-x86_64_arm-zephyr-eabi.tar.xz"],
)
http_archive(
name = "zephyr_sdk_arc",
build_file = "//toolchain/arc:zephyr_sdk_arc.BUILD",
sha256 = "3b2c499772a6a56d8e72fda4db35d3f3443a75f287968fcf6e80657f3b4f48ca",
strip_prefix = "arc-zephyr-elf",
urls = ["https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v1.0.1/toolchain_gnu_linux-x86_64_arc-zephyr-elf.tar.xz"],
)
http_archive(
name = "zephyr_sdk_arm64",
build_file = "//toolchain/arm64:zephyr_sdk_arm64.BUILD",
sha256 = "01c0cfe1daaab2d2a0f71165f11a066d983ef97e51c4a3753186afa6ae55c24b",
strip_prefix = "aarch64-zephyr-elf",
urls = ["https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v1.0.1/toolchain_gnu_linux-x86_64_aarch64-zephyr-elf.tar.xz"],
)
http_archive(
name = "zephyr_sdk_mips",
build_file = "//toolchain/mips:zephyr_sdk_mips.BUILD",
sha256 = "6b0ee0f71bd1f2fd15d91950fced546b9542ba81dbcceff1456530ab95dac0bc",
strip_prefix = "mips-zephyr-elf",
urls = ["https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v1.0.1/toolchain_gnu_linux-x86_64_mips-zephyr-elf.tar.xz"],
)
http_archive(
name = "zephyr_sdk_riscv",
build_file = "//toolchain/riscv:zephyr_sdk_riscv.BUILD",
sha256 = "01750834c471fbdb335c1b8b8aee17010a1968938957db85640c366235771a38",
strip_prefix = "riscv64-zephyr-elf",
urls = ["https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v1.0.1/toolchain_gnu_linux-x86_64_riscv64-zephyr-elf.tar.xz"],
)
http_archive(
name = "zephyr_sdk_rx",
build_file = "//toolchain/rx:zephyr_sdk_rx.BUILD",
sha256 = "d3200cde7ab547094024900a6d289a62f0be05958d89131704d03e3e9499112d",
strip_prefix = "rx-zephyr-elf",
urls = ["https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v1.0.1/toolchain_gnu_linux-x86_64_rx-zephyr-elf.tar.xz"],
)
http_archive(
name = "zephyr_sdk_sparc",
build_file = "//toolchain/sparc:zephyr_sdk_sparc.BUILD",
sha256 = "d11759fbe6accf4106601c79864270494ab6b1e6539fd29e8223e8e124fa609e",
strip_prefix = "sparc-zephyr-elf",
urls = ["https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v1.0.1/toolchain_gnu_linux-x86_64_sparc-zephyr-elf.tar.xz"],
)
http_archive(
name = "zephyr_sdk_x86",
build_file = "//toolchain/x86:zephyr_sdk_x86.BUILD",
sha256 = "960fd8d8690ce130b141736e494a7bae7da1f96956f8da405de66429670b62e9",
strip_prefix = "x86_64-zephyr-elf",
urls = ["https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v1.0.1/toolchain_gnu_linux-x86_64_x86_64-zephyr-elf.tar.xz"],
)
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
use_repo(python, "pythons_hub")
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
hub_name = "zephyr_bazel_pip_deps",
python_version = "3.11",
requirements_lock = "//scripts:requirements-lock.txt",
)
pip.parse(
hub_name = "zephyr_bazel_pip_deps",
python_version = "3.12",
requirements_lock = "//scripts:requirements-lock.txt",
)
use_repo(pip, "zephyr_bazel_pip_deps")
zephyr_patch_file = use_extension("//:setup.bzl", "zephyr_patch_file")
zephyr_patch_file.checkout(
# The autoroller is broken. Manually update on 2026-5-8.
commit = "684c9e8f32e4373a21098559f748f06915f950c9",
)
use_repo(zephyr_patch_file, "zephyr", "zephyr_version")
zephyr_setup = use_extension("//:setup.bzl", "zephyr_setup")
zephyr_setup.env(
apps_dirs = ["//:examples"],
boards_dirs = ["@zephyr//boards"],
)
use_repo(
zephyr_setup,
"zephyr_index",
"zephyr_kconfig",
"zephyr_state",
)
zephyr_setup_apps = use_extension("//:setup.bzl", "zephyr_setup_apps")
# No tags needed, it reads from @zephyr_state