blob: bbbc36e4a5976903df751d77862aa29136eb4070 [file] [log] [blame]
###############################################################################
# Bazel now uses Bzlmod by default to manage external dependencies.
# Please consider migrating your external dependencies from WORKSPACE to MODULE.bazel.
#
# For more details, please check https://github.com/bazelbuild/bazel/issues/18958
###############################################################################
module(
name = "hello_bazel",
version = "0.0.1",
)
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "pigweed")
bazel_dep(name = "platforms", version = "0.0.10")
bazel_dep(name = "rules_platform", version = "0.1.0")
bazel_dep(name = "rules_python", version = "0.40.0")
bazel_dep(name = "rules_cc", version = "0.0.17")
bazel_dep(name = "zephyr-bazel")
bazel_dep(name = "protobuf", version = "29.0")
# Module overrides
# ================
git_override(
module_name = "pigweed",
# ROLL: Warning: this entry is automatically updated.
# ROLL: Last updated 2025-10-14.
# ROLL: By https://cr-buildbucket.appspot.com/build/8701058300860140449.
commit = "5e0cbcea7642fbab005b414f0ddec680a5e198ec",
remote = "https://pigweed.googlesource.com/pigweed/pigweed",
)
# Toolchain registration
# ======================
# Register Pigweed's C++ toolchains.
register_toolchains(
"@pigweed//pw_toolchain:cc_toolchain_cortex-m0",
"@pigweed//pw_toolchain/zephyr/arm:toolchain_cortex-m7",
"@pigweed//pw_toolchain:cc_toolchain_cortex-m33",
"@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 = use_extension("@zephyr-bazel//:setup.bzl", "zephyr_patch_file")
# Get access to the build overlay patch file.
use_repo(zephyr_setup, "zephyr-patch")
git_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
# Declare the intended canonical definition of @zephyr.
git_repository(
name = "zephyr",
# Use a local file::// to override the Zephyr git repo and avoid downloads
# remote = "file:///path/to/zephyrproject/zephyr"
remote = "https://pigweed.googlesource.com/third_party/github/zephyrproject-rtos/zephyr",
# ROLL: Warning: this entry is automatically updated.
# ROLL: Last updated 2025-03-06.
# ROLL: By https://cr-buildbucket.appspot.com/build/8721116211536533505.
commit = "fb4bb5d7688f5b232023ea07308edfe734f41b7e",
patches = [
"@zephyr-patch//:patch.diff",
],
)
# Tell @zephyr-bazel to use the local instance of @zephyr as the canonical
# definition of @zephyr.
override_repo(zephyr_setup, "zephyr")
# Make @zephyr_bazel_pip_deps visible from @zephyr since @zephyr is declared
# in this MODULE.bazel, which otherwise can't see @zephyr-bazel's declared
# pip deps.
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
use_repo(pip, "zephyr_bazel_pip_deps")
create_version_h = use_repo_rule(
"@zephyr-bazel//:setup.bzl",
"version_header",
)
create_version_h(
name = "zephyr_version",
version_file = "@zephyr//:VERSION",
version_template = "@zephyr//:version.h.in",
)
new_git_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository")
new_git_repository(
name = "hal_atmel",
remote = "https://github.com/zephyrproject-rtos/hal_atmel.git",
commit = "56d60ebc909ad065bf6554cee73487969857614b",
build_file = "@zephyr-bazel//modules:hal_atmel.BUILD"
)
new_git_repository(
name = "cmsis",
remote = "https://github.com/zephyrproject-rtos/cmsis.git",
commit = "4b96cbb174678dcd3ca86e11e1f24bc5f8726da0",
build_file = "@zephyr-bazel//modules:cmsis.BUILD",
)
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",
)
kconfig = use_extension("@zephyr-bazel//:kconfig.bzl", "kconfig")
kconfig.tree(
zephyr_root = "@zephyr",
board_name = "robokit1",
)
kconfig.project(
name = "configs",
conf_file = "prj.conf",
dts_file = "@zephyr//:boards/tdk/robokit1/robokit1.dts",
dts_file_include_paths = [
"@zephyr//:dts/arm",
"@zephyr//:boards/tdk/robokit1",
"@hal_atmel//:include",
],
)
use_repo(kconfig, "kconfig")
use_repo(kconfig, "configs")