| # Copyright 2025 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 = "opentitan_pigweed", |
| version = "0.0.1", |
| ) |
| |
| bazel_dep(name = "bazel_skylib", version = "1.8.2") |
| bazel_dep(name = "pigweed") |
| bazel_dep(name = "platforms", version = "1.0.0") |
| bazel_dep(name = "rules_go", version = "0.52.0") |
| bazel_dep(name = "rules_rust", version = "0.66.0") |
| |
| # Apply patch that adds missing ARM triples to rules_rust |
| single_version_override( |
| module_name = "rules_rust", |
| patch_strip = 1, |
| patches = [ |
| "//patches:0003-Add-thumbv6m-and-more-thumbv7m-and-thumbv8m-triples.patch", |
| ], |
| ) |
| bazel_dep(name = "rules_platform", version = "0.1.0") |
| bazel_dep(name = "rules_python", version = "1.6.3") |
| bazel_dep(name = "ureg") |
| |
| git_override( |
| module_name = "pigweed", |
| commit = "a7b99b045", |
| remote = "https://github.com/OpenPRoT/pigweed", |
| ) |
| |
| git_override( |
| module_name = "ureg", |
| commit = "412ca40146d5d2012417e493b4a01096b04edf4b", |
| remote = "https://github.com/chipsalliance/caliptra-ureg", |
| ) |
| |
| pw_rust = use_extension("@pigweed//pw_toolchain/rust:extensions.bzl", "pw_rust") |
| pw_rust.toolchain(cipd_tag = "git_revisions:fe5c95d4ae33ec9d7831921e448e2daf8264ea42,7b074fc9362a4a6a5f172dd8936a22fb25eff96b") |
| use_repo(pw_rust, "pw_rust_toolchains") |
| |
| register_toolchains( |
| "@pigweed//pw_toolchain/host_clang:host_cc_toolchain_linux", |
| "@pigweed//pw_toolchain/host_clang:host_cc_toolchain_macos", |
| "@pigweed//pw_toolchain/riscv_clang:riscv_clang_cc_toolchain_rv32imc", |
| # ARM Cortex-M C++ toolchain (AST1060) - use M3 for soft-float ABI |
| "@pigweed//pw_toolchain:cc_toolchain_cortex-m3", |
| "@pw_rust_toolchains//:all", |
| ) |
| |
| crate = use_extension("@rules_rust//crate_universe:extension.bzl", "crate") |
| crate.from_cargo( |
| name = "rust_crates_base", |
| cargo_lockfile = "//third_party/crates_io:Cargo.lock", |
| manifests = ["//third_party/crates_io:Cargo.toml"], |
| # crate_universe's defaults do not include some embedded triples so the |
| # triples are listed explicitly. |
| supported_platform_triples = [ |
| # Host platforms |
| "aarch64-unknown-linux-gnu", |
| "x86_64-unknown-linux-gnu", |
| "aarch64-apple-darwin", |
| "x86_64-apple-darwin", |
| |
| # Target platforms |
| "riscv32imc-unknown-none-elf", |
| "thumbv7m-none-eabi", |
| ], |
| ) |
| crate.from_cargo( |
| name = "oot_crates_no_std", |
| cargo_lockfile = "//third_party/crates_io/crates_no_std:Cargo.lock", |
| manifests = ["//third_party/crates_io/crates_no_std:Cargo.toml"], |
| supported_platform_triples = [ |
| # Host platforms (required for build scripts) |
| "aarch64-unknown-linux-gnu", |
| "x86_64-unknown-linux-gnu", |
| "aarch64-apple-darwin", |
| "x86_64-apple-darwin", |
| # Embedded targets |
| "thumbv6m-none-eabi", |
| "thumbv7m-none-eabi", |
| "thumbv7em-none-eabi", |
| "thumbv8m.main-none-eabi", |
| "riscv32imc-unknown-none-elf", |
| ], |
| ) |
| use_repo(crate, "rust_crates_base", "oot_crates_no_std") |
| |
| # Create @rust_crates alias repo that routes cortex-m to oot_crates_no_std |
| oot_rust_crates_ext = use_extension("//third_party/crates_io/rust_crates:extension.bzl", "oot_rust_crates_extension") |
| use_repo(oot_rust_crates_ext, "rust_crates") |
| |
| # Override pigweed's rust_crates repo with our aliased version |
| pw_rust_crates_ext = use_extension("@pigweed//pw_build:pw_rust_crates_extension.bzl", "pw_rust_crates_extension") |
| override_repo(pw_rust_crates_ext, rust_crates = "rust_crates") |
| |
| bazel_dep(name = "opentitan_devbundle") |
| archive_override( |
| module_name = "opentitan_devbundle", |
| integrity = "sha256-n/0uF/b0uXkEfTzP7QJx/cK1KWExES/Zn/C/EqyXzGo=", |
| url = "https://storage.googleapis.com/artifacts.opentitan.org/dev_bundle/devbundle-test-20251105.tar.xz", |
| ) |
| |
| # ── AST1060 Peripheral Access Crate (svd2rust-generated) ── |
| ast1060_pac_ext = use_extension( |
| "//third_party:ast1060_pac.bzl", |
| "ast1060_pac_ext", |
| ) |
| use_repo(ast1060_pac_ext, "ast1060_pac", "vcell") |
| |
| # ── Aspeed DDK (bare-metal I2C / GPIO / crypto drivers) ── |
| aspeed_ddk_ext = use_extension( |
| "//third_party:aspeed_ddk.bzl", |
| "aspeed_ddk_ext", |
| ) |
| use_repo(aspeed_ddk_ext, "aspeed_ddk") |
| |
| nonhermetic_repo = use_repo_rule("//target/earlgrey/tooling/signing:nonhermetic.bzl", "nonhermetic_repo") |
| |
| nonhermetic_repo(name = "nonhermetic") |
| |
| hsm = use_extension("//third_party/hsm:extensions.bzl", "hsm") |
| use_repo(hsm, "cloud_kms_hsm") |