Peripheral access crates for the Broadcom microprocessors used in the Raspberry Pi boards.
This repository contains the scripts to generate the PACs for the following MCUs:
- BCM2835, found in the Raspberry Pi 1 and Zero
- BCM2837, found in the Raspberry Pi 3 and Zero 2W
- BCM2711, found in the Raspberry Pi 4
These PACs are generated by svd2rust
from the
SVD files
in
adafruit/broadcom-peripherals,
save that patches are applied
to add the missing tags required by svd2rust
.
The PACs expect the memory-mapped registers of the peripherals
to be present on their physical addresses;
therefore, the PACs integrate poorly with virtual memory.
If the register files are offset-mapped to a different base address,
it is advised to generate the PACs by yourself from
our patched SVD files
and using the --base-address-shift
option of svd2rust
.
atomic
: Extends the register API with operations to atomically set, clear, and toggle specific bits.defmt
: Includedefmt::Format
implementations.
make
patch
- Jinja2 CLI
- A Rust toolchain with
cargo
andrustfmt
svd2rust
(The latest version that works with our SVD files is 0.31.5.)form
(≥ 0.11 is required for the generated PACs to be compilable on Windows.)
Also, the submodule broadcom-peripherals
must be checked out.
To generate the PAC for a particular MCU, run:
make build/pacs/<mcu_name>-lpa
where <mcu_name>
is one of bcm2835
, bcm2837
, or bcm2711
.
The generated PAC will be located in build/pacs/<mcu_name>-lpa
.
This step also generates the patched SVD file,
which is located in build/svds/<mcu_name>.svd
.
Or, to generate the PACs for all MCUs at once, run:
make pacs
make
patch
Also, the submodule broadcom-peripherals
must be checked out.
To generate the SVD file for a particular MCU, run:
make build/svds/<mcu_name>.svd
where <mcu_name>
is one of bcm2835
, bcm2837
, or bcm2711
.
The generated SVD file will be located in build/svds/<mcu_name>.svd
.
Or, to generate the SVD files for all MCUs at once, run:
make svds