<div dir="ltr"><div>Hi Noor, </div><div>Looks good and builds for me - I have a few minor comments. Please see inline comments below.</div><div>Thanks,</div><div>Alan</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Oct 5, 2022 at 1:41 AM Mohd Noor Aman <<a href="mailto:nooraman5718@gmail.com">nooraman5718@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">This patch adds the relevant documentations required for booting the new BSP.<br>
JTAG support is added for debugging. I have built the HTML docs and verified<br>
them.<br>
---<br>
user/bsps/aarch64/raspberrypi4.rst | 99 ++++++++++++++++++++++++++++++<br>
user/bsps/bsps-aarch64.rst | 1 +<br>
2 files changed, 100 insertions(+)<br>
create mode 100644 user/bsps/aarch64/raspberrypi4.rst<br>
<br>
diff --git a/user/bsps/aarch64/raspberrypi4.rst b/user/bsps/aarch64/raspberrypi4.rst<br>
new file mode 100644<br>
index 0000000..5a45c65<br>
--- /dev/null<br>
+++ b/user/bsps/aarch64/raspberrypi4.rst<br>
@@ -0,0 +1,99 @@<br>
+.. SPDX-License-Identifier: CC-BY-SA-4.0<br>
+<br>
+.. Copyright (C) 2022 Mohd Noor Aman<br>
+<br>
+.. _BSP_aarch64_Raspberrypi_4:<br>
+<br>
+Raspberry Pi 4B<br>
+===============<br>
+<br>
+The 'raspberrypi4b' BSP currently supports only the LP64 ABI. ILP32 is not </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+supported. Raspberry pi 4B all variants and Raspberry Pi 400 are supported. The<br>
+default bootloader which is used by the Raspbian OS or other OS can be used to<br>
+boot the RTEMS. Currently, QEMU emulation is not supported. <br>
</blockquote><div>I would change "boot the RTEMS" to "boot RTEMS"</div><div>Is the RPI4 supported in QEMU? If not, then I would remove that sentence.</div><div>Should you mention that SMP is currently not supported, or is that going to be easy enough to add in the future? </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">+<br>
+Clock Driver<br>
+------------<br>
+<br>
+The clock driver uses the `ARM Generic Timer`.<br>
+<br></blockquote><div>Which interrupt controller is used? GIC or legacy Raspberry Pi? Worth putting that here?</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+Console Driver<br>
+--------------<br>
+<br>
+Raspberry pi 4B has 2 types of UARTs, ARM PL011 and Mini-uart. The PL011 is a<br>
+capable, broadly 16550-compatible UART, while the mini UART has a reduced<br>
+feature set. The console driver supports the default Qemu emulated ARM PL011<br>
+PrimeCell UART as well as the physical ARM PL011 PrimeCell UART in the<br>
+raspberrypi hardware. Mini-uart is not supported.<br>
+<br>
+Preparing to boot<br>
+------------------<br>
+<br>
+Raspberry Pi uses a different mechanism to boot. First the GPU initializes,<br>
+loads the bootloader and then looks for the kernel img. By default the arm64<br>
+mode looks for the ``kernel8.img``. Any other kernel can be loaded by adding<br>
+`kernel=<img_name>` to the ``config.txt``.<br></blockquote><div>I would change the last line to: "to the config.txt file"</div><div>Also, some instances of config.txt are highlighted, but others are not. Do you want to make them all the same? </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+<br>
+The Firmware files are required in order to boot RTEMS. The latest firmware can<br>
+be downloaded from the `Raspberry Pi Firmware Repository<br>
+<<a href="https://github.com/raspberrypi/firmware/" rel="noreferrer" target="_blank">https://github.com/raspberrypi/firmware/</a>>`_. USB boot is supported. All the<br>
+files (Firmwares and kernel) must be place in the FAT32 partition only. Add<br>
+``arm_64bit=1`` in the config.txt file in order to boot the BSP in 64bit kernel<br>
+mode.</blockquote><div>I am still using the Arm Trusted Firmware bl31.bin to boot RTEMS. If that is still required, that should be added here. </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <br>
+<br>
+<br>
+UART Setup<br>
+^^^^^^^^^^<br>
+<br>
+Connect your serial device to the GPIO15 and GPIO14. Add the following to the<br>
+config.txt file in order to use the PL011 UART0 and thus disabling the default<br>
+Mini-uart.<br>
+<br>
+.. code-block:: none<br>
+<br>
+ dtoverlay = disable-bt<br>
+ enable_uart=1<br>
+<br>
+.. note:: <br>
+ The Raspberry Pi 4B and 400 have an additional four PL011 UARTs. They are not <br>
+ supported.<br>
+<br>
+Generating kernel image <br>
+^^^^^^^^^^^^^^^^^^^^^^^<br>
+<br>
+The following steps show how to run ``hello.exe`` on the BSP. Other executables<br>
+can be processed in a similar way.<br>
+<br>
+To create the kernel image:<br>
+<br>
+.. code-block:: shell<br>
+<br>
+ $ aarch64-rtems@rtems-ver-major@-objcopy -Obinary hello.exe kernel8.img<br>
+<br>
+Copy the kernel image to the SD card.<br>
+<br>
+JTAG Setup<br>
+----------<br>
+<br>
+The Raspberry Pi 4 doesn't have dedicated JTAG pins. Instead, you must configure<br>
+the GPIO pins (GPIO22-GPIO27) to activate the JTAG functionality. The RPi 4<br>
+documentation refers to this as Alt4 functions of those pins. Alt5 does exist<br>
+too, which goes from GPIO4, 5, 6, 12 and 13. you can check this out from<br>
+`<a href="http://pinout.xyz" rel="noreferrer" target="_blank">pinout.xyz</a> <<a href="https://pinout.xyz/pinout/jtag#" rel="noreferrer" target="_blank">https://pinout.xyz/pinout/jtag#</a>>`_ or `eLinux<br>
+<<a href="https://elinux.org/RPi_BCM2835_GPIOs" rel="noreferrer" target="_blank">https://elinux.org/RPi_BCM2835_GPIOs</a>>`_<br>
+<br>
+One more thing to note on JTAG with Raspberry pi 4B is that, by default, All the<br>
+GPIO pins are pulled down, according to the `BCM2711 documentation<br>
+<<a href="https://datasheets.raspberrypi.com/bcm2711/bcm2711-peripherals.pdf" rel="noreferrer" target="_blank">https://datasheets.raspberrypi.com/bcm2711/bcm2711-peripherals.pdf</a>>`_. This<br>
+wasn't the case in the earlier models. So in order to let the data flow freely,<br>
+we will have to disable them.<br>
+<br>
+.. code-block:: none<br>
+<br>
+ # Disable pull downs<br>
+ gpio=22-27=np<br>
+<br>
+ # Enable jtag pins (i.e. GPIO22-GPIO27)<br>
+ enable_jtag_gpio=1<br>
+<br>
+<br>
diff --git a/user/bsps/bsps-aarch64.rst b/user/bsps/bsps-aarch64.rst<br>
index 933370f..f3aa15c 100644<br>
--- a/user/bsps/bsps-aarch64.rst<br>
+++ b/user/bsps/bsps-aarch64.rst<br>
@@ -9,3 +9,4 @@ aarch64 (AArch64)<br>
.. include:: aarch64/a72.rst<br>
.. include:: aarch64/xilinx-versal.rst<br>
.. include:: aarch64/xilinx-zynqmp.rst<br>
+.. include:: aarch64/raspberrypi4.rst<br>
\ No newline at end of file<br>
-- <br>
2.37.3<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>