Changeset 5763454 in rtems-docs


Ignore:
Timestamp:
Jan 25, 2020, 5:14:14 PM (3 months ago)
Author:
G S Niteesh <gsnb.gn@…>
Branches:
master
Children:
2c37918
Parents:
536b2d9
git-author:
G S Niteesh <gsnb.gn@…> (01/25/20 17:14:14)
git-committer:
Christian Mauderer <oss@…> (02/15/20 18:58:59)
Message:

doc/raspberrypi: Added instructions for raspberrypi

Added instructions to run examples on raspberrypi.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • user/bsps/arm/raspberrypi.rst

    r536b2d9 r5763454  
    66===========
    77
    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.
     12
     13Setup SD card
     14----------------
     15
     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``.
     21
     22You must provide the required files for the GPU to proceed. These files
     23can be downloaded from
     24`the Raspberry Pi Firmware Repository <https://github.com/raspberrypi/firmware/tree/master/boot>`_.
     25You can remove the ``kernel*.img`` files if you want too, but don't touch
     26the other files.
     27
     28Copy these files in to a SD card with FAT filesystem.
     29
     30Kernel image
     31------------
     32
     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.
     36
     37To create the kernel image:
     38
     39.. code-block:: none
     40
     41     $ arm-rtems5-objcopy -Obinary hello.exe kernel.img
     42
     43Copy the kernel image to the SD card.
     44
     45Make sure you have these lines below, in your ``config.txt``.
     46
     47.. code-block:: none
     48
     49     enable-uart=1
     50     kernel_address=0x200000
     51     kernel=kernel.img
     52
     53Testing using QEMU
     54------------------
     55
     56QEMU can be built using RSB. Navigate to ``<SOURCE_BUILDER_DIR>/rtems``
     57and run this command.
     58
     59.. code-block:: none
     60
     61     $ ../source-builder/sb-set-builder --prefix=<TOOLCHAIN_DIR> devel/qemu4.bset
     62
     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,
     67
     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.
     71
     72Make sure your version of QEMU is newer than v2.6, because older ones don't
     73support Raspberry Pis.
     74
     75.. code-block:: none
     76
     77     $ qemu-system-arm -M raspi2 -m 1G -kernel hello.exe -serial mon:stdio -nographic -S -s
     78
     79This starts QEMU and creates a socket at port ``localhost:1234`` for GDB to
     80connect.
     81
     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.
     84
     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
     89
     90We need to pass in the DTB file to GDB before running the example.
     91
     92In a new terminal, run GDB using
     93
     94.. code-block:: none
     95
     96     $ arm-rtems5-gdb hello.exe
     97
     98This will open GDB and will load the symbol table from hello.exe. Issue the
     99following commands in the GDB prompt.
     100
     101.. code-block:: none
     102
     103     (gdb) tar remote:1234
     104     (gdb) load
     105     (gdb) restore bcm2709-rpi-2-b.dtb binary 0x2ef00000
     106     (gdb) set $r2 = 0x2ef00000
     107
     108This will connect GDB to QEMU and will load the DTB file and the application.
     109
     110.. code-block:: none
     111
     112     (gdb) continue
     113
     114The ``continue`` command will run the executable.
     115
     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.