Skip to content

Peripheral access crates for the Broadcom microprocessors used in the Raspberry Pi boards

License

Notifications You must be signed in to change notification settings

abt8601/raspi-pacs

Repository files navigation

raspi-pacs

crates.io docs.rs

crates.io docs.rs

crates.io docs.rs

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.

A Note on Virtual Memory

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.

Feature Flags of the PACs

  • atomic: Extends the register API with operations to atomically set, clear, and toggle specific bits.
  • defmt: Include defmt::Format implementations.

Generating the PACs

Prerequisites for the PACs

  • make
  • patch
  • Jinja2 CLI
  • A Rust toolchain with cargo and rustfmt
  • 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.

Steps to Generate the PACs

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

Generating Just the SVD Files

Prerequisites for the SVD Files

  • make
  • patch

Also, the submodule broadcom-peripherals must be checked out.

Steps to Generate the SVD Files

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

About

Peripheral access crates for the Broadcom microprocessors used in the Raspberry Pi boards

Topics

Resources

License

Stars

Watchers

Forks