Changeset 5763454 in rtems-docs

Jan 25, 2020, 5:14:14 PM (3 months ago)
G S Niteesh <…>
G S Niteesh <…> (01/25/20 17:14:14)
Christian Mauderer <oss@…> (02/15/20 18:58:59)

doc/raspberrypi: Added instructions for raspberrypi

Added instructions to run examples on raspberrypi.

1 edited


  • user/bsps/arm/raspberrypi.rst

    r536b2d9 r5763454  
    8 TODO.
     8This BSP supports `Raspberry Pi 1` and `Raspberry Pi 2` currently.
     9The support for `Raspberry Pi 3` is work under progress.
     10The default bootloader on the Raspberry Pi which is used to boot Raspbian
     11or other OS can be also used to boot RTEMS. U-boot can also be used.
     13Setup SD card
     16The Raspberry Pis have an unconventional booting mechanism. The GPU
     17boots first, initializes itself, runs the bootloader and starts the CPU.
     18The bootloader looks for a kernel image, by default the kernel images must
     19have a name of the form ``kernel*.img`` but this can be changed by adding
     20`kernel=<img_name>` to ``config.txt``.
     22You must provide the required files for the GPU to proceed. These files
     23can be downloaded from
     24`the Raspberry Pi Firmware Repository <>`_.
     25You can remove the ``kernel*.img`` files if you want too, but don't touch
     26the other files.
     28Copy these files in to a SD card with FAT filesystem.
     30Kernel image
     33The following steps show how to run ``hello.exe`` on a Raspberry Pi 2.
     34The same instructions can be applied to Raspberry Pi 1 also.
     35Other executables can be processed in a similar way.
     37To create the kernel image:
     39.. code-block:: none
     41     $ arm-rtems5-objcopy -Obinary hello.exe kernel.img
     43Copy the kernel image to the SD card.
     45Make sure you have these lines below, in your ``config.txt``.
     47.. code-block:: none
     49     enable-uart=1
     50     kernel_address=0x200000
     51     kernel=kernel.img
     53Testing using QEMU
     56QEMU can be built using RSB. Navigate to ``<SOURCE_BUILDER_DIR>/rtems``
     57and run this command.
     59.. code-block:: none
     61     $ ../source-builder/sb-set-builder --prefix=<TOOLCHAIN_DIR> devel/qemu4.bset
     63**Note**: Replace ``<SOURCE_BUILDER_DIR>`` and ``<TOOLCHAIN_DIR>`` with the
     64correct path of the directories. For example, if you used quick-start section
     65as your reference, these two will be ``$HOME/quick-start/src/rsb`` and
     66``$HOME/quick-start/rtems/5`` respectively,
     68QEMU along with GDB can be used for debugging, but it only supports
     69Raspberry Pi 2 and the emulation is also incomplete. So some of the
     70features might not work as expected.
     72Make sure your version of QEMU is newer than v2.6, because older ones don't
     73support Raspberry Pis.
     75.. code-block:: none
     77     $ qemu-system-arm -M raspi2 -m 1G -kernel hello.exe -serial mon:stdio -nographic -S -s
     79This starts QEMU and creates a socket at port ``localhost:1234`` for GDB to
     82The Device Tree Blob (DTB) is needed to load the device tree while starting up
     83the kernel. The BSP uses information from this file to initialize the drivers.
     85Make sure you pass in the correct DTB file. There are currently two version of
     86DTB for the Raspberry Pi 2 ``bcm2709-rpi-2-b.dtb`` and ``bcm2710-rpi-2-b.dtb``.
     87The ``bcm2709-rpi-2-b.dtb`` is for Raspberry Pi 2 Model B and
     88``bcm2710-rpi-2-b.dtb`` is for Raspberry Pi 2 Model B v1.2
     90We need to pass in the DTB file to GDB before running the example.
     92In a new terminal, run GDB using
     94.. code-block:: none
     96     $ arm-rtems5-gdb hello.exe
     98This will open GDB and will load the symbol table from hello.exe. Issue the
     99following commands in the GDB prompt.
     101.. code-block:: none
     103     (gdb) tar remote:1234
     104     (gdb) load
     105     (gdb) restore bcm2709-rpi-2-b.dtb binary 0x2ef00000
     106     (gdb) set $r2 = 0x2ef00000
     108This will connect GDB to QEMU and will load the DTB file and the application.
     110.. code-block:: none
     112     (gdb) continue
     114The ``continue`` command will run the executable.
     116**Note**: Add ``set scheduler-locking on`` in GDB if you have any issues
     117running the examples.
Note: See TracChangeset for help on using the changeset viewer.