Raspberry Pi 4B
Warning
The board support for this device is experimental. Not all features are implemented and they have not been extensively tested by many users.
Help is wanted if you are interested in supporting a feature or if you’ve found an issue with any of the implementation! See the contributing guidelines.
The Raspberry Pi 4B is an ARM64 hobbyist board created by Raspberry Pi.
 
Features
- Broadcom BCM2711 @1.8GHz 
- 1, 2, 4 and 8GB LPDDR4-3200 SDRAM models 
- 2.4GHz and 5.0GHz IEEE 802.11ac wireless 
- Bluetooth 5.0 
- Gigabit Ethernet 
- 2 USB 3.0 ports 
- 2 USB 2.0 ports 
- 2 micro-HDMI ports (4kp60) 
- 2-lane MIPI DSI display port 
- 2-lane MIPI CSI camera port 
- 4-pole stereo audio and composite video port 
- Micro SD card slot 
Board Peripheral Support
SMP is currently unsupported. To see support for chip peripherals (I2C, SPI, UART, etc), see the BCM2711 page
NuttX for the Raspberry Pi 4 supports these on-board peripherals:
| Peripheral | Support | 
|---|---|
| AV port | No | 
| HDMI | No | 
| WiFi | No | 
| Ethernet | No | 
| USB 3.0 | No | 
| USB 2.0 | No | 
| Bluetooth | No | 
| microSD card | Yes (see notes in BCM2711 page) | 
Power Supply
The board can be supplied power either through the USB-C connection (5V) or via the 5V power input pin.
Installation
Before building NuttX for the Raspberry Pi 4B, download the ARM64 Toolchain for
AArch64 Bare-Metal Target aarch64-none-elf from
Arm GNU Toolchain Downloads.
(Skip the section for Beta Releases.)
Add the downloaded toolchain gcc-arm-...-aarch64-none-elf/bin to the PATH Environment Variable.
If you are running Arch Linux, you can also get the toolchain by installing from the AUR:
$ yay -S aarch64-none-elf-gcc-bin aarch64-none-elf-toolchain
Check the ARM64 Toolchain:
$ aarch64-none-elf-gcc -v
Flashing
In order to boot NuttX on the Raspberry Pi 4B, you will need to have a formatted micro SD card. The SD card should
contain a FAT32 partition that is marked as bootable and which contains the generated nuttx.bin and config.txt
files from the build process. In addition to those files, you will also need the following files from the Raspberry Pi
repository for loading the image:
You can download all of these files with the shell script in tools/bcm2711/bootfiles.sh.
SD Card Formatting
Here is a list of fdisk commands for formatting the SD card on Linux. The tutorial assumes the SD card is at
/dev/sda, but you can find the location of your SD card with lsblk. Make very sure you verify that the name is
correct, or you can lose data by formatting a different device.
$ sudo fdisk /dev/sda
Print the partition table on the card with p to see what’s there. If anything appears, continue to use the d
command to remove all partitions.
- oto create a new, empty DOS partition table
- nto create a new partition
- pto make it primary
- Hit enter to select the default partition of “1” 
- Hit enter for the default start and end sizes, which will use the full SD card size 
- tto change the type of the partition (hit enter to select default of partition 1)
- cas the type, which is for Windows FAT32
- ato mark the partition as bootable
- wto write all the changes and save
Now when you run lsblk, you should see /dev/sda1 (or an equivalent for your SD card). That is the new partition
just created. Running the following command will then format the SD card to an empty FAT32 file system.
$ sudo mkfs.vfat /dev/sda1
Once this completes, you can copy all of the aforementioned boot files, nuttx.bin and config.txt to your SD card
in your preferred way (through a file explorer or by using mount).
Once all the files are copied, you can then eject the SD card and insert it onto your Raspberry Pi. The default console is the Mini UART, which requires an adapter such as USB to TTL serial converter cable to read. You should connect the ground to one of the Pi’s ground pins, and then connect the RX to GPIO 14 and TX to GPIO 15. Do not connect the red power wire.
Once the converter is connected and plugged into your host computer, you can open up a serial terminal of your choice. I use Minicom. Then, power your Raspberry Pi 4B with a USB-C cable and wait for the Pi to boot and the NSH prompt to appear onscreen:
NuttShell (NSH) NuttX-12.6.0-RC0
nsh> uname -a
NuttX 12.6.0-RC0 c4f3a42131-dirty Aug  6 2024 21:17:01 arm64 raspberrypi-4b
nsh>
Configurations
You can configure NuttX for the Raspberry Pi 4B using the following command:
$ ./tools/configure.sh raspberrypi-4b:<config>
Where <config> is one of the configurations listed below.
nsh
A simple configuration with NSH on the Mini-UART console, accessible using a TTL cable connected to GPIO 14 & 15.
sd
Configuration which supports the microSD card peripheral on EMMC2. At boot time,
the microSD card is identified and the boot partition is mounted as a FAT file
system to /sd. It can be written to and read from.
Warning
There is some instability with the microSD card functionality. Please see BCM2711 for more information.
Note
This configuration enables BSD components since the sdstress application is BSD licensed.