Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
out/
52 changes: 52 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# 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.

# Default to C++17 to ensure compatibility.
common --@pigweed//pw_toolchain/cc:cxx_standard=17
common:cxx20 --//pw_toolchain/cc:cxx_standard=20
common --per_file_copt=external/.*,.*\.pb\.cc@-w
common --host_per_file_copt=external/.*,.*\.pb\.cc@-w

# Don't automatically create __init__.py files.
#
# This prevents spurious package name collisions at import time, and should be
# the default (https://github.com/bazelbuild/bazel/issues/7386). Pigweed's
# Python libraries break without this.
common --incompatible_default_to_explicit_init_py

# Do not attempt to configure an autodetected (local) toolchain. We vendor all
# our toolchains, and CI VMs may not have any local toolchain to detect.
common --repo_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1

test --@pigweed//pw_kernel:enable_tests=true

# Remote execution config definitions
# ===================================
# Use the remote cache. This will only work for users who have permission to access it.
common:remote_cache --bes_backend="buildeventservice.googleapis.com"
common:remote_cache --bes_instance_name=pigweed-rbe-private
common:remote_cache --bes_results_url="https://source.cloud.google.com/results/invocations/"
common:remote_cache --bes_timeout=600s
common:remote_cache --experimental_remote_cache_eviction_retries=5
common:remote_cache --google_default_credentials=true
# Required to use buildeventservice on Bazel 8+.
# TODO: b/345556899 -- Remove this flag when no longer required.
common:remote_cache --legacy_important_outputs
common:remote_cache --remote_cache=grpcs://remotebuildexecution.googleapis.com
common:remote_cache --remote_instance_name=projects/pigweed-rbe-private/instances/default-instance
common:remote_cache --remote_upload_local_results=false
# TODO: https://github.com/bazelbuild/bazel/issues/24867 - This flag breaks
# runfiles handling with remote caching, and causes a bunch of
# java.io.FileNotFoundException when creating runfiles trees.
common:remote_cache --experimental_inprocess_symlink_creation=false
1 change: 1 addition & 0 deletions .bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8.1.0
54 changes: 36 additions & 18 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,40 @@
# Rust build artifacts
/target/
**/target/
# Build
rust-project.json
user.bazelrc
/bazel-*
/out

# Editors
.pw_ide/
.vscode/settings.json
.vscode/tasks.json
.vscode/pw_user_*.json
.vscode/*.bak.json
.idea/
.project
.cproject
.clangd
.clangd/
*.swp
*.swo
.#*

# Git
*.orig
*.BACKUP.*
*.BASE.*
*.LOCAL.*
*.REMOTE.*
*_BACKUP_*.txt
*_BASE_*.txt
*_LOCAL_*.txt
*_REMOTE_*.txt

# Other
pw_console-*logs.txt
.pw_console.user.yaml


# Generated by Cargo
# will have compiled files and executables
debug/
target/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Expand All @@ -17,13 +46,6 @@ target/
# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb

# IDE files
.vscode/
.idea/
*.swp
*.swo
*~

# OS files
.DS_Store
.DS_Store?
Expand Down Expand Up @@ -76,7 +98,6 @@ doc/

# Generated by mdbook
book/
target/book/

# Backup files
*.bak
Expand All @@ -86,9 +107,6 @@ target/book/
*.tmp
*.temp

# Distribution
dist/
target/dist/

# Local configuration
.cargo/config
Expand Down
27 changes: 27 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# 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.

load("@bazel_skylib//rules:native_binary.bzl", "native_binary")

native_binary(
name = "pw",
src = "@pigweed//pw_build/py:workflows_launcher",
)

# Shortcut for the Pigweed formatter.
# Just run `bazel run //:format` to format code.
alias(
name = "format",
actual = "@pigweed//pw_presubmit/py:format",
)
93 changes: 93 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# 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")
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",
# ROLL: Warning: this entry is automatically updated by
# ROLL: https://cr-buildbucket.appspot.com/builder/pigweed-internal/opentitan.roll/pigweed-opentitan-roller
commit = "f52059663fee1e2ab2f2ab752301b159da3ca806",
remote = "https://pigweed.googlesource.com/pigweed/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",
"@pw_rust_toolchains//:all",
)

crate = use_extension("@rules_rust//crate_universe:extension.bzl", "crate")
crate.from_cargo(
name = "rust_crates",
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",
],
)
use_repo(crate, "rust_crates")

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",
)

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")
Loading
Loading