The Raspberry Pi 4 is based on the ARM Cortex-A72 processor which uses the ARMv8-A 64-bit instruction set architecture. This makes the Raspberry Pi 4 an arm64 device rather than ARM.
Background on ARM architectures
ARM Holdings designs processor architectures and licenses them to companies like Broadcom who manufacture the actual chips. There have been multiple generations of ARM architectures over the years:
- ARMv3 – Released in 1997, used in early mobile phones and PDAs.
- ARMv5 – Released in 1999, added more instructions and Thumb mode for better code density.
- ARMv6 – Released in 2002, included SIMD media instructions.
- ARMv7 – Released in 2005, first ARM architecture with a virtual memory system.
- ARMv8 – Released in 2011, first 64-bit capable ARM architecture.
Each architecture builds upon the last, maintaining backwards compatibility while adding new features. The ARMv7 and ARMv8 architectures also have architecture profiles that offer different tradeoffs in terms of features and implementation complexity:
- A-profile – Application processors like those used in mobile devices.
- R-profile – Real-time processors used in embedded systems.
- M-profile – Microcontroller profile with minimal features.
Within the ARMv8 architecture, there are two primary profiles used in modern system-on-chips (SoCs):
- ARMv8-A – Successor to ARMv7-A with 64-bit support.
- ARMv8-R – Successor to ARMv7-R with 64-bit support.
32-bit ARM vs 64-bit arm64
Prior to ARMv8, ARM architectures were 32-bit only. The 32-bit ARM architectures use the ARM instruction set. With ARMv8 came the addition of 64-bit registers and a new 64-bit instruction set called A64.
For backwards compatibility, ARMv8 retained the original 32-bit ARM instruction set. This allows the same processors to support both 32-bit ARM and 64-bit A64 instructions. The 64-bit A64 instruction set and supporting architecture is referred to as “arm64” while the 32-bit ARM instruction set is still just referred to as “ARM”.
- ARM – Refers to 32-bit ARM processors and instruction set
- arm64 – Refers to 64-bit ARM processors and A64 instruction set
The same ARMv8 Cortex-A72 processor inside the Raspberry Pi 4 can run either ARM or arm64 instructions. When running in 64-bit mode using the A64 instruction set, it is referred to as arm64. When running in 32-bit mode using the original ARM instruction set, it is still referred to as ARM.
Raspberry Pi 4 processor
The Raspberry Pi 4 uses the Broadcom BCM2711 SoC with a quad-core Cortex-A72 processor. The Cortex-A72 is an ARMv8-A processor capable of running both ARM and arm64 code. But unlike earlier Raspberry Pi models, the Raspberry Pi 4 defaults to 64-bit arm64 mode.
Previous Raspberry Pi boards used 32-bit ARM processors not capable of running the 64-bit arm64 code:
- Raspberry Pi 1 and Zero – ARMv6
- Raspberry Pi 2 – ARMv7
- Raspberry Pi 3 – ARMv8-A (32-bit)
The Raspberry Pi 4 was the first Raspberry Pi with a 64-bit processor capable of running the 64-bit A64 instruction set. So while the previous Raspberry Pi boards were 32-bit ARM devices, the Raspberry Pi 4 is considered an arm64 device.
Checking architecture on Raspberry Pi
There are a few ways to check whether a Raspberry Pi is 32-bit ARM or 64-bit arm64 from the command line:
The uname command prints out system information including the architecture. On a Raspberry Pi 4 or 400 it will report arm64: $ uname -m arm64
On a 32-bit Raspberry Pi it would show ARM or armv7l instead: $ uname -m armv7l
The arch command also prints out the architecture name. Same results as above: $ arch arm64
The lscpu command prints out detailed CPU architecture information including the instruction set. On arm64 it will show aarch64: $ lscpu Architecture: aarch64
On 32-bit ARM it would show ARM instead: $ lscpu Architecture: armv7l
Running 32-bit ARM programs on 64-bit arm64
Even though the Raspberry Pi 4 is a 64-bit arm64 device, it can still run 32-bit ARM programs through backwards compatibility modes in the processor. However, running ARM programs on arm64 does incur some performance overhead compared to running natively.
When the Raspberry Pi 4 boots up, it defaults to 64-bit arm64 mode. To run 32-bit ARM programs:
- The processor has to switch to 32-bit mode.
- The ARM binaries have to be loaded and any ARM shared libraries they need.
- System calls have to go through compatibility layers.
This can add noticeable overhead compared to running ARM programs natively on a 32-bit ARM machine. Performance sensitive applications may want to rebuild their code to target 64-bit arm64 if they want maximum performance on the Pi 4.
That being said, most general purpose applications will run just fine on arm64 through backwards compatibility. The flexibility of being able to run both 64-bit arm64 and 32-bit ARM code is one of the major benefits of the ARMv8 architecture.
Advantages of 64-bit arm64
There are some key advantages of running applications natively on arm64 rather than 32-bit ARM on the Raspberry Pi:
- Access to 64-bit registers improves performance of certain workloads.
- Larger address space allows accessing more than 4GB of memory.
- Avoid performance overhead of backwards compatibility layers.
- Uses new optimized arm64 assembly instructions.
- Better long term support as ARM becomes legacy.
The ARM64 instruction set was redesigned and optimized compared to the 32-bit ARM instruction set. By switching to arm64, applications can take advantage of these new instructions and architectural improvements. The 64-bit registers also enable more efficient manipulation of 64-bit values.
Of course, the vast majority of general purpose applications don’t need access to over 4GB of memory or involve heavy math on 64-bit values. For those types of apps, staying with 32-bit ARM code may be fine. But compute intensive workloads like video encoding, 3D rendering, machine learning, cryptography, compression, etc can see good performance benefits from arm64.
The Raspberry Pi 4 Model B is an arm64 device, meaning it uses the 64-bit ARMv8-A instruction set. This is different than previous 32-bit only Raspberry Pi boards which used the ARM instruction set. While the Pi 4 is fully 64-bit capable, it can also run 32-bit ARM code through backwards compatibility modes.
For maximum performance though, applications should be recompiled to target the 64-bit arm64 instruction set. This allows them to take full advantage of the architectural improvements in ARMv8 and avoid any backwards compatibility overhead. So while the Pi 4 is technically arm64, it provides the flexibility to work with both 64-bit and 32-bit ARM code.