Appendix B: Reading the hardware manuals
You will need two kinds of documentation.
1. The Raspberry Pi peripheral manual, “BCM2835 ARM Peripherals”. This is the authoritative source for the device registers you program in Quest 2.
- Despite the name, it applies to the Pi 3’s BCM2837 chip for the peripherals you use here, with one difference: the peripheral base address. The manual writes peripheral addresses as bus addresses beginning
0x7E00'0000and mentions0x2000'0000as the ARM physical address where they show up; on the Pi 3 the CPU sees them based at0x3F00'0000. To turn a manual address0x7Exx'xxxxinto a RPi 3 ARM physical address, replace the0x7Eprefix with0x3F. - Sections you’ll use: §6 (GPIO) for the pin function-select and pull-up/down registers, and the UART section (§13, “PL011 UART”) for the data, flag, baud-divisor, line-control, and control registers, plus the recommended initialization sequence.
- How to read a register description: each register has an offset from a peripheral base, a width (32 bits here), and a table of bit fields. To “set bit 5,” you OR in
(1 << 5); to “clear the field in bits 6:5,” you AND with the complement of(0b11 << 5). Work one field at a time.
2. The ARM architecture documentation. For the assembly in Quest 1: the Arm Architecture Reference Manual for A-profile (ARMv8-A) and the Cortex-A53 Technical Reference Manual. You’ll rarely need these beyond looking up a system register such as mpidr_el1 (the “Multiprocessor Affinity Register,” whose low bits give the core number). Appendix A covers the instructions you need.
Tip: The example/reference code’s comments cite specific page and section numbers (e.g. “p. 175ff, §13” for the UART, “p. 90ff, §6.1” for GPIO). Use those as a starting point, but verify against the manual. Develop the habit of citing the manual in your own comments, so future-you knows where each magic number came from.