Difference between revisions of "RPi Software"

From eLinux.org
Jump to: navigation, search
(Substantial rewrite - Added summary of software components and boot process. Replaced information covered in other pages with links. Removed / updated out-of-date remarks.)
(Added emulation section to cover QEMU (transferred from Development environments))
Line 68: Line 68:
A number of development environments are available depending on which language you are writing - see the [[RPi_Programming|programming]] page.
A number of development environments are available depending on which language you are writing - see the [[RPi_Programming|programming]] page.
The ARM processor on the RPi can be emulated using QEMU. See [http://cronicasredux.blogspot.co.uk/2011/09/installing-and-running-debian-armel-on.html emercer's tutorial], and also [http://www.raspberrypi.org/forum/projects-and-collaboration-general/emulating-a-raspi-on-windows this discussion].

Revision as of 11:46, 24 November 2012

Back to the Hub.

Software & Distributions:

Software - an overview.

Distributions - operating systems and development environments for the Raspberry Pi.

Kernel Compilation - advice on compiling a kernel.

Performance - measures of the Raspberry Pi's performance.

Programming - programming languages that might be used on the Raspberry Pi.


If you just want a working system, all that is required is a correctly formatted SD card. For details on how to create or get one, please see the Hardware Basic Setup page.

In order to understand the software compoonents in the RPi, you should first understand how it boots up. At power-up, the CPU is offline, and a small RISC core on the GPU is responsible for booting the SoC, therefore most of the boot components are actually run on the GPU code, not the CPU.

The boot order and components are as follows:

  • First stage bootloader - This is used to mount the FAT32 boot partition on the SD card so that the second stage bootloader can be accessed. It is programmed into the SoC itself during manufacture of the RPi and cannot be reprogrammed by a user.
  • Second stage bootloader (bootcode.bin) - This is used to retrieve the GPU firmware from the SD card, program the firmware, then start the GPU.
  • GPU firmware (start.elf) - Once loaded, this allows the GPU to start up the CPU. An additional file, fixup.dat, is used to configure the SDRAM partition between the GPU and the CPU. At this point, the CPU is release from reset and execution is transferred over.
  • User code - This can be one of any number of binaries. By default, it is the Linux kernel (usually named kernel.img), but it can also be another bootloader (e.g. U-Boot), or a bare-bones application.

Prior to 19th October 2012, there was previously also a third stage bootloader (loader.bin) but this is no longer required. [1]

Because of this boot process, use of an SD card to boot the RPi is mandatory. This does however mean that you cannot 'brick' the device.

GPU bootloaders

Currently all of the GPU software and firmware is supplied in binary format. It can be downloaded from the RPI firmware section on GitHub. At this time, the source code is not available.


Main page: Distributions

SD card images of a number of pre-built distributions including Raspbian (the RPi official distribution based on Debian), Arch Linux ARM, and RISC OS are available from the Raspberry Pi foundation website. Pre-loaded SD cards are also available from The Pi Hut.

Raspbian is the recommended distribution.


Main page: RPi Kernel Compilation

The kernel is sources can be obtained from the RPI linux section on GitHub


The Broadcom processor on Raspberry Pi contains an ARM v6 general purpose processor and a Broadcom VideoCore IV GPU. No data is currently available on other cores (if any) available in the BCM2835.


There is broad compiler support for the ARM processor including GCC - please see ARM Compilers. There are also a number of cross-compiler toolchains - please see toolchains.

The gcc compiler flags which will produce the most optimal code for the RPi are:

-Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s

-Ofast may produce compile errors for some programs. In this case, -O3 or -O2 should be used instead. Note that -mcpu=arm1176jzf-s can be used in place of -march=armv6zk -mtune=arm1176jzf-s.

If you want to generate a relatively up-to-date compiler that uses the optimal flags by default, you can roll your own version of Linaro GCC - see RPi Linaro GCC Compilation.


The GPU provides APIs for Open GL ES 2.0, hardware-accelerated OpenVG, and 1080p30 H.264 high-profile decode.

The GPU is capable of 1Gpixel/s, 1.5Gtexel/s or 24 GFLOPs of general purpose compute and features a bunch of texture filtering and DMA infrastructure - the Raspberry Pi team are looking at how they can make this available to application programmers. For the documentation on some Broadcom APIs exposed to control the GPU, see RPi VideoCore APIs.

The GPU blob is an 18MB elf file, including libraries. It does an awful lot. [2]


There is a DSP, but there isn't currently a public API (Liz thinks the BC team are keen to make one available at some point).


A large number of benchmark results are available on the performance page.


A number of development environments are available depending on which language you are writing - see the programming page.


The ARM processor on the RPi can be emulated using QEMU. See emercer's tutorial, and also this discussion.


  1. https://github.com/raspberrypi/firmware/commit/c57ea9dd367f12bf4fb41b7b86806a2dc6281176
  2. http://www.raspberrypi.org/?page_id=43&mingleforumaction=viewtopic&t=247