i3c service: expose the target's device info A client of the service could read the target's dynamic address, but not its transfer limits, so a consumer such as an MCTP binding had to assume a frame size. The limits are the target's to report, and on some controllers they are runtime values the controller sets. Add I3cOp::DeviceInfo, which returns a DeviceInfo: the dynamic and static addresses (0 meaning none; 0x00 is reserved on an I3C bus) and the most one Send and one received frame can carry, as two little-endian u16s, six bytes in all. The server builds it from I3cTarget::device_info and clamps both limits to the frame ceiling (MAX_PAYLOAD), so a client never plans a frame the ring slots or the wire cannot hold. I3cClient gains device_info(). The new op takes the next free opcode, so existing clients and servers are unaffected. Tests: the codec (round trip, zero address, wrong length), the server's dispatch (addresses and limits, an unassigned target, the clamp) and the client over the loopback. On target the i3c_service client now reads the device info after the dynamic address and fails unless the address is assigned and both limits are 256, which covers the real driver on the emulator and, when run, the FPGA. Passes on the emulator; the FPGA image builds. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The OpenPRoT Technical Charter can be found at https://github.com/OpenPRoT/.github/blob/main/GOVERNANCE.md
NOTE: We are converting our build system to bazel. We recommend installing bazelisk to automatically manage bazel versions.
You can run tasks using the Pigweed workflow launcher pw or bazel.
./pw presubmit - Run presubmit checks: formatting, license checks, C/C++ header checks and clippy../pw format - Run the code formatters.bazel test //... - Run all tests.bazel build //docs - Build documentation.The project is structured as a bazel module.
Release firmware is published with signed SLSA build provenance. See docs/src/supply-chain.md for how to verify it.
No additional tools are required to build and test - all dependencies are managed by bazel. The sections below are optional and only describe editor setup.
Rust toolchain and rust-analyzer. Builds do not use rustup, but the editor does. Install rustup. The repository's rust-toolchain.toml pins the nightly channel and lists the rust-analyzer, rust-src, rustfmt and clippy components, so rustup installs them automatically the first time rustc or cargo runs in the repository. To install them eagerly (or to add the component to an older checkout), run:
rustup show # installs the pinned toolchain + components rustup component add rust-analyzer # only if it is missing
Buildifier formats BUILD.bazel/.bzl files. Download a prebuilt binary from the buildtools releases and put it on your PATH (use buildifier-linux-arm64 on ARM Linux, or buildifier-darwin-amd64 / buildifier-darwin-arm64 on macOS):
sudo curl -fsSL -o /usr/local/bin/buildifier \ https://github.com/bazelbuild/buildtools/releases/latest/download/buildifier-linux-amd64 sudo chmod +x /usr/local/bin/buildifier buildifier --version
Alternatively, go install github.com/bazelbuild/buildtools/buildifier@latest. ./pw format also runs buildifier, so the editor tool is only for format-on-save.
BazelBuild.vscode-bazel): Starlark syntax, target browsing, and buildifier integration.rust-lang.rust-analyzer).rust-project.jsonThere is no Cargo workspace, so rust-analyzer gets its crate graph from a generated rust-project.json (git-ignored) at the repository root:
bazel run @rules_rust//tools/rust_analyzer:gen_rust_project
This covers //..., which is large (hundreds of crates) and can use more than 10 GB of memory in rust-analyzer, which may get it killed on small machines or WSL. Prefer generating for only the targets you are working on:
bazel run @rules_rust//tools/rust_analyzer:gen_rust_project -- \ //services/orchestrator/... //drivers/usart/...
Crates that only build for an embedded target (those with target_compatible_with = TARGET_COMPATIBLE_WITH, e.g. everything under target/ast10x0/) are skipped when generating for the host, so their files get no highlighting or hover. Pass the target‘s Bazel config to the generator’s inner build with --config:
bazel run @rules_rust//tools/rust_analyzer:gen_rust_project -- \ --config=virt_ast10x0 //target/ast10x0/peripherals:peripherals
The same applies to Earl Grey:
bazel run @rules_rust//tools/rust_analyzer:gen_rust_project -- \ --config=k_earlgrey //target/earlgrey/...
If a file has no highlighting, hover or go-to-definition, its crate is most likely not in rust-project.json. Check, in order:
Is the target listed? Search rust-project.json for the crate name or file path. If it is missing, add the target (or a parent package such as //path/to/pkg/...) to the gen_rust_project command. Remember that each run overwrites the file.
Is it embedded-only? If the target uses target_compatible_with, it is skipped on the host platform, with no error. Pass the config that selects its platform after the --. The configs are defined in .bazelrc:
| Directory | Config |
|---|---|
target/ast10x0/ | --config=virt_ast10x0 |
target/earlgrey/ | --config=k_earlgrey |
target/veer/ | --config=k_veer |
No config exists for your target? Add one to .bazelrc next to the existing ones. It must use the common: prefix, not just build:, so the setting also reaches the generator's inner build:
common:k_mytarget --platforms=//target/mytarget:mytarget build:k_mytarget --build_tag_filters=-do_not_build,-kernel_doc_test
Reload. After regenerating, run “rust-analyzer: Reload Workspace”. Double-check the spelling of the command and config names, since a typo in either fails the run.
Notes:
--config after the --. Using --platforms on bazel run itself builds the generator for the embedded target and fails.rust-project.json, so list every target you need in one command..vscode/settings.json.vscode/settings.json is git-ignored, so each developer keeps their own copy. A suggested starting point:
{ "rust-analyzer.linkedProjects": ["rust-project.json"], "rust-analyzer.cachePriming.enable": false, "rust-analyzer.numThreads": 4, "rust-analyzer.checkOnSave": false, "rust-analyzer.files.exclude": ["third_party/**", "bazel-*/**"], "bazel.buildifier.executable": "/usr/local/bin/buildifier", "bazel.codeLens.enable": true, "[starlark]": { "editor.defaultFormatter": "BazelBuild.vscode-bazel", "editor.formatOnSave": true } }
linkedProjects is required; it points rust-analyzer at the generated file.cachePriming.enable, numThreads, checkOnSave and files.exclude limit rust-analyzer's memory use; relax them if your machine has plenty of RAM.bazel.buildifierExecutable to the output of which buildifier.checkOnSave is disabled because the default cargo check does not work here. Use ./pw presubmit (which runs clippy through Bazel) instead.