<div dir="ltr"><div dir="ltr">On Thu, Feb 13, 2020 at 10:40 PM Alan Cudmore <<a href="mailto:alan.cudmore@gmail.com">alan.cudmore@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Niteesh,<br>
I have followed your instructions for getting RTEMS running on the Pi<br>
1 and 2. SMP currently is not working on the 2 for me, but that is not<br>
a problem with these instructions.<br>
I started to try running on QEMU following your instructions but have<br>
not been able to get time to complete my tests.</blockquote><div>What problem are you exactly facing? </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <br></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
But this is a vast improvement over "TODO", so I recommend accepting<br>
this change.<br>
<br>
Thanks for creating this,<br>
Alan<br>
<br>
On Thu, Feb 13, 2020 at 1:49 AM G. S. Niteesh <<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>> wrote:<br>
><br>
> Can someone take a look at this, It has been unnoticed for quite a while.<br>
><br>
> Thank you,<br>
> Niteesh<br>
><br>
> On Sat, Jan 25, 2020 at 10:49 PM G S Niteesh <<a href="mailto:gsnb.gn@gmail.com" target="_blank">gsnb.gn@gmail.com</a>> wrote:<br>
>><br>
>> Added instructions to run examples on raspberrypi.<br>
>> ---<br>
>> user/bsps/arm/raspberrypi.rst | 111 +++++++++++++++++++++++++++++++++-<br>
>> 1 file changed, 110 insertions(+), 1 deletion(-)<br>
>><br>
>> diff --git a/user/bsps/arm/raspberrypi.rst b/user/bsps/arm/raspberrypi.rst<br>
>> index 4ef75bd..72889a5 100644<br>
>> --- a/user/bsps/arm/raspberrypi.rst<br>
>> +++ b/user/bsps/arm/raspberrypi.rst<br>
>> @@ -5,4 +5,113 @@<br>
>> raspberrypi<br>
>> ===========<br>
>><br>
>> -TODO.<br>
>> +This BSP supports `Raspberry Pi 1` and `Raspberry Pi 2` currently.<br>
>> +The support for `Raspberry Pi 3` is work under progress.<br>
>> +The default bootloader on the Raspberry Pi which is used to boot Raspbian<br>
>> +or other OS can be also used to boot RTEMS. U-boot can also be used.<br>
>> +<br>
>> +Setup SD card<br>
>> +----------------<br>
>> +<br>
>> +The Raspberry Pis have an unconventional booting mechanism. The GPU<br>
>> +boots first, initializes itself, runs the bootloader and starts the CPU.<br>
>> +The bootloader looks for a kernel image, by default the kernel images must<br>
>> +have a name of the form ``kernel*.img`` but this can be changed by adding<br>
>> +`kernel=<img_name>` to ``config.txt``.<br>
>> +<br>
>> +You must provide the required files for the GPU to proceed. These files<br>
>> +can be downloaded from<br>
>> +`the Raspberry Pi Firmware Repository <<a href="https://github.com/raspberrypi/firmware/tree/master/boot" rel="noreferrer" target="_blank">https://github.com/raspberrypi/firmware/tree/master/boot</a>>`_.<br>
>> +You can remove the ``kernel*.img`` files if you want too, but don't touch<br>
>> +the other files.<br>
>> +<br>
>> +Copy these files in to a SD card with FAT filesystem.<br>
>> +<br>
>> +Kernel image<br>
>> +------------<br>
>> +<br>
>> +The following steps show how to run ``hello.exe`` on a Raspberry Pi 2.<br>
>> +The same instructions can be applied to Raspberry Pi 1 also.<br>
>> +Other executables can be processed in a similar way.<br>
>> +<br>
>> +To create the kernel image:<br>
>> +<br>
>> +.. code-block:: none<br>
>> +<br>
>> + $ arm-rtems5-objcopy -Obinary hello.exe kernel.img<br>
>> +<br>
>> +Copy the kernel image to the SD card.<br>
>> +<br>
>> +Make sure you have these lines below, in your ``config.txt``.<br>
>> +<br>
>> +.. code-block:: none<br>
>> +<br>
>> + enable-uart=1<br>
>> + kernel_address=0x200000<br>
>> + kernel=kernel.img<br>
>> +<br>
>> +Testing using QEMU<br>
>> +------------------<br>
>> +<br>
>> +QEMU can be built using RSB. Navigate to ``<SOURCE_BUILDER_DIR>/rtems``<br>
>> +and run this command.<br>
>> +<br>
>> +.. code-block:: none<br>
>> +<br>
>> + $ ../source-builder/sb-set-builder --prefix=<TOOLCHAIN_DIR> devel/qemu4.bset<br>
>> +<br>
>> +**Note**: Replace ``<SOURCE_BUILDER_DIR>`` and ``<TOOLCHAIN_DIR>`` with the<br>
>> +correct path of the directories. For example, if you used quick-start section<br>
>> +as your reference, these two will be ``$HOME/quick-start/src/rsb`` and<br>
>> +``$HOME/quick-start/rtems/5`` respectively,<br>
>> +<br>
>> +QEMU along with GDB can be used for debugging, but it only supports<br>
>> +Raspberry Pi 2 and the emulation is also incomplete. So some of the<br>
>> +features might not work as expected.<br>
>> +<br>
>> +Make sure your version of QEMU is newer than v2.6, because older ones don't<br>
>> +support Raspberry Pis.<br>
>> +<br>
>> +.. code-block:: none<br>
>> +<br>
>> + $ qemu-system-arm -M raspi2 -m 1G -kernel hello.exe -serial mon:stdio -nographic -S -s<br>
>> +<br>
>> +This starts QEMU and creates a socket at port ``localhost:1234`` for GDB to<br>
>> +connect.<br>
>> +<br>
>> +The Device Tree Blob (DTB) is needed to load the device tree while starting up<br>
>> +the kernel. The BSP uses information from this file to initialize the drivers.<br>
>> +<br>
>> +Make sure you pass in the correct DTB file. There are currently two version of<br>
>> +DTB for the Raspberry Pi 2 ``bcm2709-rpi-2-b.dtb`` and ``bcm2710-rpi-2-b.dtb``.<br>
>> +The ``bcm2709-rpi-2-b.dtb`` is for Raspberry Pi 2 Model B and<br>
>> +``bcm2710-rpi-2-b.dtb`` is for Raspberry Pi 2 Model B v1.2<br>
>> +<br>
>> +We need to pass in the DTB file to GDB before running the example.<br>
>> +<br>
>> +In a new terminal, run GDB using<br>
>> +<br>
>> +.. code-block:: none<br>
>> +<br>
>> + $ arm-rtems5-gdb hello.exe<br>
>> +<br>
>> +This will open GDB and will load the symbol table from hello.exe. Issue the<br>
>> +following commands in the GDB prompt.<br>
>> +<br>
>> +.. code-block:: none<br>
>> +<br>
>> + (gdb) tar remote:1234<br>
>> + (gdb) load<br>
>> + (gdb) restore bcm2709-rpi-2-b.dtb binary 0x2ef00000<br>
>> + (gdb) set $r2 = 0x2ef00000<br>
>> +<br>
>> +This will connect GDB to QEMU and will load the DTB file and the application.<br>
>> +<br>
>> +.. code-block:: none<br>
>> +<br>
>> + (gdb) continue<br>
>> +<br>
>> +The ``continue`` command will run the executable.<br>
>> +<br>
>> +**Note**: Add ``set scheduler-locking on`` in GDB if you have any issues<br>
>> +running the examples.<br>
>> --<br>
>> 2.17.1<br>
>><br>
> _______________________________________________<br>
> devel mailing list<br>
> <a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
> <a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a><br>
</blockquote></div></div>