Re: [PATCH 0/4] New UART drivers for PL011 and Mini UART

2023-09-11 Thread Utkarsh Verma
A gentle reminder.

On Wed, Sep 6, 2023 at 8:31 AM Utkarsh Verma  wrote:

> A gentle reminder.
>
> Regards,
> Utkarsh
>
> On Thu, Aug 31, 2023 at 10:02 AM Utkarsh Verma 
> wrote:
>
>> A gentle reminder for this patch. Please have a look at this and let me
>> know what changes are required. Once this is merged, I have a few more
>> patches building upon this.
>>
>> Regards,
>> Utkarsh
>>
>> On Wed, Aug 30, 2023 at 9:47 AM Utkarsh Verma 
>> wrote:
>>
>>> This patch series adds two drivers, PL011 and Mini UART. Both support
>>> interrupts and implement the termios API.
>>>
>>> Why add a new driver for the PL011 when we already have one?
>>>
>>> The existing driver is a very basic one and uses memory-mapped structs
>>> to access the registers. This proved to be problematic for the
>>> 'aarch64/raspberrypi4b' BSP as the RPi 4B's MMU does not reserve the
>>> entirety of the space required by the PL011 register struct.
>>>
>>> Even the existing driver doesn't use all the struct members. So, in the
>>> new driver, macros were used instead. This has the benefit of minimalism
>>> and ensures that we only add tested features to the driver.
>>>
>>> This driver builds upon the PL011 driver present in the Xilinx Versal
>>> BSP and addresses the IRQ startup hack.
>>>
>>> In short, the new PL011 driver has the features provided by the
>>> existing driver, and it meshes well with the termios API.
>>>
>>> Lastly, there's one thing I need feedback on. The PL011 has a hardware
>>> limitation which requires me to invoke the IRQ handler manually, the
>>> first time. For this, I need access to the `tty` struct in the
>>> `write_buffer` function.
>>>
>>>
>>> https://github.com/UtkarshVerma/rtems/blob/uart-drivers/bsps/shared/dev/serial/pl011.c#L301
>>>
>>> For now, I store the tty in the device context and then pass the context
>>> to the IRQ handler. Is this a good approach? Are there better ways to do
>>> this?
>>>
>>> For convenience, feel free to check out my GitHub fork which has these
>>> changes:
>>>
>>> https://github.com/UtkarshVerma/rtems/tree/uart-drivers
>>>
>>> Utkarsh Verma (4):
>>>   bsps/shared: Add new PL011 driver with IRQ support
>>>   bsps/shared: Add new Mini UART driver
>>>   spec: Add Mini UART and PL011 drivers to build spec
>>>   bsps: Update BSPs to use the new PL011 driver
>>>
>>>  bsps/aarch64/a53/console/console.c|  15 +-
>>>  bsps/aarch64/a72/console/console.c|  15 +-
>>>  bsps/aarch64/raspberrypi/console/console.c|  29 +-
>>>  bsps/arm/raspberrypi/console/console-config.c |  27 +-
>>>  .../realview-pbx-a9/console/console-polled.c  |   5 +-
>>>  .../arm/realview-pbx-a9/include/bsp/console.h |   4 +-
>>>  bsps/arm/xen/console/console.c|  15 +-
>>>  bsps/include/dev/serial/arm-pl011-regs.h  | 143 --
>>>  .../dev/serial/{arm-pl011.h => mini-uart.h}   |  52 +-
>>>  bsps/include/dev/serial/pl011.h   |  68 +++
>>>  bsps/shared/dev/serial/arm-pl011.c| 104 
>>>  bsps/shared/dev/serial/mini-uart.c| 316 
>>>  bsps/shared/dev/serial/pl011.c| 470 ++
>>>  .../aarch64/raspberrypi/bspraspberrypi4.yml   |   1 -
>>>  spec/build/bsps/obj.yml   |   7 +-
>>>  15 files changed, 934 insertions(+), 337 deletions(-)
>>>  delete mode 100644 bsps/include/dev/serial/arm-pl011-regs.h
>>>  rename bsps/include/dev/serial/{arm-pl011.h => mini-uart.h} (64%)
>>>  create mode 100644 bsps/include/dev/serial/pl011.h
>>>  delete mode 100644 bsps/shared/dev/serial/arm-pl011.c
>>>  create mode 100644 bsps/shared/dev/serial/mini-uart.c
>>>  create mode 100644 bsps/shared/dev/serial/pl011.c
>>>
>>> --
>>> 2.41.0
>>>
>>>
>>>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH 0/4] New UART drivers for PL011 and Mini UART

2023-09-05 Thread Utkarsh Verma
A gentle reminder.

Regards,
Utkarsh

On Thu, Aug 31, 2023 at 10:02 AM Utkarsh Verma 
wrote:

> A gentle reminder for this patch. Please have a look at this and let me
> know what changes are required. Once this is merged, I have a few more
> patches building upon this.
>
> Regards,
> Utkarsh
>
> On Wed, Aug 30, 2023 at 9:47 AM Utkarsh Verma 
> wrote:
>
>> This patch series adds two drivers, PL011 and Mini UART. Both support
>> interrupts and implement the termios API.
>>
>> Why add a new driver for the PL011 when we already have one?
>>
>> The existing driver is a very basic one and uses memory-mapped structs
>> to access the registers. This proved to be problematic for the
>> 'aarch64/raspberrypi4b' BSP as the RPi 4B's MMU does not reserve the
>> entirety of the space required by the PL011 register struct.
>>
>> Even the existing driver doesn't use all the struct members. So, in the
>> new driver, macros were used instead. This has the benefit of minimalism
>> and ensures that we only add tested features to the driver.
>>
>> This driver builds upon the PL011 driver present in the Xilinx Versal
>> BSP and addresses the IRQ startup hack.
>>
>> In short, the new PL011 driver has the features provided by the
>> existing driver, and it meshes well with the termios API.
>>
>> Lastly, there's one thing I need feedback on. The PL011 has a hardware
>> limitation which requires me to invoke the IRQ handler manually, the
>> first time. For this, I need access to the `tty` struct in the
>> `write_buffer` function.
>>
>>
>> https://github.com/UtkarshVerma/rtems/blob/uart-drivers/bsps/shared/dev/serial/pl011.c#L301
>>
>> For now, I store the tty in the device context and then pass the context
>> to the IRQ handler. Is this a good approach? Are there better ways to do
>> this?
>>
>> For convenience, feel free to check out my GitHub fork which has these
>> changes:
>>
>> https://github.com/UtkarshVerma/rtems/tree/uart-drivers
>>
>> Utkarsh Verma (4):
>>   bsps/shared: Add new PL011 driver with IRQ support
>>   bsps/shared: Add new Mini UART driver
>>   spec: Add Mini UART and PL011 drivers to build spec
>>   bsps: Update BSPs to use the new PL011 driver
>>
>>  bsps/aarch64/a53/console/console.c|  15 +-
>>  bsps/aarch64/a72/console/console.c|  15 +-
>>  bsps/aarch64/raspberrypi/console/console.c|  29 +-
>>  bsps/arm/raspberrypi/console/console-config.c |  27 +-
>>  .../realview-pbx-a9/console/console-polled.c  |   5 +-
>>  .../arm/realview-pbx-a9/include/bsp/console.h |   4 +-
>>  bsps/arm/xen/console/console.c|  15 +-
>>  bsps/include/dev/serial/arm-pl011-regs.h  | 143 --
>>  .../dev/serial/{arm-pl011.h => mini-uart.h}   |  52 +-
>>  bsps/include/dev/serial/pl011.h   |  68 +++
>>  bsps/shared/dev/serial/arm-pl011.c| 104 
>>  bsps/shared/dev/serial/mini-uart.c| 316 
>>  bsps/shared/dev/serial/pl011.c| 470 ++
>>  .../aarch64/raspberrypi/bspraspberrypi4.yml   |   1 -
>>  spec/build/bsps/obj.yml   |   7 +-
>>  15 files changed, 934 insertions(+), 337 deletions(-)
>>  delete mode 100644 bsps/include/dev/serial/arm-pl011-regs.h
>>  rename bsps/include/dev/serial/{arm-pl011.h => mini-uart.h} (64%)
>>  create mode 100644 bsps/include/dev/serial/pl011.h
>>  delete mode 100644 bsps/shared/dev/serial/arm-pl011.c
>>  create mode 100644 bsps/shared/dev/serial/mini-uart.c
>>  create mode 100644 bsps/shared/dev/serial/pl011.c
>>
>> --
>> 2.41.0
>>
>>
>>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH 0/4] New UART drivers for PL011 and Mini UART

2023-08-30 Thread Utkarsh Verma
A gentle reminder for this patch. Please have a look at this and let me
know what changes are required. Once this is merged, I have a few more
patches building upon this.

Regards,
Utkarsh

On Wed, Aug 30, 2023 at 9:47 AM Utkarsh Verma  wrote:

> This patch series adds two drivers, PL011 and Mini UART. Both support
> interrupts and implement the termios API.
>
> Why add a new driver for the PL011 when we already have one?
>
> The existing driver is a very basic one and uses memory-mapped structs
> to access the registers. This proved to be problematic for the
> 'aarch64/raspberrypi4b' BSP as the RPi 4B's MMU does not reserve the
> entirety of the space required by the PL011 register struct.
>
> Even the existing driver doesn't use all the struct members. So, in the
> new driver, macros were used instead. This has the benefit of minimalism
> and ensures that we only add tested features to the driver.
>
> This driver builds upon the PL011 driver present in the Xilinx Versal
> BSP and addresses the IRQ startup hack.
>
> In short, the new PL011 driver has the features provided by the
> existing driver, and it meshes well with the termios API.
>
> Lastly, there's one thing I need feedback on. The PL011 has a hardware
> limitation which requires me to invoke the IRQ handler manually, the
> first time. For this, I need access to the `tty` struct in the
> `write_buffer` function.
>
>
> https://github.com/UtkarshVerma/rtems/blob/uart-drivers/bsps/shared/dev/serial/pl011.c#L301
>
> For now, I store the tty in the device context and then pass the context
> to the IRQ handler. Is this a good approach? Are there better ways to do
> this?
>
> For convenience, feel free to check out my GitHub fork which has these
> changes:
>
> https://github.com/UtkarshVerma/rtems/tree/uart-drivers
>
> Utkarsh Verma (4):
>   bsps/shared: Add new PL011 driver with IRQ support
>   bsps/shared: Add new Mini UART driver
>   spec: Add Mini UART and PL011 drivers to build spec
>   bsps: Update BSPs to use the new PL011 driver
>
>  bsps/aarch64/a53/console/console.c|  15 +-
>  bsps/aarch64/a72/console/console.c|  15 +-
>  bsps/aarch64/raspberrypi/console/console.c|  29 +-
>  bsps/arm/raspberrypi/console/console-config.c |  27 +-
>  .../realview-pbx-a9/console/console-polled.c  |   5 +-
>  .../arm/realview-pbx-a9/include/bsp/console.h |   4 +-
>  bsps/arm/xen/console/console.c|  15 +-
>  bsps/include/dev/serial/arm-pl011-regs.h  | 143 --
>  .../dev/serial/{arm-pl011.h => mini-uart.h}   |  52 +-
>  bsps/include/dev/serial/pl011.h   |  68 +++
>  bsps/shared/dev/serial/arm-pl011.c| 104 
>  bsps/shared/dev/serial/mini-uart.c| 316 
>  bsps/shared/dev/serial/pl011.c| 470 ++
>  .../aarch64/raspberrypi/bspraspberrypi4.yml   |   1 -
>  spec/build/bsps/obj.yml   |   7 +-
>  15 files changed, 934 insertions(+), 337 deletions(-)
>  delete mode 100644 bsps/include/dev/serial/arm-pl011-regs.h
>  rename bsps/include/dev/serial/{arm-pl011.h => mini-uart.h} (64%)
>  create mode 100644 bsps/include/dev/serial/pl011.h
>  delete mode 100644 bsps/shared/dev/serial/arm-pl011.c
>  create mode 100644 bsps/shared/dev/serial/mini-uart.c
>  create mode 100644 bsps/shared/dev/serial/pl011.c
>
> --
> 2.41.0
>
>
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

[PATCH 4/4] bsps: Update BSPs to use the new PL011 driver

2023-08-29 Thread Utkarsh Verma
This commit updates the existing BSPs to use the new PL011 driver.
---
 bsps/aarch64/a53/console/console.c| 15 +-
 bsps/aarch64/a72/console/console.c| 15 +-
 bsps/aarch64/raspberrypi/console/console.c| 29 ---
 bsps/arm/raspberrypi/console/console-config.c | 27 -
 .../realview-pbx-a9/console/console-polled.c  |  5 ++--
 .../arm/realview-pbx-a9/include/bsp/console.h |  4 +--
 bsps/arm/xen/console/console.c| 15 +-
 7 files changed, 55 insertions(+), 55 deletions(-)

diff --git a/bsps/aarch64/a53/console/console.c 
b/bsps/aarch64/a53/console/console.c
index 1854909c98..4d3adf2a7e 100644
--- a/bsps/aarch64/a53/console/console.c
+++ b/bsps/aarch64/a53/console/console.c
@@ -37,14 +37,15 @@
 #include 
 
 #include 
-#include 
+#include 
 #include 
 
 #include 
 
-arm_pl011_context a53_qemu_vpl011_context = {
-  .base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("PL011"),
-  .regs = (volatile pl011 *) BSP_A53_QEMU_VPL011_BASE,
+pl011_context a53_qemu_vpl011_context = {
+  .context = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("PL011"),
+  .regs_base = BSP_A53_QEMU_VPL011_BASE,
+  /* FIXME: Add clock speed. Otherwise buadrate intialization will fail */
   .initial_baud = 115200
 };
 
@@ -52,8 +53,8 @@ const console_device console_device_table[] = {
   {
 .device_file = "/dev/ttyS0",
 .probe = console_device_probe_default,
-.handler = _pl011_fns,
-.context = _qemu_vpl011_context.base
+.handler = _handler,
+.context = _qemu_vpl011_context.context
   }
 };
 
@@ -61,7 +62,7 @@ const size_t console_device_count = 
RTEMS_ARRAY_SIZE(console_device_table);
 
 static void output_char( char c )
 {
-  arm_pl011_write_polled(_qemu_vpl011_context.base, c);
+  pl011_write_char_polled(_qemu_vpl011_context.context, c);
 }
 
 BSP_output_char_function_type BSP_output_char = output_char;
diff --git a/bsps/aarch64/a72/console/console.c 
b/bsps/aarch64/a72/console/console.c
index 08532d68cd..1207802b00 100644
--- a/bsps/aarch64/a72/console/console.c
+++ b/bsps/aarch64/a72/console/console.c
@@ -37,14 +37,15 @@
 #include 
 
 #include 
-#include 
+#include 
 #include 
 
 #include 
 
-arm_pl011_context a72_qemu_vpl011_context = {
-  .base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("PL011"),
-  .regs = (volatile pl011 *) BSP_A72_QEMU_VPL011_BASE,
+pl011_context a72_qemu_vpl011_context = {
+  .context = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("PL011"),
+  .regs_base = BSP_A72_QEMU_VPL011_BASE,
+  /* FIXME: Add clock speed. Otherwise buadrate intialization will fail */
   .initial_baud = 115200
 };
 
@@ -52,8 +53,8 @@ const console_device console_device_table[] = {
   {
 .device_file = "/dev/ttyS0",
 .probe = console_device_probe_default,
-.handler = _pl011_fns,
-.context = _qemu_vpl011_context.base
+.handler = _handler,
+.context = _qemu_vpl011_context.context
   }
 };
 
@@ -61,7 +62,7 @@ const size_t console_device_count = 
RTEMS_ARRAY_SIZE(console_device_table);
 
 static void output_char( char c )
 {
-  arm_pl011_write_polled(_qemu_vpl011_context.base, c);
+  pl011_write_char_polled(_qemu_vpl011_context.context, c);
 }
 
 BSP_output_char_function_type BSP_output_char = output_char;
diff --git a/bsps/aarch64/raspberrypi/console/console.c 
b/bsps/aarch64/raspberrypi/console/console.c
index 73bb0036ff..54a022be42 100644
--- a/bsps/aarch64/raspberrypi/console/console.c
+++ b/bsps/aarch64/raspberrypi/console/console.c
@@ -34,34 +34,29 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include 
-
 #include 
-#include 
 #include 
-
 #include 
+#include 
+#include 
 
-arm_pl011_context raspberrypi_4_context = {
-  .base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("PL011"),
-  .regs = (volatile pl011 *) BSP_RPI4_PL011_BASE,
+pl011_context raspberrypi_4_context = {
+  .context = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("PL011"),
+  .regs_base = BSP_RPI4_PL011_BASE,
+  .clock = 4800,
   .initial_baud = 115200
 };
 
 const console_device console_device_table[] = {
-  {
-.device_file = "/dev/ttyS0",
-.probe = console_device_probe_default,
-.handler = _pl011_fns,
-.context = _4_context.base
-  }
-};
+{.device_file = "/dev/ttyS0",
+ .probe   = console_device_probe_default,
+ .handler = _handler,
+ .context = _4_context.context}};
 
 const size_t console_device_count = RTEMS_ARRAY_SIZE(console_device_table);
 
-static void output_char( char c )
-{
-  arm_pl011_write_polled(_4_context.base, c);
+static void output_char(char c) {
+pl011_write_char_polled(_4_context.context, c);
 }
 
 BSP_output_char_function_type BSP_output_char = output_char;
diff --git a/bsps/arm/raspberrypi/console/console-config.c 
b/bsps/arm/raspberrypi/console/console-config.c
index 6b8eb80aa4..26997312a4 100644
--- a/bsps/arm/raspberrypi/console/console-config.c
+++ b/bsps/arm/raspberrypi/console/console-config.c
@@ -25,7 +25,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 

[PATCH 1/4] bsps/shared: Add new PL011 driver with IRQ support

2023-08-29 Thread Utkarsh Verma
R_CTSEN BSP_BIT32(15)
-#define PL011_UARTCR_RTSEN BSP_BIT32(14)
-#define PL011_UARTCR_OUT2 BSP_BIT32(13)
-#define PL011_UARTCR_OUT1 BSP_BIT32(12)
-#define PL011_UARTCR_RTS BSP_BIT32(11)
-#define PL011_UARTCR_DTR BSP_BIT32(10)
-#define PL011_UARTCR_RXE BSP_BIT32(9)
-#define PL011_UARTCR_TXE BSP_BIT32(8)
-#define PL011_UARTCR_LBE BSP_BIT32(7)
-#define PL011_UARTCR_SIRLP BSP_BIT32(3)
-#define PL011_UARTCR_SIREN BSP_BIT32(2)
-#define PL011_UARTCR_UARTEN BSP_BIT32(1)
-  uint32_t uartifls;
-#define PL011_UARTIFLS_RXIFLSEL(val) BSP_FLD32(val, 3, 5)
-#define PL011_UARTIFLS_RXIFLSEL_GET(reg) BSP_FLD32GET(reg, 3, 5)
-#define PL011_UARTIFLS_RXIFLSEL_SET(reg, val) BSP_FLD32SET(reg, val, 3, 5)
-#define PL011_UARTIFLS_TXIFLSEL(val) BSP_FLD32(val, 0, 2)
-#define PL011_UARTIFLS_TXIFLSEL_GET(reg) BSP_FLD32GET(reg, 0, 2)
-#define PL011_UARTIFLS_TXIFLSEL_SET(reg, val) BSP_FLD32SET(reg, val, 0, 2)
-  uint32_t uartimsc;
-  uint32_t uartris;
-  uint32_t uartmis;
-  uint32_t uarticr;
-#define PL011_UARTI_OEI BSP_BIT32(10)
-#define PL011_UARTI_BEI BSP_BIT32(9)
-#define PL011_UARTI_PEI BSP_BIT32(8)
-#define PL011_UARTI_FEI BSP_BIT32(7)
-#define PL011_UARTI_RTI BSP_BIT32(6)
-#define PL011_UARTI_TXI BSP_BIT32(5)
-#define PL011_UARTI_RXI BSP_BIT32(4)
-#define PL011_UARTI_DSRMI BSP_BIT32(3)
-#define PL011_UARTI_DCDMI BSP_BIT32(2)
-#define PL011_UARTI_CTSMI BSP_BIT32(1)
-#define PL011_UARTI_RIMI BSP_BIT32(0)
-  uint32_t uartdmacr;
-#define PL011_UARTDMACR_DMAONERR BSP_BIT32(2)
-#define PL011_UARTDMACR_TXDMAE BSP_BIT32(1)
-#define PL011_UARTDMACR_RXDMAE BSP_BIT32(0)
-  uint32_t reserved_4c[997];
-  uint32_t uartperiphid0;
-  uint32_t uartperiphid1;
-  uint32_t uartperiphid2;
-  uint32_t uartperiphid3;
-  uint32_t uartpcellid0;
-  uint32_t uartpcellid1;
-  uint32_t uartpcellid2;
-  uint32_t uartpcellid3;
-} pl011;
-
-#endif /* LIBBSP_ARM_SHARED_ARM_PL011_REGS_H */
diff --git a/bsps/include/dev/serial/arm-pl011.h 
b/bsps/include/dev/serial/pl011.h
similarity index 51%
rename from bsps/include/dev/serial/arm-pl011.h
rename to bsps/include/dev/serial/pl011.h
index a22fa1ac06..128bdce5f5 100644
--- a/bsps/include/dev/serial/arm-pl011.h
+++ b/bsps/include/dev/serial/pl011.h
@@ -1,15 +1,8 @@
 /* SPDX-License-Identifier: BSD-2-Clause */
 
-/**
- *  @file
- *
- *  @ingroup RTEMSBSPsARMShared
- *
- *  @brief ARM PL011 Support Package
- */
-
 /*
- * Copyright (C) 2013, 2014 embedded brains GmbH & Co. KG
+ * Copyright (C) 2023 Utkarsh Verma
+ *
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -33,32 +26,43 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef LIBBSP_ARM_SHARED_ARM_PL011_H
-#define LIBBSP_ARM_SHARED_ARM_PL011_H
+#ifndef LIBBSP_SHARED_DEV_SERIAL_PL011_H
+#define LIBBSP_SHARED_DEV_SERIAL_PL011_H
 
+#include 
+#include 
+#include 
 #include 
-
-#include 
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+#include 
+#include 
 
 typedef struct {
-  rtems_termios_device_context base;
-  volatile pl011 *regs;
-  rtems_vector_number irq;
-  uint32_t initial_baud;
-} arm_pl011_context;
+rtems_termios_device_context context;
+const uintptr_t regs_base;
+const uint32_t clock;
+const uint32_t initial_baud;
+const rtems_vector_number irq;
 
-bool arm_pl011_probe(rtems_termios_device_context *base);
+#ifdef BSP_CONSOLE_USE_INTERRUPTS
+/*
+ * Due to HW limitation, the first TX interrupt should be triggered by the
+ * software. This is because TX interrupts are based on transition through
+ * a level, rather than on the level itself. When the UART interrupt and
+ * UART is enabled before any data is written to the TXFIFO, the interrupt
+ * is not set. The interrupt is only set once the TXFIFO becomes empty
+ * after being filled to the trigger level. Until then, this flag variable
+ * ensures that the interrupt handler is software triggered.
+ */
+volatile bool needs_sw_triggered_tx_irq;
 
-void arm_pl011_write_polled(rtems_termios_device_context *base, char c);
+volatile int tx_queued_chars;
+rtems_termios_tty* tty;
+#endif
+} pl011_context;
 
-extern const rtems_termios_device_handler arm_pl011_fns;
+extern const rtems_termios_device_handler pl011_handler;
 
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+void pl011_write_char_polled(const rtems_termios_device_context* base,
+ const char ch);
 
-#endif /* LIBBSP_ARM_SHARED_ARM_PL011_H */
+#endif /* LIBBSP_SHARED_DEV_SERIAL_PL011_H */
diff --git a/bsps/shared/dev/serial/arm-pl011.c 
b/bsps/shared/dev/serial/arm-pl011.c
deleted file mode 100644
index e9a8e3f5a4..00
--- a/bsps/shared/dev/serial/arm-pl011.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/* SPDX-License-Identifier: BSD-2-Clause */
-
-/*
- * Copyright (C) 2013, 2014 embedded brains GmbH & Co. KG
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the f

[PATCH 3/4] spec: Add Mini UART and PL011 drivers to build spec

2023-08-29 Thread Utkarsh Verma
This commit updates the build spec to include the new UART drivers for
PL011 and Mini UART.
---
 spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml | 1 -
 spec/build/bsps/obj.yml | 7 ---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml 
b/spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml
index a579c094ba..3c58c48ba2 100644
--- a/spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml
+++ b/spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml
@@ -58,7 +58,6 @@ source:
 - bsps/shared/dev/irq/arm-gicv2-get-attributes.c
 - bsps/shared/dev/serial/console-termios-init.c
 - bsps/shared/dev/serial/console-termios.c
-- bsps/shared/dev/serial/arm-pl011.c
 - bsps/shared/dev/getentropy/getentropy-cpucounter.c
 - bsps/shared/dev/btimer/btimer-cpucounter.c
 - bsps/shared/irq/irq-default-handler.c
diff --git a/spec/build/bsps/obj.yml b/spec/build/bsps/obj.yml
index 6f76e9bb7c..7eab5c008b 100644
--- a/spec/build/bsps/obj.yml
+++ b/spec/build/bsps/obj.yml
@@ -55,8 +55,8 @@ install:
   - bsps/include/libchip/wd80x3.h
 - destination: ${BSP_INCLUDEDIR}/dev/serial
   source:
-  - bsps/include/dev/serial/arm-pl011-regs.h
-  - bsps/include/dev/serial/arm-pl011.h
+  - bsps/include/dev/serial/pl011.h
+  - bsps/include/dev/serial/mini-uart.h
 - destination: ${BSP_INCLUDEDIR}/rtems/zilog
   source:
   - bsps/include/rtems/zilog/z8036.h
@@ -96,7 +96,8 @@ source:
 - bsps/shared/dev/rtc/m48t08_reg8.c
 - bsps/shared/dev/rtc/mcp7940m.c
 - bsps/shared/dev/rtc/rtcprobe.c
-- bsps/shared/dev/serial/arm-pl011.c
+- bsps/shared/dev/serial/pl011.c
+- bsps/shared/dev/serial/mini-uart.c
 - bsps/shared/dev/serial/ns16550-context.c
 - bsps/shared/dev/serial/ns16550.c
 - bsps/shared/dev/serial/serprobe.c
-- 
2.41.0

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 0/4] New UART drivers for PL011 and Mini UART

2023-08-29 Thread Utkarsh Verma
This patch series adds two drivers, PL011 and Mini UART. Both support
interrupts and implement the termios API.

Why add a new driver for the PL011 when we already have one?

The existing driver is a very basic one and uses memory-mapped structs
to access the registers. This proved to be problematic for the
'aarch64/raspberrypi4b' BSP as the RPi 4B's MMU does not reserve the
entirety of the space required by the PL011 register struct.

Even the existing driver doesn't use all the struct members. So, in the
new driver, macros were used instead. This has the benefit of minimalism
and ensures that we only add tested features to the driver.

This driver builds upon the PL011 driver present in the Xilinx Versal
BSP and addresses the IRQ startup hack.

In short, the new PL011 driver has the features provided by the
existing driver, and it meshes well with the termios API.

Lastly, there's one thing I need feedback on. The PL011 has a hardware
limitation which requires me to invoke the IRQ handler manually, the
first time. For this, I need access to the `tty` struct in the
`write_buffer` function.

https://github.com/UtkarshVerma/rtems/blob/uart-drivers/bsps/shared/dev/serial/pl011.c#L301

For now, I store the tty in the device context and then pass the context
to the IRQ handler. Is this a good approach? Are there better ways to do
this?

For convenience, feel free to check out my GitHub fork which has these
changes:

https://github.com/UtkarshVerma/rtems/tree/uart-drivers

Utkarsh Verma (4):
  bsps/shared: Add new PL011 driver with IRQ support
  bsps/shared: Add new Mini UART driver
  spec: Add Mini UART and PL011 drivers to build spec
  bsps: Update BSPs to use the new PL011 driver

 bsps/aarch64/a53/console/console.c|  15 +-
 bsps/aarch64/a72/console/console.c|  15 +-
 bsps/aarch64/raspberrypi/console/console.c|  29 +-
 bsps/arm/raspberrypi/console/console-config.c |  27 +-
 .../realview-pbx-a9/console/console-polled.c  |   5 +-
 .../arm/realview-pbx-a9/include/bsp/console.h |   4 +-
 bsps/arm/xen/console/console.c|  15 +-
 bsps/include/dev/serial/arm-pl011-regs.h  | 143 --
 .../dev/serial/{arm-pl011.h => mini-uart.h}   |  52 +-
 bsps/include/dev/serial/pl011.h   |  68 +++
 bsps/shared/dev/serial/arm-pl011.c| 104 
 bsps/shared/dev/serial/mini-uart.c| 316 
 bsps/shared/dev/serial/pl011.c| 470 ++
 .../aarch64/raspberrypi/bspraspberrypi4.yml   |   1 -
 spec/build/bsps/obj.yml   |   7 +-
 15 files changed, 934 insertions(+), 337 deletions(-)
 delete mode 100644 bsps/include/dev/serial/arm-pl011-regs.h
 rename bsps/include/dev/serial/{arm-pl011.h => mini-uart.h} (64%)
 create mode 100644 bsps/include/dev/serial/pl011.h
 delete mode 100644 bsps/shared/dev/serial/arm-pl011.c
 create mode 100644 bsps/shared/dev/serial/mini-uart.c
 create mode 100644 bsps/shared/dev/serial/pl011.c

-- 
2.41.0

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 2/4] bsps/shared: Add new Mini UART driver

2023-08-29 Thread Utkarsh Verma
This commit adds a new driver for the Mini UART peripheral present on
Raspberry Pi devices. It implements the termios API with support for
setting attributes. It supports interrupts through the
BSP_CONSOLE_USE_INTERRUPTS macro.
---
 bsps/include/dev/serial/mini-uart.h |  54 +
 bsps/shared/dev/serial/mini-uart.c  | 316 
 2 files changed, 370 insertions(+)
 create mode 100644 bsps/include/dev/serial/mini-uart.h
 create mode 100644 bsps/shared/dev/serial/mini-uart.c

diff --git a/bsps/include/dev/serial/mini-uart.h 
b/bsps/include/dev/serial/mini-uart.h
new file mode 100644
index 00..7fce5d0d97
--- /dev/null
+++ b/bsps/include/dev/serial/mini-uart.h
@@ -0,0 +1,54 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/*
+ * Copyright (C) 2023 Utkarsh Verma
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef LIBBSP_SHARED_DEV_SERIAL_MINI_UART_H
+#define LIBBSP_SHARED_DEV_SERIAL_MINI_UART_H
+
+#include 
+#include 
+#include 
+#include 
+
+typedef struct {
+rtems_termios_device_context context;
+const uintptr_t regs_base;
+const uint32_t clock;
+const uint32_t initial_baud;
+const rtems_vector_number irq;
+
+#ifdef BSP_CONSOLE_USE_INTERRUPTS
+volatile int tx_queued_chars;
+#endif
+} mini_uart_context;
+
+extern const rtems_termios_device_handler mini_uart_handler;
+
+void mini_uart_write_char_polled(const rtems_termios_device_context* context,
+ const char ch);
+
+#endif /* LIBBSP_SHARED_DEV_SERIAL_MINI_UART_H */
diff --git a/bsps/shared/dev/serial/mini-uart.c 
b/bsps/shared/dev/serial/mini-uart.c
new file mode 100644
index 00..e84d7e786e
--- /dev/null
+++ b/bsps/shared/dev/serial/mini-uart.c
@@ -0,0 +1,316 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/*
+ * Copyright (C) 2023 Utkarsh Verma
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "dev/serial/mini-uart.h"
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define REG(addr) *(volatile uint32_t *)(addr)
+
+/*
+ * NOTE:
+ * The datasheet will specify swapped bits for RX and TX interrupts in IER_REG,
+ * which is incorrect. The correct values are used here.
+ */
+#define IO_REG(base)  REG(base + 0x00)
+#define IO_REG_DATA_MASK  BSP_MSK32(0, 7)
+#define IER_REG(base) REG(base + 0x04)
+#define IER_REG

[PATCH 4/4] spec: Add Mini UART and PL011 drivers to build spec

2023-08-28 Thread Utkarsh Verma
This commit updates the build spec to include the new UART drivers for
PL011 and Mini UART.
---
 spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml | 1 -
 spec/build/bsps/obj.yml | 7 ---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml 
b/spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml
index a579c094ba..3c58c48ba2 100644
--- a/spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml
+++ b/spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml
@@ -58,7 +58,6 @@ source:
 - bsps/shared/dev/irq/arm-gicv2-get-attributes.c
 - bsps/shared/dev/serial/console-termios-init.c
 - bsps/shared/dev/serial/console-termios.c
-- bsps/shared/dev/serial/arm-pl011.c
 - bsps/shared/dev/getentropy/getentropy-cpucounter.c
 - bsps/shared/dev/btimer/btimer-cpucounter.c
 - bsps/shared/irq/irq-default-handler.c
diff --git a/spec/build/bsps/obj.yml b/spec/build/bsps/obj.yml
index 6f76e9bb7c..7eab5c008b 100644
--- a/spec/build/bsps/obj.yml
+++ b/spec/build/bsps/obj.yml
@@ -55,8 +55,8 @@ install:
   - bsps/include/libchip/wd80x3.h
 - destination: ${BSP_INCLUDEDIR}/dev/serial
   source:
-  - bsps/include/dev/serial/arm-pl011-regs.h
-  - bsps/include/dev/serial/arm-pl011.h
+  - bsps/include/dev/serial/pl011.h
+  - bsps/include/dev/serial/mini-uart.h
 - destination: ${BSP_INCLUDEDIR}/rtems/zilog
   source:
   - bsps/include/rtems/zilog/z8036.h
@@ -96,7 +96,8 @@ source:
 - bsps/shared/dev/rtc/m48t08_reg8.c
 - bsps/shared/dev/rtc/mcp7940m.c
 - bsps/shared/dev/rtc/rtcprobe.c
-- bsps/shared/dev/serial/arm-pl011.c
+- bsps/shared/dev/serial/pl011.c
+- bsps/shared/dev/serial/mini-uart.c
 - bsps/shared/dev/serial/ns16550-context.c
 - bsps/shared/dev/serial/ns16550.c
 - bsps/shared/dev/serial/serprobe.c
-- 
2.41.0

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 3/4] bsps: Update BSPs to use the new PL011 driver

2023-08-28 Thread Utkarsh Verma
This commit updates the existing BSPs to use the new PL011 driver.
---
 bsps/aarch64/a53/console/console.c| 14 +-
 bsps/aarch64/a72/console/console.c| 14 +-
 bsps/aarch64/raspberrypi/console/console.c| 14 +-
 bsps/arm/raspberrypi/console/console-config.c | 26 +--
 .../arm/realview-pbx-a9/include/bsp/console.h |  4 +--
 bsps/arm/xen/console/console.c| 14 +-
 6 files changed, 43 insertions(+), 43 deletions(-)

diff --git a/bsps/aarch64/a53/console/console.c 
b/bsps/aarch64/a53/console/console.c
index 1854909c98..4535882e95 100644
--- a/bsps/aarch64/a53/console/console.c
+++ b/bsps/aarch64/a53/console/console.c
@@ -37,14 +37,14 @@
 #include 
 
 #include 
-#include 
+#include 
 #include 
 
 #include 
 
-arm_pl011_context a53_qemu_vpl011_context = {
-  .base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("PL011"),
-  .regs = (volatile pl011 *) BSP_A53_QEMU_VPL011_BASE,
+pl011_context a53_qemu_vpl011_context = {
+  .context = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("PL011"),
+  .regs_base = BSP_A53_QEMU_VPL011_BASE,
   .initial_baud = 115200
 };
 
@@ -52,8 +52,8 @@ const console_device console_device_table[] = {
   {
 .device_file = "/dev/ttyS0",
 .probe = console_device_probe_default,
-.handler = _pl011_fns,
-.context = _qemu_vpl011_context.base
+.handler = _handler,
+.context = _qemu_vpl011_context.context
   }
 };
 
@@ -61,7 +61,7 @@ const size_t console_device_count = 
RTEMS_ARRAY_SIZE(console_device_table);
 
 static void output_char( char c )
 {
-  arm_pl011_write_polled(_qemu_vpl011_context.base, c);
+  pl011_write_char_polled(_qemu_vpl011_context.context, c);
 }
 
 BSP_output_char_function_type BSP_output_char = output_char;
diff --git a/bsps/aarch64/a72/console/console.c 
b/bsps/aarch64/a72/console/console.c
index 08532d68cd..7c1c92483d 100644
--- a/bsps/aarch64/a72/console/console.c
+++ b/bsps/aarch64/a72/console/console.c
@@ -37,14 +37,14 @@
 #include 
 
 #include 
-#include 
+#include 
 #include 
 
 #include 
 
-arm_pl011_context a72_qemu_vpl011_context = {
-  .base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("PL011"),
-  .regs = (volatile pl011 *) BSP_A72_QEMU_VPL011_BASE,
+pl011_context a72_qemu_vpl011_context = {
+  .context = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("PL011"),
+  .regs_base = BSP_A72_QEMU_VPL011_BASE,
   .initial_baud = 115200
 };
 
@@ -52,8 +52,8 @@ const console_device console_device_table[] = {
   {
 .device_file = "/dev/ttyS0",
 .probe = console_device_probe_default,
-.handler = _pl011_fns,
-.context = _qemu_vpl011_context.base
+.handler = _handler,
+.context = _qemu_vpl011_context.context
   }
 };
 
@@ -61,7 +61,7 @@ const size_t console_device_count = 
RTEMS_ARRAY_SIZE(console_device_table);
 
 static void output_char( char c )
 {
-  arm_pl011_write_polled(_qemu_vpl011_context.base, c);
+  pl011_write_char_polled(_qemu_vpl011_context.context, c);
 }
 
 BSP_output_char_function_type BSP_output_char = output_char;
diff --git a/bsps/aarch64/raspberrypi/console/console.c 
b/bsps/aarch64/raspberrypi/console/console.c
index 73bb0036ff..54c50260a0 100644
--- a/bsps/aarch64/raspberrypi/console/console.c
+++ b/bsps/aarch64/raspberrypi/console/console.c
@@ -37,14 +37,14 @@
 #include 
 
 #include 
-#include 
+#include 
 #include 
 
 #include 
 
-arm_pl011_context raspberrypi_4_context = {
-  .base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("PL011"),
-  .regs = (volatile pl011 *) BSP_RPI4_PL011_BASE,
+pl011_context raspberrypi_4_context = {
+  .context = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("PL011"),
+  .regs_base = BSP_RPI4_PL011_BASE,
   .initial_baud = 115200
 };
 
@@ -52,8 +52,8 @@ const console_device console_device_table[] = {
   {
 .device_file = "/dev/ttyS0",
 .probe = console_device_probe_default,
-.handler = _pl011_fns,
-.context = _4_context.base
+.handler = _handler,
+.context = _4_context.context
   }
 };
 
@@ -61,7 +61,7 @@ const size_t console_device_count = 
RTEMS_ARRAY_SIZE(console_device_table);
 
 static void output_char( char c )
 {
-  arm_pl011_write_polled(_4_context.base, c);
+  pl011_write_char_polled(_4_context.context, c);
 }
 
 BSP_output_char_function_type BSP_output_char = output_char;
diff --git a/bsps/arm/raspberrypi/console/console-config.c 
b/bsps/arm/raspberrypi/console/console-config.c
index 6b8eb80aa4..2fb571b0e9 100644
--- a/bsps/arm/raspberrypi/console/console-config.c
+++ b/bsps/arm/raspberrypi/console/console-config.c
@@ -25,7 +25,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 #include 
@@ -46,19 +46,19 @@
 #define MINIUART  "/dev/ttyS0"
 #define FBCONS"/dev/fbcons"
 
-arm_pl011_context pl011_context;
-ns16550_context mini_uart_context;
+pl011_context uart0;
+ns16550_context uart1;
 
 rpi_fb_context fb_context;
 
 static void output_char_pl011(char c)
 {
-  arm_pl011_write_polled(_context.base, c);
+  pl011_write_char_polled(, c);
 }
 
 static void 

[PATCH 2/4] bsps/shared: Add new Mini UART driver

2023-08-28 Thread Utkarsh Verma
This commit adds a new driver for the Mini UART peripheral present on
Raspberry Pi devices. It implements the termios API with support for
setting attributes. It supports interrupts through the
BSP_CONSOLE_USE_INTERRUPTS macro.
---
 bsps/include/dev/serial/mini-uart.h |  54 +
 bsps/shared/dev/serial/mini-uart.c  | 316 
 2 files changed, 370 insertions(+)
 create mode 100644 bsps/include/dev/serial/mini-uart.h
 create mode 100644 bsps/shared/dev/serial/mini-uart.c

diff --git a/bsps/include/dev/serial/mini-uart.h 
b/bsps/include/dev/serial/mini-uart.h
new file mode 100644
index 00..7fce5d0d97
--- /dev/null
+++ b/bsps/include/dev/serial/mini-uart.h
@@ -0,0 +1,54 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/*
+ * Copyright (C) 2023 Utkarsh Verma
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef LIBBSP_SHARED_DEV_SERIAL_MINI_UART_H
+#define LIBBSP_SHARED_DEV_SERIAL_MINI_UART_H
+
+#include 
+#include 
+#include 
+#include 
+
+typedef struct {
+rtems_termios_device_context context;
+const uintptr_t regs_base;
+const uint32_t clock;
+const uint32_t initial_baud;
+const rtems_vector_number irq;
+
+#ifdef BSP_CONSOLE_USE_INTERRUPTS
+volatile int tx_queued_chars;
+#endif
+} mini_uart_context;
+
+extern const rtems_termios_device_handler mini_uart_handler;
+
+void mini_uart_write_char_polled(const rtems_termios_device_context* context,
+ const char ch);
+
+#endif /* LIBBSP_SHARED_DEV_SERIAL_MINI_UART_H */
diff --git a/bsps/shared/dev/serial/mini-uart.c 
b/bsps/shared/dev/serial/mini-uart.c
new file mode 100644
index 00..e84d7e786e
--- /dev/null
+++ b/bsps/shared/dev/serial/mini-uart.c
@@ -0,0 +1,316 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/*
+ * Copyright (C) 2023 Utkarsh Verma
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "dev/serial/mini-uart.h"
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define REG(addr) *(volatile uint32_t *)(addr)
+
+/*
+ * NOTE:
+ * The datasheet will specify swapped bits for RX and TX interrupts in IER_REG,
+ * which is incorrect. The correct values are used here.
+ */
+#define IO_REG(base)  REG(base + 0x00)
+#define IO_REG_DATA_MASK  BSP_MSK32(0, 7)
+#define IER_REG(base) REG(base + 0x04)
+#define IER_REG

[PATCH 1/4] bsps/shared: Add new PL011 driver with IRQ support

2023-08-28 Thread Utkarsh Verma
R_CTSEN BSP_BIT32(15)
-#define PL011_UARTCR_RTSEN BSP_BIT32(14)
-#define PL011_UARTCR_OUT2 BSP_BIT32(13)
-#define PL011_UARTCR_OUT1 BSP_BIT32(12)
-#define PL011_UARTCR_RTS BSP_BIT32(11)
-#define PL011_UARTCR_DTR BSP_BIT32(10)
-#define PL011_UARTCR_RXE BSP_BIT32(9)
-#define PL011_UARTCR_TXE BSP_BIT32(8)
-#define PL011_UARTCR_LBE BSP_BIT32(7)
-#define PL011_UARTCR_SIRLP BSP_BIT32(3)
-#define PL011_UARTCR_SIREN BSP_BIT32(2)
-#define PL011_UARTCR_UARTEN BSP_BIT32(1)
-  uint32_t uartifls;
-#define PL011_UARTIFLS_RXIFLSEL(val) BSP_FLD32(val, 3, 5)
-#define PL011_UARTIFLS_RXIFLSEL_GET(reg) BSP_FLD32GET(reg, 3, 5)
-#define PL011_UARTIFLS_RXIFLSEL_SET(reg, val) BSP_FLD32SET(reg, val, 3, 5)
-#define PL011_UARTIFLS_TXIFLSEL(val) BSP_FLD32(val, 0, 2)
-#define PL011_UARTIFLS_TXIFLSEL_GET(reg) BSP_FLD32GET(reg, 0, 2)
-#define PL011_UARTIFLS_TXIFLSEL_SET(reg, val) BSP_FLD32SET(reg, val, 0, 2)
-  uint32_t uartimsc;
-  uint32_t uartris;
-  uint32_t uartmis;
-  uint32_t uarticr;
-#define PL011_UARTI_OEI BSP_BIT32(10)
-#define PL011_UARTI_BEI BSP_BIT32(9)
-#define PL011_UARTI_PEI BSP_BIT32(8)
-#define PL011_UARTI_FEI BSP_BIT32(7)
-#define PL011_UARTI_RTI BSP_BIT32(6)
-#define PL011_UARTI_TXI BSP_BIT32(5)
-#define PL011_UARTI_RXI BSP_BIT32(4)
-#define PL011_UARTI_DSRMI BSP_BIT32(3)
-#define PL011_UARTI_DCDMI BSP_BIT32(2)
-#define PL011_UARTI_CTSMI BSP_BIT32(1)
-#define PL011_UARTI_RIMI BSP_BIT32(0)
-  uint32_t uartdmacr;
-#define PL011_UARTDMACR_DMAONERR BSP_BIT32(2)
-#define PL011_UARTDMACR_TXDMAE BSP_BIT32(1)
-#define PL011_UARTDMACR_RXDMAE BSP_BIT32(0)
-  uint32_t reserved_4c[997];
-  uint32_t uartperiphid0;
-  uint32_t uartperiphid1;
-  uint32_t uartperiphid2;
-  uint32_t uartperiphid3;
-  uint32_t uartpcellid0;
-  uint32_t uartpcellid1;
-  uint32_t uartpcellid2;
-  uint32_t uartpcellid3;
-} pl011;
-
-#endif /* LIBBSP_ARM_SHARED_ARM_PL011_REGS_H */
diff --git a/bsps/include/dev/serial/arm-pl011.h 
b/bsps/include/dev/serial/pl011.h
similarity index 51%
rename from bsps/include/dev/serial/arm-pl011.h
rename to bsps/include/dev/serial/pl011.h
index a22fa1ac06..128bdce5f5 100644
--- a/bsps/include/dev/serial/arm-pl011.h
+++ b/bsps/include/dev/serial/pl011.h
@@ -1,15 +1,8 @@
 /* SPDX-License-Identifier: BSD-2-Clause */
 
-/**
- *  @file
- *
- *  @ingroup RTEMSBSPsARMShared
- *
- *  @brief ARM PL011 Support Package
- */
-
 /*
- * Copyright (C) 2013, 2014 embedded brains GmbH & Co. KG
+ * Copyright (C) 2023 Utkarsh Verma
+ *
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -33,32 +26,43 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef LIBBSP_ARM_SHARED_ARM_PL011_H
-#define LIBBSP_ARM_SHARED_ARM_PL011_H
+#ifndef LIBBSP_SHARED_DEV_SERIAL_PL011_H
+#define LIBBSP_SHARED_DEV_SERIAL_PL011_H
 
+#include 
+#include 
+#include 
 #include 
-
-#include 
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+#include 
+#include 
 
 typedef struct {
-  rtems_termios_device_context base;
-  volatile pl011 *regs;
-  rtems_vector_number irq;
-  uint32_t initial_baud;
-} arm_pl011_context;
+rtems_termios_device_context context;
+const uintptr_t regs_base;
+const uint32_t clock;
+const uint32_t initial_baud;
+const rtems_vector_number irq;
 
-bool arm_pl011_probe(rtems_termios_device_context *base);
+#ifdef BSP_CONSOLE_USE_INTERRUPTS
+/*
+ * Due to HW limitation, the first TX interrupt should be triggered by the
+ * software. This is because TX interrupts are based on transition through
+ * a level, rather than on the level itself. When the UART interrupt and
+ * UART is enabled before any data is written to the TXFIFO, the interrupt
+ * is not set. The interrupt is only set once the TXFIFO becomes empty
+ * after being filled to the trigger level. Until then, this flag variable
+ * ensures that the interrupt handler is software triggered.
+ */
+volatile bool needs_sw_triggered_tx_irq;
 
-void arm_pl011_write_polled(rtems_termios_device_context *base, char c);
+volatile int tx_queued_chars;
+rtems_termios_tty* tty;
+#endif
+} pl011_context;
 
-extern const rtems_termios_device_handler arm_pl011_fns;
+extern const rtems_termios_device_handler pl011_handler;
 
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+void pl011_write_char_polled(const rtems_termios_device_context* base,
+ const char ch);
 
-#endif /* LIBBSP_ARM_SHARED_ARM_PL011_H */
+#endif /* LIBBSP_SHARED_DEV_SERIAL_PL011_H */
diff --git a/bsps/shared/dev/serial/arm-pl011.c 
b/bsps/shared/dev/serial/arm-pl011.c
deleted file mode 100644
index e9a8e3f5a4..00
--- a/bsps/shared/dev/serial/arm-pl011.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/* SPDX-License-Identifier: BSD-2-Clause */
-
-/*
- * Copyright (C) 2013, 2014 embedded brains GmbH & Co. KG
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the f

[PATCH 0/4] New UART drivers for PL011 and Mini UART

2023-08-28 Thread Utkarsh Verma
This patch series adds two drivers, PL011 and Mini UART. Both support
interrupts and implement the termios API.

Why add a new driver for the PL011 when we already have one?

The existing driver is a very basic one and uses memory-mapped structs
to access the registers. This proved to be problematic for the
'aarch64/raspberrypi4b' BSP as the RPi 4B's MMU does not reserve the
entirety of the space required by the PL011 register struct.

Even the existing driver doesn't use all the struct members. So, in the
new driver, macros were used instead. This has the benefit of minimalism
and ensures that we only add tested features to the driver.

This driver builds upon the PL011 driver present in the Xilinx Versal
BSP and addresses the IRQ startup hack.

In short, the new PL011 driver has the features provided by the
existing driver, and it meshes well with the termios API.

Lastly, there's one thing I need feedback on. The PL011 has a hardware
limitation which requires me to invoke the IRQ handler manually, the
first time. For this, I need access to the `tty` struct in the
`write_buffer` function.

https://github.com/UtkarshVerma/rtems/blob/uart-drivers/bsps/shared/dev/serial/pl011.c#L301

For now, I store the tty in the device context and then pass the context
to the IRQ handler. Is this a good approach? Are there better ways to do
this?

For convenience, feel free to check out my GitHub fork which has these
changes:

https://github.com/UtkarshVerma/rtems/tree/uart-drivers


Utkarsh Verma (4):
  bsps/shared: Add new PL011 driver with IRQ support
  bsps/shared: Add new Mini UART driver
  bsps: Update BSPs to use the new PL011 driver
  spec: Add Mini UART and PL011 drivers to build spec

 bsps/aarch64/a53/console/console.c|  14 +-
 bsps/aarch64/a72/console/console.c|  14 +-
 bsps/aarch64/raspberrypi/console/console.c|  14 +-
 bsps/arm/raspberrypi/console/console-config.c |  26 +-
 .../arm/realview-pbx-a9/include/bsp/console.h |   4 +-
 bsps/arm/xen/console/console.c|  14 +-
 bsps/include/dev/serial/arm-pl011-regs.h  | 143 --
 .../dev/serial/{arm-pl011.h => mini-uart.h}   |  52 +-
 bsps/include/dev/serial/pl011.h   |  68 +++
 bsps/shared/dev/serial/arm-pl011.c| 104 
 bsps/shared/dev/serial/mini-uart.c| 316 
 bsps/shared/dev/serial/pl011.c| 470 ++
 .../aarch64/raspberrypi/bspraspberrypi4.yml   |   1 -
 spec/build/bsps/obj.yml   |   7 +-
 14 files changed, 922 insertions(+), 325 deletions(-)
 delete mode 100644 bsps/include/dev/serial/arm-pl011-regs.h
 rename bsps/include/dev/serial/{arm-pl011.h => mini-uart.h} (64%)
 create mode 100644 bsps/include/dev/serial/pl011.h
 delete mode 100644 bsps/shared/dev/serial/arm-pl011.c
 create mode 100644 bsps/shared/dev/serial/mini-uart.c
 create mode 100644 bsps/shared/dev/serial/pl011.c

-- 
2.41.0

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH 0/2 v3] Refactor the aarch64/raspberryp4b BSP

2023-08-16 Thread Utkarsh Verma
A gentle reminder for this patch.

On Thu, Aug 10, 2023 at 11:45 AM Utkarsh Verma 
wrote:

> A gentle reminder for this. Please let me know which changes are required
> so that I can send the next set of patches as well.
>
> On Wed, Aug 9, 2023 at 9:20 AM Utkarsh Verma 
> wrote:
>
>> Changes can also be seen on my fork:
>> https://github.com/UtkarshVerma/rtems/tree/refactor
>>
>> On Wed, Aug 9, 2023 at 9:18 AM Utkarsh Verma 
>> wrote:
>>
>>> This patch series refactors the BSP and build spec for Raspberry Pi 4B
>>> with the following goals in mind:
>>>
>>> - IWYU(include what you use) includes
>>> - Modularity in BSP and the build spec
>>> - Strict MMU mapping
>>>
>>> This is my first code contribution to RTEMS, therefore suggestions of
>>> any kind would be highly appreciated.
>>>
>>> Regards,
>>> Utkarsh
>>>
>>> Utkarsh Verma (2):
>>>   bsps/aarch64/raspberrypi: Refactor the BSP
>>>   build: Modularize the aarch64/raspberrypi spec
>>>
>>>  bsps/aarch64/raspberrypi/console/console.c|  39 +-
>>>  bsps/aarch64/raspberrypi/include/bsp.h|  37 +-
>>>  .../aarch64/raspberrypi/include/bsp/bcm2711.h |  96 
>>>  bsps/aarch64/raspberrypi/include/bsp/irq.h| 102 ++--
>>>  .../raspberrypi/include/bsp/raspberrypi.h | 471 --
>>>  .../include/bsp/start/bspstartmmu.h   |  45 ++
>>>  bsps/aarch64/raspberrypi/include/tm27.h   |   5 +-
>>>  bsps/aarch64/raspberrypi/start/bspstart.c |  16 +-
>>>  .../aarch64/raspberrypi/start/bspstarthooks.c |  26 +-
>>>  bsps/aarch64/raspberrypi/start/bspstartmmu.c  |  66 +--
>>>  spec/build/bsps/aarch64/raspberrypi/abi.yml   |  39 +-
>>>  spec/build/bsps/aarch64/raspberrypi/bsp4b.yml |  23 +
>>>  .../aarch64/raspberrypi/bspraspberrypi4.yml   |  72 ---
>>>  spec/build/bsps/aarch64/raspberrypi/grp.yml   |  25 +
>>>  spec/build/bsps/aarch64/raspberrypi/grp4b.yml |  26 +
>>>  .../{linkercmds.yml => linkcmds.yml}  |  27 +-
>>>  spec/build/bsps/aarch64/raspberrypi/obj.yml   |  40 ++
>>>  .../bsps/aarch64/raspberrypi/objcache.yml |  23 +
>>>  .../bsps/aarch64/raspberrypi/objclock.yml |  24 +
>>>  .../bsps/aarch64/raspberrypi/objconsole.yml   |  20 +
>>>  .../build/bsps/aarch64/raspberrypi/objirq.yml |  27 +
>>>  .../bsps/aarch64/raspberrypi/objstart.yml |  35 ++
>>>  22 files changed, 553 insertions(+), 731 deletions(-)
>>>  create mode 100644 bsps/aarch64/raspberrypi/include/bsp/bcm2711.h
>>>  delete mode 100644 bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
>>>  create mode 100644
>>> bsps/aarch64/raspberrypi/include/bsp/start/bspstartmmu.h
>>>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/bsp4b.yml
>>>  delete mode 100644
>>> spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml
>>>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/grp.yml
>>>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/grp4b.yml
>>>  rename spec/build/bsps/aarch64/raspberrypi/{linkercmds.yml =>
>>> linkcmds.yml} (88%)
>>>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/obj.yml
>>>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/objcache.yml
>>>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/objclock.yml
>>>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/objconsole.yml
>>>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/objirq.yml
>>>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/objstart.yml
>>>
>>> --
>>> 2.41.0
>>>
>>>
>>>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH 0/2 v3] Refactor the aarch64/raspberryp4b BSP

2023-08-10 Thread Utkarsh Verma
A gentle reminder for this. Please let me know which changes are required
so that I can send the next set of patches as well.

On Wed, Aug 9, 2023 at 9:20 AM Utkarsh Verma  wrote:

> Changes can also be seen on my fork:
> https://github.com/UtkarshVerma/rtems/tree/refactor
>
> On Wed, Aug 9, 2023 at 9:18 AM Utkarsh Verma 
> wrote:
>
>> This patch series refactors the BSP and build spec for Raspberry Pi 4B
>> with the following goals in mind:
>>
>> - IWYU(include what you use) includes
>> - Modularity in BSP and the build spec
>> - Strict MMU mapping
>>
>> This is my first code contribution to RTEMS, therefore suggestions of
>> any kind would be highly appreciated.
>>
>> Regards,
>> Utkarsh
>>
>> Utkarsh Verma (2):
>>   bsps/aarch64/raspberrypi: Refactor the BSP
>>   build: Modularize the aarch64/raspberrypi spec
>>
>>  bsps/aarch64/raspberrypi/console/console.c|  39 +-
>>  bsps/aarch64/raspberrypi/include/bsp.h|  37 +-
>>  .../aarch64/raspberrypi/include/bsp/bcm2711.h |  96 
>>  bsps/aarch64/raspberrypi/include/bsp/irq.h| 102 ++--
>>  .../raspberrypi/include/bsp/raspberrypi.h | 471 --
>>  .../include/bsp/start/bspstartmmu.h   |  45 ++
>>  bsps/aarch64/raspberrypi/include/tm27.h   |   5 +-
>>  bsps/aarch64/raspberrypi/start/bspstart.c |  16 +-
>>  .../aarch64/raspberrypi/start/bspstarthooks.c |  26 +-
>>  bsps/aarch64/raspberrypi/start/bspstartmmu.c  |  66 +--
>>  spec/build/bsps/aarch64/raspberrypi/abi.yml   |  39 +-
>>  spec/build/bsps/aarch64/raspberrypi/bsp4b.yml |  23 +
>>  .../aarch64/raspberrypi/bspraspberrypi4.yml   |  72 ---
>>  spec/build/bsps/aarch64/raspberrypi/grp.yml   |  25 +
>>  spec/build/bsps/aarch64/raspberrypi/grp4b.yml |  26 +
>>  .../{linkercmds.yml => linkcmds.yml}  |  27 +-
>>  spec/build/bsps/aarch64/raspberrypi/obj.yml   |  40 ++
>>  .../bsps/aarch64/raspberrypi/objcache.yml |  23 +
>>  .../bsps/aarch64/raspberrypi/objclock.yml |  24 +
>>  .../bsps/aarch64/raspberrypi/objconsole.yml   |  20 +
>>  .../build/bsps/aarch64/raspberrypi/objirq.yml |  27 +
>>  .../bsps/aarch64/raspberrypi/objstart.yml |  35 ++
>>  22 files changed, 553 insertions(+), 731 deletions(-)
>>  create mode 100644 bsps/aarch64/raspberrypi/include/bsp/bcm2711.h
>>  delete mode 100644 bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
>>  create mode 100644
>> bsps/aarch64/raspberrypi/include/bsp/start/bspstartmmu.h
>>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/bsp4b.yml
>>  delete mode 100644
>> spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml
>>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/grp.yml
>>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/grp4b.yml
>>  rename spec/build/bsps/aarch64/raspberrypi/{linkercmds.yml =>
>> linkcmds.yml} (88%)
>>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/obj.yml
>>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/objcache.yml
>>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/objclock.yml
>>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/objconsole.yml
>>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/objirq.yml
>>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/objstart.yml
>>
>> --
>> 2.41.0
>>
>>
>>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH 0/2 v3] Refactor the aarch64/raspberryp4b BSP

2023-08-08 Thread Utkarsh Verma
Changes can also be seen on my fork:
https://github.com/UtkarshVerma/rtems/tree/refactor

On Wed, Aug 9, 2023 at 9:18 AM Utkarsh Verma  wrote:

> This patch series refactors the BSP and build spec for Raspberry Pi 4B
> with the following goals in mind:
>
> - IWYU(include what you use) includes
> - Modularity in BSP and the build spec
> - Strict MMU mapping
>
> This is my first code contribution to RTEMS, therefore suggestions of
> any kind would be highly appreciated.
>
> Regards,
> Utkarsh
>
> Utkarsh Verma (2):
>   bsps/aarch64/raspberrypi: Refactor the BSP
>   build: Modularize the aarch64/raspberrypi spec
>
>  bsps/aarch64/raspberrypi/console/console.c|  39 +-
>  bsps/aarch64/raspberrypi/include/bsp.h|  37 +-
>  .../aarch64/raspberrypi/include/bsp/bcm2711.h |  96 
>  bsps/aarch64/raspberrypi/include/bsp/irq.h| 102 ++--
>  .../raspberrypi/include/bsp/raspberrypi.h | 471 --
>  .../include/bsp/start/bspstartmmu.h   |  45 ++
>  bsps/aarch64/raspberrypi/include/tm27.h   |   5 +-
>  bsps/aarch64/raspberrypi/start/bspstart.c |  16 +-
>  .../aarch64/raspberrypi/start/bspstarthooks.c |  26 +-
>  bsps/aarch64/raspberrypi/start/bspstartmmu.c  |  66 +--
>  spec/build/bsps/aarch64/raspberrypi/abi.yml   |  39 +-
>  spec/build/bsps/aarch64/raspberrypi/bsp4b.yml |  23 +
>  .../aarch64/raspberrypi/bspraspberrypi4.yml   |  72 ---
>  spec/build/bsps/aarch64/raspberrypi/grp.yml   |  25 +
>  spec/build/bsps/aarch64/raspberrypi/grp4b.yml |  26 +
>  .../{linkercmds.yml => linkcmds.yml}  |  27 +-
>  spec/build/bsps/aarch64/raspberrypi/obj.yml   |  40 ++
>  .../bsps/aarch64/raspberrypi/objcache.yml |  23 +
>  .../bsps/aarch64/raspberrypi/objclock.yml |  24 +
>  .../bsps/aarch64/raspberrypi/objconsole.yml   |  20 +
>  .../build/bsps/aarch64/raspberrypi/objirq.yml |  27 +
>  .../bsps/aarch64/raspberrypi/objstart.yml |  35 ++
>  22 files changed, 553 insertions(+), 731 deletions(-)
>  create mode 100644 bsps/aarch64/raspberrypi/include/bsp/bcm2711.h
>  delete mode 100644 bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
>  create mode 100644
> bsps/aarch64/raspberrypi/include/bsp/start/bspstartmmu.h
>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/bsp4b.yml
>  delete mode 100644 spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml
>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/grp.yml
>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/grp4b.yml
>  rename spec/build/bsps/aarch64/raspberrypi/{linkercmds.yml =>
> linkcmds.yml} (88%)
>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/obj.yml
>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/objcache.yml
>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/objclock.yml
>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/objconsole.yml
>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/objirq.yml
>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/objstart.yml
>
> --
> 2.41.0
>
>
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

[PATCH 2/2] build: Modularize the aarch64/raspberrypi spec

2023-08-08 Thread Utkarsh Verma
---
 spec/build/bsps/aarch64/raspberrypi/abi.yml   | 39 ++
 spec/build/bsps/aarch64/raspberrypi/bsp4b.yml | 23 ++
 .../aarch64/raspberrypi/bspraspberrypi4.yml   | 75 ---
 spec/build/bsps/aarch64/raspberrypi/grp.yml   | 25 +++
 spec/build/bsps/aarch64/raspberrypi/grp4b.yml | 26 +++
 .../{linkercmds.yml => linkcmds.yml}  | 27 ---
 spec/build/bsps/aarch64/raspberrypi/obj.yml   | 40 ++
 .../bsps/aarch64/raspberrypi/objcache.yml | 23 ++
 .../bsps/aarch64/raspberrypi/objclock.yml | 24 ++
 .../bsps/aarch64/raspberrypi/objconsole.yml   | 20 +
 .../build/bsps/aarch64/raspberrypi/objirq.yml | 27 +++
 .../bsps/aarch64/raspberrypi/objstart.yml | 35 +
 12 files changed, 285 insertions(+), 99 deletions(-)
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/bsp4b.yml
 delete mode 100644 spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/grp.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/grp4b.yml
 rename spec/build/bsps/aarch64/raspberrypi/{linkercmds.yml => linkcmds.yml} 
(88%)
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/obj.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/objcache.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/objclock.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/objconsole.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/objirq.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/objstart.yml

diff --git a/spec/build/bsps/aarch64/raspberrypi/abi.yml 
b/spec/build/bsps/aarch64/raspberrypi/abi.yml
index 38a8d8bc8f..0e365f0146 100644
--- a/spec/build/bsps/aarch64/raspberrypi/abi.yml
+++ b/spec/build/bsps/aarch64/raspberrypi/abi.yml
@@ -1,19 +1,28 @@
 SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
-actions:
-- get-string: null
-- split: null
-- env-append: null
-build-type: option
 copyrights:
-- Copyright (C) 2022 Mohd Noor Aman
-default:
-- enabled-by: true
-  value:
-  - -mcpu=cortex-a72
-  - -march=armv8-a
-description: |
-  ABI flags
+  - Copyright (C) 2022 Mohd Noor Aman
+  - Copyright (C) 2023 Utkarsh Verma
+
+type: build
 enabled-by: true
-links: []
+
+build-type: option
 name: ABI_FLAGS
-type: build
+description: ABI flags
+
+actions:
+  - get-string: null
+  - split: null
+  - env-append: null
+
+default:
+  - enabled-by:
+  - aarch64/raspberrypi4b
+value:
+  - -mcpu=cortex-a72
+  - -march=armv8-a
+  - -mstrict-align
+
+links:
+  - role: build-dependency
+uid: ../../opto2
diff --git a/spec/build/bsps/aarch64/raspberrypi/bsp4b.yml 
b/spec/build/bsps/aarch64/raspberrypi/bsp4b.yml
new file mode 100644
index 00..058f97d1eb
--- /dev/null
+++ b/spec/build/bsps/aarch64/raspberrypi/bsp4b.yml
@@ -0,0 +1,23 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+  - Copyright (C) 2022 Mohd Noor Aman
+  - Copyright (C) 2023 Utkarsh Verma
+
+type: build
+enabled-by: true
+
+build-type: bsp
+arch: aarch64
+bsp: raspberrypi4b
+family: raspberrypi
+cflags: []
+cppflags: []
+includes: []
+install: []
+source: []
+
+links:
+  - role: build-dependency
+uid: grp4b
+  - role: build-dependency
+uid: linkcmds
diff --git a/spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml 
b/spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml
deleted file mode 100644
index d49e12a7f0..00
--- a/spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml
+++ /dev/null
@@ -1,75 +0,0 @@
-SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
-arch: aarch64
-bsp: raspberrypi4b
-build-type: bsp
-cflags: []
-copyrights:
-- Copyright (C) 2022 Mohd Noor Aman
-cppflags: []
-enabled-by: true
-family: raspberrypi
-includes: []
-install:
-- destination: ${BSP_INCLUDEDIR}
-  source:
-  - bsps/aarch64/raspberrypi/include/bsp.h
-  - bsps/aarch64/raspberrypi/include/tm27.h
-- destination: ${BSP_INCLUDEDIR}/bsp
-  source:
-  - bsps/aarch64/raspberrypi/include/bsp/irq.h
-  - bsps/aarch64/raspberrypi/include/bsp/bcm2711.h
-- destination: ${BSP_INCLUDEDIR}/bsp/start
-  source:
-  - bsps/aarch64/raspberrypi/include/bsp/start/bspstartmmu.h
-links:
-- role: build-dependency
-  uid: ../grp
-- role: build-dependency
-  uid: ../start
-- role: build-dependency
-  uid: ../optmmupages
-- role: build-dependency
-  uid: ../optgtusevirt
-- role: build-dependency
-  uid: ../optgtuseps
-- role: build-dependency
-  uid: abi
-- role: build-dependency
-  uid: ../../optcachedata
-- role: build-dependency
-  uid: ../../optcacheinst
-- role: build-dependency
-  uid: ../../opto2
-- role: build-dependency
-  uid: ../../bspopts
-- role: build-dependency
-  uid: linkercmds
-- role: build-dependency
-  uid: ../../obj
-- role: build-dependency
-  uid: ../../objirq
-source:
-- bsps/aarch64/raspberrypi/console/console.c
-- bsps/aarch64/raspberrypi/start/bspstart.c
-- bsps/aarch64/raspberrypi/start/bspstarthooks.c
-- bsps/aarch64/raspberrypi/start/bspstartmmu.c
-

[PATCH 1/2] bsps/aarch64/raspberrypi: Refactor the BSP

2023-08-08 Thread Utkarsh Verma
This commit restructures the BSP to be more modular and introduces
IWYU(include what you use) includes alongwith some formatting changes.

build: Update spec for aarch64/raspberrypi
---
 bsps/aarch64/raspberrypi/console/console.c|  39 +-
 bsps/aarch64/raspberrypi/include/bsp.h|  37 +-
 .../aarch64/raspberrypi/include/bsp/bcm2711.h |  96 
 bsps/aarch64/raspberrypi/include/bsp/irq.h| 102 ++--
 .../raspberrypi/include/bsp/raspberrypi.h | 471 --
 .../include/bsp/start/bspstartmmu.h   |  45 ++
 bsps/aarch64/raspberrypi/include/tm27.h   |   5 +-
 bsps/aarch64/raspberrypi/start/bspstart.c |  16 +-
 .../aarch64/raspberrypi/start/bspstarthooks.c |  26 +-
 bsps/aarch64/raspberrypi/start/bspstartmmu.c  |  66 +--
 .../aarch64/raspberrypi/bspraspberrypi4.yml   |   5 +-
 11 files changed, 272 insertions(+), 636 deletions(-)
 create mode 100644 bsps/aarch64/raspberrypi/include/bsp/bcm2711.h
 delete mode 100644 bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
 create mode 100644 bsps/aarch64/raspberrypi/include/bsp/start/bspstartmmu.h

diff --git a/bsps/aarch64/raspberrypi/console/console.c 
b/bsps/aarch64/raspberrypi/console/console.c
index 73bb0036ff..294fdba022 100644
--- a/bsps/aarch64/raspberrypi/console/console.c
+++ b/bsps/aarch64/raspberrypi/console/console.c
@@ -3,13 +3,14 @@
 /**
  * @file
  *
- * @ingroup RTEMSBSPsAArch64Raspberrypi4
+ * @ingroup RTEMSBSPsAArch64RaspberryPi
  *
  * @brief Console Configuration
  */
 
 /*
  * Copyright (C) 2022 Mohd Noor Aman
+ * Copyright (C) 2023 Utkarsh Verma
  *
  *
  * Redistribution and use in source and binary forms, with or without
@@ -34,36 +35,32 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include 
-
-#include 
-#include 
 #include 
+#include 
+#include 
 
-#include 
+#include "bsp.h"
 
-arm_pl011_context raspberrypi_4_context = {
-  .base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("PL011"),
-  .regs = (volatile pl011 *) BSP_RPI4_PL011_BASE,
-  .initial_baud = 115200
+arm_pl011_context uart0 = {
+.base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("PL011"),
+.regs = (volatile pl011*)BSP_UART0_BASE,
+.initial_baud = 115200,
 };
 
 const console_device console_device_table[] = {
-  {
-.device_file = "/dev/ttyS0",
-.probe = console_device_probe_default,
-.handler = _pl011_fns,
-.context = _4_context.base
-  }
+{
+.device_file = "/dev/ttyAMA0",
+.probe   = console_device_probe_default,
+.handler = _pl011_fns,
+.context = ,
+},
 };
 
 const size_t console_device_count = RTEMS_ARRAY_SIZE(console_device_table);
 
-static void output_char( char c )
-{
-  arm_pl011_write_polled(_4_context.base, c);
+static void output_char(char c) {
+arm_pl011_write_polled(, c);
 }
 
-BSP_output_char_function_type BSP_output_char = output_char;
-
+BSP_output_char_function_type BSP_output_char   = output_char;
 BSP_polling_getchar_function_type BSP_poll_char = NULL;
diff --git a/bsps/aarch64/raspberrypi/include/bsp.h 
b/bsps/aarch64/raspberrypi/include/bsp.h
index 4fa81edd40..b4dbb39223 100644
--- a/bsps/aarch64/raspberrypi/include/bsp.h
+++ b/bsps/aarch64/raspberrypi/include/bsp.h
@@ -3,13 +3,14 @@
 /**
  * @file
  *
- * @ingroup RTEMSBSPsAArch64Raspberrypi4
+ * @ingroup RTEMSBSPsAArch64RaspberryPi
  *
- * @brief Core BSP definitions
+ * @brief Core BSP Definitions
  */
 
 /*
  * Copyright (C) 2022 Mohd Noor Aman
+ * Copyright (C) 2023 Utkarsh Verma
  *
  *
  * Redistribution and use in source and binary forms, with or without
@@ -34,8 +35,8 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef LIBBSP_AARCH64_RASPBERRYPI_4_BSP_H
-#define LIBBSP_AARCH64_RASPBERRYPI_4_BSP_H
+#ifndef LIBBSP_AARCH64_RASPBERRYPI_BSP_H
+#define LIBBSP_AARCH64_RASPBERRYPI_BSP_H
 
 /**
  * @addtogroup RTEMSBSPsAArch64
@@ -48,29 +49,21 @@
 #ifndef ASM
 
 #include 
-#include 
 
-#include 
+#if RTEMS_BSP == raspberrypi4b
+#include "bsp/bcm2711.h"
 
-/*Raspberry pi MMU initialization */
-BSP_START_TEXT_SECTION void raspberrypi_4_setup_mmu_and_cache(void);
+#define BSP_GIC_BASE   BCM2711_GIC_BASE
+#define BSP_GIC_SIZE   BCM2711_GIC_SIZE
+#define BSP_ARM_GIC_CPUIF_BASE BCM2711_GIC_CPUIF_BASE
+#define BSP_ARM_GIC_DIST_BASE  BCM2711_GIC_DIST_BASE
 
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define BSP_ARM_GIC_CPUIF_BASE 0xFF842000
-#define BSP_ARM_GIC_DIST_BASE 0xFF841000
-
-#define BSP_RPI4_PL011_BASE 0xFE201000
-#define BSP_RPI4_PL011_LENGTH 0x200
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+#define BSP_UART0_BASE BCM2711_UART0_BASE
+#define BSP_UART0_SIZE BCM2711_UART0_SIZE
+#endif /* raspberrypi4b */
 
 #endif /* ASM */
 
 /** @} */
 
-#endif /* LIBBSP_AARCH64_RASPBERRYPI_4_BSP_H */
+#endif /* LIBBSP_AARCH64_RASPBERRYPI_BSP_H */
diff --git a/bsps/aarch64/raspberrypi/include/bsp/bcm2711.h 
b/bsps/aarch64/raspberrypi/include/bsp/bcm2711.h
new file mode 100644
ind

[PATCH 0/2 v3] Refactor the aarch64/raspberryp4b BSP

2023-08-08 Thread Utkarsh Verma
This patch series refactors the BSP and build spec for Raspberry Pi 4B
with the following goals in mind:

- IWYU(include what you use) includes
- Modularity in BSP and the build spec
- Strict MMU mapping

This is my first code contribution to RTEMS, therefore suggestions of
any kind would be highly appreciated.

Regards,
Utkarsh

Utkarsh Verma (2):
  bsps/aarch64/raspberrypi: Refactor the BSP
  build: Modularize the aarch64/raspberrypi spec

 bsps/aarch64/raspberrypi/console/console.c|  39 +-
 bsps/aarch64/raspberrypi/include/bsp.h|  37 +-
 .../aarch64/raspberrypi/include/bsp/bcm2711.h |  96 
 bsps/aarch64/raspberrypi/include/bsp/irq.h| 102 ++--
 .../raspberrypi/include/bsp/raspberrypi.h | 471 --
 .../include/bsp/start/bspstartmmu.h   |  45 ++
 bsps/aarch64/raspberrypi/include/tm27.h   |   5 +-
 bsps/aarch64/raspberrypi/start/bspstart.c |  16 +-
 .../aarch64/raspberrypi/start/bspstarthooks.c |  26 +-
 bsps/aarch64/raspberrypi/start/bspstartmmu.c  |  66 +--
 spec/build/bsps/aarch64/raspberrypi/abi.yml   |  39 +-
 spec/build/bsps/aarch64/raspberrypi/bsp4b.yml |  23 +
 .../aarch64/raspberrypi/bspraspberrypi4.yml   |  72 ---
 spec/build/bsps/aarch64/raspberrypi/grp.yml   |  25 +
 spec/build/bsps/aarch64/raspberrypi/grp4b.yml |  26 +
 .../{linkercmds.yml => linkcmds.yml}  |  27 +-
 spec/build/bsps/aarch64/raspberrypi/obj.yml   |  40 ++
 .../bsps/aarch64/raspberrypi/objcache.yml |  23 +
 .../bsps/aarch64/raspberrypi/objclock.yml |  24 +
 .../bsps/aarch64/raspberrypi/objconsole.yml   |  20 +
 .../build/bsps/aarch64/raspberrypi/objirq.yml |  27 +
 .../bsps/aarch64/raspberrypi/objstart.yml |  35 ++
 22 files changed, 553 insertions(+), 731 deletions(-)
 create mode 100644 bsps/aarch64/raspberrypi/include/bsp/bcm2711.h
 delete mode 100644 bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
 create mode 100644 bsps/aarch64/raspberrypi/include/bsp/start/bspstartmmu.h
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/bsp4b.yml
 delete mode 100644 spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/grp.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/grp4b.yml
 rename spec/build/bsps/aarch64/raspberrypi/{linkercmds.yml => linkcmds.yml} 
(88%)
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/obj.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/objcache.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/objclock.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/objconsole.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/objirq.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/objstart.yml

-- 
2.41.0

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH 1/3] gitignore: Ignore clangd and clang-format files

2023-08-08 Thread Utkarsh Verma
You're correct. I'll remove this commit.

Regards,
Utkarsh

On Tue, Aug 8, 2023 at 11:39 AM Chris Johns  wrote:

> On 8/8/2023 4:07 pm, Chris Johns wrote:
> > On 8/8/2023 1:05 pm, Utkarsh Verma wrote:
> >> ---
> >>  .gitignore | 4 
> >>  1 file changed, 4 insertions(+)
> >>
> >> diff --git a/.gitignore b/.gitignore
> >> index 8b28b186e1..d0144f6737 100644
> >> --- a/.gitignore
> >> +++ b/.gitignore
> >> @@ -12,3 +12,7 @@ Makefile.in
> >>  /testsuites/build/build
> >>  /testsuites/build/wscript
> >>  .waf*
> >> +.clangd
> >> +.clang-format
> >> +compile_commands.json
> >> +.cache/
> >
> > What are these from?
> >
> > Why add them to your $HOME/.gitignore?
>
> Sorry ... that should be
>
> Why not add them to your $HOME/.gitignore?
>
> Chris
>
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH 0/3] Refactor the aarch64/raspberryp4b BSP

2023-08-07 Thread Utkarsh Verma
Changes are also on my GitHub fork:
https://github.com/UtkarshVerma/rtems/tree/refactor.

Regards,
Utkarsh

On Tue, Aug 8, 2023 at 8:35 AM Utkarsh Verma  wrote:

> This patch series refactors the BSP and build spec for Raspberry Pi 4B
> with the following goals in mind:
>
> - IWYU(include what you use) includes
> - Modularity in BSP and the build spec
> - Strict MMU mapping
>
> This is my first code contribution to RTEMS, therefore suggestions of
> any kind would be highly appreciated.
>
> Regards,
> Utkarsh
>
> Utkarsh Verma (3):
>   gitignore: Ignore clangd and clang-format files
>   bsps/aarch64/raspberrypi: Refactor the BSP
>   build: Modularize the aarch64/raspberrypi spec
>
>  .gitignore|   4 +
>  bsps/aarch64/raspberrypi/console/console.c|  39 +-
>  bsps/aarch64/raspberrypi/include/bsp.h|  37 +-
>  .../aarch64/raspberrypi/include/bsp/bcm2711.h |  96 
>  bsps/aarch64/raspberrypi/include/bsp/irq.h| 102 ++--
>  .../raspberrypi/include/bsp/raspberrypi.h | 471 --
>  .../include/bsp/start/bspstartmmu.h   |  45 ++
>  bsps/aarch64/raspberrypi/include/tm27.h   |   5 +-
>  bsps/aarch64/raspberrypi/start/bspstart.c |  16 +-
>  .../aarch64/raspberrypi/start/bspstarthooks.c |  26 +-
>  bsps/aarch64/raspberrypi/start/bspstartmmu.c  |  66 +--
>  spec/build/bsps/aarch64/raspberrypi/abi.yml   |  39 +-
>  spec/build/bsps/aarch64/raspberrypi/bsp4b.yml |  23 +
>  .../aarch64/raspberrypi/bspraspberrypi4.yml   |  72 ---
>  spec/build/bsps/aarch64/raspberrypi/grp.yml   |  25 +
>  spec/build/bsps/aarch64/raspberrypi/grp4b.yml |  26 +
>  .../{linkercmds.yml => linkcmds.yml}  |  27 +-
>  spec/build/bsps/aarch64/raspberrypi/obj.yml   |  40 ++
>  .../bsps/aarch64/raspberrypi/objcache.yml |  23 +
>  .../bsps/aarch64/raspberrypi/objclock.yml |  24 +
>  .../bsps/aarch64/raspberrypi/objconsole.yml   |  20 +
>  .../build/bsps/aarch64/raspberrypi/objirq.yml |  27 +
>  .../bsps/aarch64/raspberrypi/objstart.yml |  35 ++
>  23 files changed, 557 insertions(+), 731 deletions(-)
>  create mode 100644 bsps/aarch64/raspberrypi/include/bsp/bcm2711.h
>  delete mode 100644 bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
>  create mode 100644
> bsps/aarch64/raspberrypi/include/bsp/start/bspstartmmu.h
>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/bsp4b.yml
>  delete mode 100644 spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml
>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/grp.yml
>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/grp4b.yml
>  rename spec/build/bsps/aarch64/raspberrypi/{linkercmds.yml =>
> linkcmds.yml} (88%)
>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/obj.yml
>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/objcache.yml
>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/objclock.yml
>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/objconsole.yml
>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/objirq.yml
>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/objstart.yml
>
> --
> 2.41.0
>
>
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

[PATCH 3/3] build: Modularize the aarch64/raspberrypi spec

2023-08-07 Thread Utkarsh Verma
---
 spec/build/bsps/aarch64/raspberrypi/abi.yml   | 39 ++
 spec/build/bsps/aarch64/raspberrypi/bsp4b.yml | 23 ++
 .../aarch64/raspberrypi/bspraspberrypi4.yml   | 75 ---
 spec/build/bsps/aarch64/raspberrypi/grp.yml   | 25 +++
 spec/build/bsps/aarch64/raspberrypi/grp4b.yml | 26 +++
 .../{linkercmds.yml => linkcmds.yml}  | 27 ---
 spec/build/bsps/aarch64/raspberrypi/obj.yml   | 40 ++
 .../bsps/aarch64/raspberrypi/objcache.yml | 23 ++
 .../bsps/aarch64/raspberrypi/objclock.yml | 24 ++
 .../bsps/aarch64/raspberrypi/objconsole.yml   | 20 +
 .../build/bsps/aarch64/raspberrypi/objirq.yml | 27 +++
 .../bsps/aarch64/raspberrypi/objstart.yml | 35 +
 12 files changed, 285 insertions(+), 99 deletions(-)
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/bsp4b.yml
 delete mode 100644 spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/grp.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/grp4b.yml
 rename spec/build/bsps/aarch64/raspberrypi/{linkercmds.yml => linkcmds.yml} 
(88%)
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/obj.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/objcache.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/objclock.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/objconsole.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/objirq.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/objstart.yml

diff --git a/spec/build/bsps/aarch64/raspberrypi/abi.yml 
b/spec/build/bsps/aarch64/raspberrypi/abi.yml
index 38a8d8bc8f..0e365f0146 100644
--- a/spec/build/bsps/aarch64/raspberrypi/abi.yml
+++ b/spec/build/bsps/aarch64/raspberrypi/abi.yml
@@ -1,19 +1,28 @@
 SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
-actions:
-- get-string: null
-- split: null
-- env-append: null
-build-type: option
 copyrights:
-- Copyright (C) 2022 Mohd Noor Aman
-default:
-- enabled-by: true
-  value:
-  - -mcpu=cortex-a72
-  - -march=armv8-a
-description: |
-  ABI flags
+  - Copyright (C) 2022 Mohd Noor Aman
+  - Copyright (C) 2023 Utkarsh Verma
+
+type: build
 enabled-by: true
-links: []
+
+build-type: option
 name: ABI_FLAGS
-type: build
+description: ABI flags
+
+actions:
+  - get-string: null
+  - split: null
+  - env-append: null
+
+default:
+  - enabled-by:
+  - aarch64/raspberrypi4b
+value:
+  - -mcpu=cortex-a72
+  - -march=armv8-a
+  - -mstrict-align
+
+links:
+  - role: build-dependency
+uid: ../../opto2
diff --git a/spec/build/bsps/aarch64/raspberrypi/bsp4b.yml 
b/spec/build/bsps/aarch64/raspberrypi/bsp4b.yml
new file mode 100644
index 00..058f97d1eb
--- /dev/null
+++ b/spec/build/bsps/aarch64/raspberrypi/bsp4b.yml
@@ -0,0 +1,23 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+  - Copyright (C) 2022 Mohd Noor Aman
+  - Copyright (C) 2023 Utkarsh Verma
+
+type: build
+enabled-by: true
+
+build-type: bsp
+arch: aarch64
+bsp: raspberrypi4b
+family: raspberrypi
+cflags: []
+cppflags: []
+includes: []
+install: []
+source: []
+
+links:
+  - role: build-dependency
+uid: grp4b
+  - role: build-dependency
+uid: linkcmds
diff --git a/spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml 
b/spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml
deleted file mode 100644
index d49e12a7f0..00
--- a/spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml
+++ /dev/null
@@ -1,75 +0,0 @@
-SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
-arch: aarch64
-bsp: raspberrypi4b
-build-type: bsp
-cflags: []
-copyrights:
-- Copyright (C) 2022 Mohd Noor Aman
-cppflags: []
-enabled-by: true
-family: raspberrypi
-includes: []
-install:
-- destination: ${BSP_INCLUDEDIR}
-  source:
-  - bsps/aarch64/raspberrypi/include/bsp.h
-  - bsps/aarch64/raspberrypi/include/tm27.h
-- destination: ${BSP_INCLUDEDIR}/bsp
-  source:
-  - bsps/aarch64/raspberrypi/include/bsp/irq.h
-  - bsps/aarch64/raspberrypi/include/bsp/bcm2711.h
-- destination: ${BSP_INCLUDEDIR}/bsp/start
-  source:
-  - bsps/aarch64/raspberrypi/include/bsp/start/bspstartmmu.h
-links:
-- role: build-dependency
-  uid: ../grp
-- role: build-dependency
-  uid: ../start
-- role: build-dependency
-  uid: ../optmmupages
-- role: build-dependency
-  uid: ../optgtusevirt
-- role: build-dependency
-  uid: ../optgtuseps
-- role: build-dependency
-  uid: abi
-- role: build-dependency
-  uid: ../../optcachedata
-- role: build-dependency
-  uid: ../../optcacheinst
-- role: build-dependency
-  uid: ../../opto2
-- role: build-dependency
-  uid: ../../bspopts
-- role: build-dependency
-  uid: linkercmds
-- role: build-dependency
-  uid: ../../obj
-- role: build-dependency
-  uid: ../../objirq
-source:
-- bsps/aarch64/raspberrypi/console/console.c
-- bsps/aarch64/raspberrypi/start/bspstart.c
-- bsps/aarch64/raspberrypi/start/bspstarthooks.c
-- bsps/aarch64/raspberrypi/start/bspstartmmu.c
-

[PATCH 2/3] bsps/aarch64/raspberrypi: Refactor the BSP

2023-08-07 Thread Utkarsh Verma
This commit restructures the BSP to be more modular and introduces
IWYU(include what you use) includes alongwith some formatting changes.

build: Update spec for aarch64/raspberrypi
---
 bsps/aarch64/raspberrypi/console/console.c|  39 +-
 bsps/aarch64/raspberrypi/include/bsp.h|  37 +-
 .../aarch64/raspberrypi/include/bsp/bcm2711.h |  96 
 bsps/aarch64/raspberrypi/include/bsp/irq.h| 102 ++--
 .../raspberrypi/include/bsp/raspberrypi.h | 471 --
 .../include/bsp/start/bspstartmmu.h   |  45 ++
 bsps/aarch64/raspberrypi/include/tm27.h   |   5 +-
 bsps/aarch64/raspberrypi/start/bspstart.c |  16 +-
 .../aarch64/raspberrypi/start/bspstarthooks.c |  26 +-
 bsps/aarch64/raspberrypi/start/bspstartmmu.c  |  66 +--
 .../aarch64/raspberrypi/bspraspberrypi4.yml   |   5 +-
 11 files changed, 272 insertions(+), 636 deletions(-)
 create mode 100644 bsps/aarch64/raspberrypi/include/bsp/bcm2711.h
 delete mode 100644 bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
 create mode 100644 bsps/aarch64/raspberrypi/include/bsp/start/bspstartmmu.h

diff --git a/bsps/aarch64/raspberrypi/console/console.c 
b/bsps/aarch64/raspberrypi/console/console.c
index 73bb0036ff..294fdba022 100644
--- a/bsps/aarch64/raspberrypi/console/console.c
+++ b/bsps/aarch64/raspberrypi/console/console.c
@@ -3,13 +3,14 @@
 /**
  * @file
  *
- * @ingroup RTEMSBSPsAArch64Raspberrypi4
+ * @ingroup RTEMSBSPsAArch64RaspberryPi
  *
  * @brief Console Configuration
  */
 
 /*
  * Copyright (C) 2022 Mohd Noor Aman
+ * Copyright (C) 2023 Utkarsh Verma
  *
  *
  * Redistribution and use in source and binary forms, with or without
@@ -34,36 +35,32 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include 
-
-#include 
-#include 
 #include 
+#include 
+#include 
 
-#include 
+#include "bsp.h"
 
-arm_pl011_context raspberrypi_4_context = {
-  .base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("PL011"),
-  .regs = (volatile pl011 *) BSP_RPI4_PL011_BASE,
-  .initial_baud = 115200
+arm_pl011_context uart0 = {
+.base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("PL011"),
+.regs = (volatile pl011*)BSP_UART0_BASE,
+.initial_baud = 115200,
 };
 
 const console_device console_device_table[] = {
-  {
-.device_file = "/dev/ttyS0",
-.probe = console_device_probe_default,
-.handler = _pl011_fns,
-.context = _4_context.base
-  }
+{
+.device_file = "/dev/ttyAMA0",
+.probe   = console_device_probe_default,
+.handler = _pl011_fns,
+.context = ,
+},
 };
 
 const size_t console_device_count = RTEMS_ARRAY_SIZE(console_device_table);
 
-static void output_char( char c )
-{
-  arm_pl011_write_polled(_4_context.base, c);
+static void output_char(char c) {
+arm_pl011_write_polled(, c);
 }
 
-BSP_output_char_function_type BSP_output_char = output_char;
-
+BSP_output_char_function_type BSP_output_char   = output_char;
 BSP_polling_getchar_function_type BSP_poll_char = NULL;
diff --git a/bsps/aarch64/raspberrypi/include/bsp.h 
b/bsps/aarch64/raspberrypi/include/bsp.h
index 4fa81edd40..b4dbb39223 100644
--- a/bsps/aarch64/raspberrypi/include/bsp.h
+++ b/bsps/aarch64/raspberrypi/include/bsp.h
@@ -3,13 +3,14 @@
 /**
  * @file
  *
- * @ingroup RTEMSBSPsAArch64Raspberrypi4
+ * @ingroup RTEMSBSPsAArch64RaspberryPi
  *
- * @brief Core BSP definitions
+ * @brief Core BSP Definitions
  */
 
 /*
  * Copyright (C) 2022 Mohd Noor Aman
+ * Copyright (C) 2023 Utkarsh Verma
  *
  *
  * Redistribution and use in source and binary forms, with or without
@@ -34,8 +35,8 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef LIBBSP_AARCH64_RASPBERRYPI_4_BSP_H
-#define LIBBSP_AARCH64_RASPBERRYPI_4_BSP_H
+#ifndef LIBBSP_AARCH64_RASPBERRYPI_BSP_H
+#define LIBBSP_AARCH64_RASPBERRYPI_BSP_H
 
 /**
  * @addtogroup RTEMSBSPsAArch64
@@ -48,29 +49,21 @@
 #ifndef ASM
 
 #include 
-#include 
 
-#include 
+#if RTEMS_BSP == raspberrypi4b
+#include "bsp/bcm2711.h"
 
-/*Raspberry pi MMU initialization */
-BSP_START_TEXT_SECTION void raspberrypi_4_setup_mmu_and_cache(void);
+#define BSP_GIC_BASE   BCM2711_GIC_BASE
+#define BSP_GIC_SIZE   BCM2711_GIC_SIZE
+#define BSP_ARM_GIC_CPUIF_BASE BCM2711_GIC_CPUIF_BASE
+#define BSP_ARM_GIC_DIST_BASE  BCM2711_GIC_DIST_BASE
 
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define BSP_ARM_GIC_CPUIF_BASE 0xFF842000
-#define BSP_ARM_GIC_DIST_BASE 0xFF841000
-
-#define BSP_RPI4_PL011_BASE 0xFE201000
-#define BSP_RPI4_PL011_LENGTH 0x200
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+#define BSP_UART0_BASE BCM2711_UART0_BASE
+#define BSP_UART0_SIZE BCM2711_UART0_SIZE
+#endif /* raspberrypi4b */
 
 #endif /* ASM */
 
 /** @} */
 
-#endif /* LIBBSP_AARCH64_RASPBERRYPI_4_BSP_H */
+#endif /* LIBBSP_AARCH64_RASPBERRYPI_BSP_H */
diff --git a/bsps/aarch64/raspberrypi/include/bsp/bcm2711.h 
b/bsps/aarch64/raspberrypi/include/bsp/bcm2711.h
new file mode 100644
ind

[PATCH 1/3] gitignore: Ignore clangd and clang-format files

2023-08-07 Thread Utkarsh Verma
---
 .gitignore | 4 
 1 file changed, 4 insertions(+)

diff --git a/.gitignore b/.gitignore
index 8b28b186e1..d0144f6737 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,3 +12,7 @@ Makefile.in
 /testsuites/build/build
 /testsuites/build/wscript
 .waf*
+.clangd
+.clang-format
+compile_commands.json
+.cache/
-- 
2.41.0

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 0/3] Refactor the aarch64/raspberryp4b BSP

2023-08-07 Thread Utkarsh Verma
This patch series refactors the BSP and build spec for Raspberry Pi 4B
with the following goals in mind:

- IWYU(include what you use) includes
- Modularity in BSP and the build spec
- Strict MMU mapping

This is my first code contribution to RTEMS, therefore suggestions of
any kind would be highly appreciated.

Regards,
Utkarsh

Utkarsh Verma (3):
  gitignore: Ignore clangd and clang-format files
  bsps/aarch64/raspberrypi: Refactor the BSP
  build: Modularize the aarch64/raspberrypi spec

 .gitignore|   4 +
 bsps/aarch64/raspberrypi/console/console.c|  39 +-
 bsps/aarch64/raspberrypi/include/bsp.h|  37 +-
 .../aarch64/raspberrypi/include/bsp/bcm2711.h |  96 
 bsps/aarch64/raspberrypi/include/bsp/irq.h| 102 ++--
 .../raspberrypi/include/bsp/raspberrypi.h | 471 --
 .../include/bsp/start/bspstartmmu.h   |  45 ++
 bsps/aarch64/raspberrypi/include/tm27.h   |   5 +-
 bsps/aarch64/raspberrypi/start/bspstart.c |  16 +-
 .../aarch64/raspberrypi/start/bspstarthooks.c |  26 +-
 bsps/aarch64/raspberrypi/start/bspstartmmu.c  |  66 +--
 spec/build/bsps/aarch64/raspberrypi/abi.yml   |  39 +-
 spec/build/bsps/aarch64/raspberrypi/bsp4b.yml |  23 +
 .../aarch64/raspberrypi/bspraspberrypi4.yml   |  72 ---
 spec/build/bsps/aarch64/raspberrypi/grp.yml   |  25 +
 spec/build/bsps/aarch64/raspberrypi/grp4b.yml |  26 +
 .../{linkercmds.yml => linkcmds.yml}  |  27 +-
 spec/build/bsps/aarch64/raspberrypi/obj.yml   |  40 ++
 .../bsps/aarch64/raspberrypi/objcache.yml |  23 +
 .../bsps/aarch64/raspberrypi/objclock.yml |  24 +
 .../bsps/aarch64/raspberrypi/objconsole.yml   |  20 +
 .../build/bsps/aarch64/raspberrypi/objirq.yml |  27 +
 .../bsps/aarch64/raspberrypi/objstart.yml |  35 ++
 23 files changed, 557 insertions(+), 731 deletions(-)
 create mode 100644 bsps/aarch64/raspberrypi/include/bsp/bcm2711.h
 delete mode 100644 bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
 create mode 100644 bsps/aarch64/raspberrypi/include/bsp/start/bspstartmmu.h
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/bsp4b.yml
 delete mode 100644 spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/grp.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/grp4b.yml
 rename spec/build/bsps/aarch64/raspberrypi/{linkercmds.yml => linkcmds.yml} 
(88%)
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/obj.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/objcache.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/objclock.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/objconsole.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/objirq.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/objstart.yml

-- 
2.41.0

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH 1/2] bsps/aarch64/raspberrypi: Refactor code base

2023-08-07 Thread Utkarsh Verma
Hi Kinsey,

Thanks for the suggestions. I'll break it up into several commits as
you suggested. Shall I break it down as follows?

- Build spec changes
- Formatting changes
- Macro renamings

Regards,
Utkarsh

On Mon, Aug 7, 2023 at 8:49 PM Kinsey Moore 
wrote:

> I would say that the content here is easily worth several patches. You've
> got header rearrangements and other formatting changes mixed in with macro
> renamings, build system changes, and other things. One comment below on the
> .gitignore. You've also got inconsistencies in usage of (C) vs (c).
>
> On Sun, Aug 6, 2023 at 11:49 PM Utkarsh Verma 
> wrote:
>
>> From: Utkarsh Verma 
>>
>> Refactor the code base for better organization to facilitate future
>> patches.
>> ---
>>  .gitignore|   4 +
>>  bsps/aarch64/raspberrypi/console/console.c|  42 +-
>>  bsps/aarch64/raspberrypi/include/bsp.h|  33 +-
>>  .../aarch64/raspberrypi/include/bsp/bcm2711.h |  98 
>>  bsps/aarch64/raspberrypi/include/bsp/irq.h|  94 ++--
>>  .../raspberrypi/include/bsp/raspberrypi.h | 471 --
>>  .../include/bsp/start/bspstartmmu.h   |   8 +
>>  bsps/aarch64/raspberrypi/start/bspstart.c |  18 +-
>>  .../aarch64/raspberrypi/start/bspstarthooks.c |  26 +-
>>  bsps/aarch64/raspberrypi/start/bspstartmmu.c  |  66 +--
>>  spec/build/bsps/aarch64/raspberrypi/abi.yml   |  37 +-
>>  spec/build/bsps/aarch64/raspberrypi/bsp4b.yml |  23 +
>>  .../aarch64/raspberrypi/bspraspberrypi4.yml   |  72 ---
>>  spec/build/bsps/aarch64/raspberrypi/grp.yml   |  49 ++
>>  spec/build/bsps/aarch64/raspberrypi/grp4b.yml |  26 +
>>  .../{linkercmds.yml => linkcmds.yml}  |  25 +-
>>  spec/build/bsps/aarch64/raspberrypi/obj.yml   |  50 ++
>>  .../aarch64/raspberrypi/objconsolepl011.yml   |  24 +
>>  .../aarch64/raspberrypi/optclockpl011freq.yml |  23 +
>>  .../aarch64/raspberrypi/optconsolebaud.yml|  23 +
>>  20 files changed, 487 insertions(+), 725 deletions(-)
>>  create mode 100644 bsps/aarch64/raspberrypi/include/bsp/bcm2711.h
>>  delete mode 100644 bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
>>  create mode 100644
>> bsps/aarch64/raspberrypi/include/bsp/start/bspstartmmu.h
>>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/bsp4b.yml
>>  delete mode 100644
>> spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml
>>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/grp.yml
>>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/grp4b.yml
>>  rename spec/build/bsps/aarch64/raspberrypi/{linkercmds.yml =>
>> linkcmds.yml} (90%)
>>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/obj.yml
>>  create mode 100644
>> spec/build/bsps/aarch64/raspberrypi/objconsolepl011.yml
>>  create mode 100644
>> spec/build/bsps/aarch64/raspberrypi/optclockpl011freq.yml
>>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/optconsolebaud.yml
>>
>> diff --git a/.gitignore b/.gitignore
>> index 8b28b186e1..d0144f6737 100644
>> --- a/.gitignore
>> +++ b/.gitignore
>> @@ -12,3 +12,7 @@ Makefile.in
>>  /testsuites/build/build
>>  /testsuites/build/wscript
>>  .waf*
>> +.clangd
>> +.clang-format
>> +compile_commands.json
>> +.cache/
>>
>
> While the clang and cache entries here are probably reasonable to go
> upstream, I don't think "compile_commands.json" is.
>
>
>
>> diff --git a/bsps/aarch64/raspberrypi/console/console.c
>> b/bsps/aarch64/raspberrypi/console/console.c
>> index 73bb0036ff..4aba0ec73e 100644
>> --- a/bsps/aarch64/raspberrypi/console/console.c
>> +++ b/bsps/aarch64/raspberrypi/console/console.c
>> @@ -3,13 +3,14 @@
>>  /**
>>   * @file
>>   *
>> - * @ingroup RTEMSBSPsAArch64Raspberrypi4
>> + * @ingroup RTEMSBSPsAArch64RaspberryPi
>>   *
>>   * @brief Console Configuration
>>   */
>>
>>  /*
>> - * Copyright (C) 2022 Mohd Noor Aman
>> + * Copyright (c) 2022 Mohd Noor Aman
>> + * Copyright (c) 2023 Utkarsh Verma
>>   *
>>   *
>>   * Redistribution and use in source and binary forms, with or without
>> @@ -34,36 +35,33 @@
>>   * POSSIBILITY OF SUCH DAMAGE.
>>   */
>>
>> -#include 
>> -
>> -#include 
>> -#include 
>>  #include 
>> -
>>  #include 
>> +#include 
>> +#include 
>>
>> -arm_pl011_context raspberrypi_4_context = {
>> -  .base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("PL011"),
>> -  .regs = (volatile pl011 *) BSP_RPI4_PL011

Re: [PATCH 0/2] Refactor aarch64/raspberrypi4b BSP

2023-08-06 Thread Utkarsh Verma
Forgot to add that these changes are there on my GitHub fork on the "
rpi4b-refactor <https://github.com/UtkarshVerma/rtems/tree/rpi4b-refactor>"
branch. Please have a look at it and let me know what could be improved.

On Mon, Aug 7, 2023 at 10:19 AM Utkarsh Verma  wrote:

> This patch refactors the Raspberry Pi 4B BSP with the following changes:
>
> - Build spec organization
> - IWYU(include what you use) includes
> - Self contained sources and headers
> - More specific MMU mapping
> - A basic API to allow extending this BSP to other variants of the RPi
>   family
>
> Utkarsh Verma (2):
>   bsps/aarch64/raspberrypi: Refactor code base
>   bsps/aarch64/raspberrypi: Refactor code base
>
>  .gitignore|   4 +
>  bsps/aarch64/raspberrypi/console/console.c|  41 +-
>  bsps/aarch64/raspberrypi/include/bsp.h|  33 +-
>  .../aarch64/raspberrypi/include/bsp/bcm2711.h |  98 
>  bsps/aarch64/raspberrypi/include/bsp/irq.h|  96 ++--
>  .../raspberrypi/include/bsp/raspberrypi.h | 471 --
>  .../include/bsp/start/bspstartmmu.h   |  45 ++
>  bsps/aarch64/raspberrypi/include/tm27.h   |   5 +-
>  bsps/aarch64/raspberrypi/start/bspstart.c |  18 +-
>  .../aarch64/raspberrypi/start/bspstarthooks.c |  28 +-
>  bsps/aarch64/raspberrypi/start/bspstartmmu.c  |  66 +--
>  spec/build/bsps/aarch64/raspberrypi/abi.yml   |  37 +-
>  spec/build/bsps/aarch64/raspberrypi/bsp4b.yml |  23 +
>  .../aarch64/raspberrypi/bspraspberrypi4.yml   |  72 ---
>  spec/build/bsps/aarch64/raspberrypi/grp.yml   |  49 ++
>  spec/build/bsps/aarch64/raspberrypi/grp4b.yml |  26 +
>  .../{linkercmds.yml => linkcmds.yml}  |  25 +-
>  spec/build/bsps/aarch64/raspberrypi/obj.yml   |  50 ++
>  .../aarch64/raspberrypi/objconsolepl011.yml   |  24 +
>  .../aarch64/raspberrypi/optclockpl011freq.yml |  23 +
>  .../aarch64/raspberrypi/optconsolebaud.yml|  23 +
>  21 files changed, 528 insertions(+), 729 deletions(-)
>  create mode 100644 bsps/aarch64/raspberrypi/include/bsp/bcm2711.h
>  delete mode 100644 bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
>  create mode 100644
> bsps/aarch64/raspberrypi/include/bsp/start/bspstartmmu.h
>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/bsp4b.yml
>  delete mode 100644 spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml
>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/grp.yml
>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/grp4b.yml
>  rename spec/build/bsps/aarch64/raspberrypi/{linkercmds.yml =>
> linkcmds.yml} (90%)
>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/obj.yml
>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/objconsolepl011.yml
>  create mode 100644
> spec/build/bsps/aarch64/raspberrypi/optclockpl011freq.yml
>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/optconsolebaud.yml
>
> --
> 2.41.0
>
>
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

[PATCH 2/2] bsps/aarch64/raspberrypi: Refactor code base

2023-08-06 Thread Utkarsh Verma
From: Utkarsh Verma 

Refactor the code base for better organization to facilitate future
patches.
---
 .gitignore|   4 +
 bsps/aarch64/raspberrypi/console/console.c|  41 +-
 bsps/aarch64/raspberrypi/include/bsp.h|  33 +-
 .../aarch64/raspberrypi/include/bsp/bcm2711.h |  98 
 bsps/aarch64/raspberrypi/include/bsp/irq.h|  96 ++--
 .../raspberrypi/include/bsp/raspberrypi.h | 471 --
 .../include/bsp/start/bspstartmmu.h   |  45 ++
 bsps/aarch64/raspberrypi/include/tm27.h   |   5 +-
 bsps/aarch64/raspberrypi/start/bspstart.c |  18 +-
 .../aarch64/raspberrypi/start/bspstarthooks.c |  28 +-
 bsps/aarch64/raspberrypi/start/bspstartmmu.c  |  66 +--
 spec/build/bsps/aarch64/raspberrypi/abi.yml   |  37 +-
 spec/build/bsps/aarch64/raspberrypi/bsp4b.yml |  23 +
 .../aarch64/raspberrypi/bspraspberrypi4.yml   |  72 ---
 spec/build/bsps/aarch64/raspberrypi/grp.yml   |  49 ++
 spec/build/bsps/aarch64/raspberrypi/grp4b.yml |  26 +
 .../{linkercmds.yml => linkcmds.yml}  |  25 +-
 spec/build/bsps/aarch64/raspberrypi/obj.yml   |  50 ++
 .../aarch64/raspberrypi/objconsolepl011.yml   |  24 +
 .../aarch64/raspberrypi/optclockpl011freq.yml |  23 +
 .../aarch64/raspberrypi/optconsolebaud.yml|  23 +
 21 files changed, 528 insertions(+), 729 deletions(-)
 create mode 100644 bsps/aarch64/raspberrypi/include/bsp/bcm2711.h
 delete mode 100644 bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
 create mode 100644 bsps/aarch64/raspberrypi/include/bsp/start/bspstartmmu.h
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/bsp4b.yml
 delete mode 100644 spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/grp.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/grp4b.yml
 rename spec/build/bsps/aarch64/raspberrypi/{linkercmds.yml => linkcmds.yml} 
(90%)
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/obj.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/objconsolepl011.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/optclockpl011freq.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/optconsolebaud.yml

diff --git a/.gitignore b/.gitignore
index 8b28b186e1..d0144f6737 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,3 +12,7 @@ Makefile.in
 /testsuites/build/build
 /testsuites/build/wscript
 .waf*
+.clangd
+.clang-format
+compile_commands.json
+.cache/
diff --git a/bsps/aarch64/raspberrypi/console/console.c 
b/bsps/aarch64/raspberrypi/console/console.c
index 73bb0036ff..2179dd117f 100644
--- a/bsps/aarch64/raspberrypi/console/console.c
+++ b/bsps/aarch64/raspberrypi/console/console.c
@@ -3,13 +3,14 @@
 /**
  * @file
  *
- * @ingroup RTEMSBSPsAArch64Raspberrypi4
+ * @ingroup RTEMSBSPsAArch64RaspberryPi
  *
  * @brief Console Configuration
  */
 
 /*
- * Copyright (C) 2022 Mohd Noor Aman
+ * Copyright (c) 2022 Mohd Noor Aman
+ * Copyright (c) 2023 Utkarsh Verma
  *
  *
  * Redistribution and use in source and binary forms, with or without
@@ -34,36 +35,32 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include 
-
-#include 
-#include 
 #include 
+#include 
+#include 
 
-#include 
+#include "bsp.h"
 
-arm_pl011_context raspberrypi_4_context = {
-  .base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("PL011"),
-  .regs = (volatile pl011 *) BSP_RPI4_PL011_BASE,
-  .initial_baud = 115200
+arm_pl011_context uart0 = {
+.base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("PL011"),
+.regs = (volatile pl011*)BSP_UART0_BASE,
+.initial_baud = BSP_CONSOLE_BAUD,
 };
 
 const console_device console_device_table[] = {
-  {
-.device_file = "/dev/ttyS0",
-.probe = console_device_probe_default,
-.handler = _pl011_fns,
-.context = _4_context.base
-  }
+{
+.device_file = "/dev/ttyAMA0",
+.probe   = console_device_probe_default,
+.handler = _pl011_fns,
+.context = ,
+},
 };
 
 const size_t console_device_count = RTEMS_ARRAY_SIZE(console_device_table);
 
-static void output_char( char c )
-{
-  arm_pl011_write_polled(_4_context.base, c);
+static void output_char(char c) {
+arm_pl011_write_polled(, c);
 }
 
-BSP_output_char_function_type BSP_output_char = output_char;
-
+BSP_output_char_function_type BSP_output_char   = output_char;
 BSP_polling_getchar_function_type BSP_poll_char = NULL;
diff --git a/bsps/aarch64/raspberrypi/include/bsp.h 
b/bsps/aarch64/raspberrypi/include/bsp.h
index 4fa81edd40..0c2b4c98eb 100644
--- a/bsps/aarch64/raspberrypi/include/bsp.h
+++ b/bsps/aarch64/raspberrypi/include/bsp.h
@@ -3,13 +3,14 @@
 /**
  * @file
  *
- * @ingroup RTEMSBSPsAArch64Raspberrypi4
+ * @ingroup RTEMSBSPsAArch64RaspberryPi
  *
  * @brief Core BSP definitions
  */
 
 /*
  * Copyright (C) 2022 Mohd Noor Aman
+ * Copyright (C) 2023 Utkarsh Verma
  *
  *
  * Redistribution and use in source and binary forms, with or 

[PATCH 1/2] bsps/aarch64/raspberrypi: Refactor code base

2023-08-06 Thread Utkarsh Verma
From: Utkarsh Verma 

Refactor the code base for better organization to facilitate future
patches.
---
 .gitignore|   4 +
 bsps/aarch64/raspberrypi/console/console.c|  42 +-
 bsps/aarch64/raspberrypi/include/bsp.h|  33 +-
 .../aarch64/raspberrypi/include/bsp/bcm2711.h |  98 
 bsps/aarch64/raspberrypi/include/bsp/irq.h|  94 ++--
 .../raspberrypi/include/bsp/raspberrypi.h | 471 --
 .../include/bsp/start/bspstartmmu.h   |   8 +
 bsps/aarch64/raspberrypi/start/bspstart.c |  18 +-
 .../aarch64/raspberrypi/start/bspstarthooks.c |  26 +-
 bsps/aarch64/raspberrypi/start/bspstartmmu.c  |  66 +--
 spec/build/bsps/aarch64/raspberrypi/abi.yml   |  37 +-
 spec/build/bsps/aarch64/raspberrypi/bsp4b.yml |  23 +
 .../aarch64/raspberrypi/bspraspberrypi4.yml   |  72 ---
 spec/build/bsps/aarch64/raspberrypi/grp.yml   |  49 ++
 spec/build/bsps/aarch64/raspberrypi/grp4b.yml |  26 +
 .../{linkercmds.yml => linkcmds.yml}  |  25 +-
 spec/build/bsps/aarch64/raspberrypi/obj.yml   |  50 ++
 .../aarch64/raspberrypi/objconsolepl011.yml   |  24 +
 .../aarch64/raspberrypi/optclockpl011freq.yml |  23 +
 .../aarch64/raspberrypi/optconsolebaud.yml|  23 +
 20 files changed, 487 insertions(+), 725 deletions(-)
 create mode 100644 bsps/aarch64/raspberrypi/include/bsp/bcm2711.h
 delete mode 100644 bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
 create mode 100644 bsps/aarch64/raspberrypi/include/bsp/start/bspstartmmu.h
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/bsp4b.yml
 delete mode 100644 spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/grp.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/grp4b.yml
 rename spec/build/bsps/aarch64/raspberrypi/{linkercmds.yml => linkcmds.yml} 
(90%)
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/obj.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/objconsolepl011.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/optclockpl011freq.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/optconsolebaud.yml

diff --git a/.gitignore b/.gitignore
index 8b28b186e1..d0144f6737 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,3 +12,7 @@ Makefile.in
 /testsuites/build/build
 /testsuites/build/wscript
 .waf*
+.clangd
+.clang-format
+compile_commands.json
+.cache/
diff --git a/bsps/aarch64/raspberrypi/console/console.c 
b/bsps/aarch64/raspberrypi/console/console.c
index 73bb0036ff..4aba0ec73e 100644
--- a/bsps/aarch64/raspberrypi/console/console.c
+++ b/bsps/aarch64/raspberrypi/console/console.c
@@ -3,13 +3,14 @@
 /**
  * @file
  *
- * @ingroup RTEMSBSPsAArch64Raspberrypi4
+ * @ingroup RTEMSBSPsAArch64RaspberryPi
  *
  * @brief Console Configuration
  */
 
 /*
- * Copyright (C) 2022 Mohd Noor Aman
+ * Copyright (c) 2022 Mohd Noor Aman
+ * Copyright (c) 2023 Utkarsh Verma
  *
  *
  * Redistribution and use in source and binary forms, with or without
@@ -34,36 +35,33 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include 
-
-#include 
-#include 
 #include 
-
 #include 
+#include 
+#include 
 
-arm_pl011_context raspberrypi_4_context = {
-  .base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("PL011"),
-  .regs = (volatile pl011 *) BSP_RPI4_PL011_BASE,
-  .initial_baud = 115200
+#include "bsp.h"
+
+arm_pl011_context uart0 = {
+.base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("PL011"),
+.regs = (volatile pl011 *)BSP_UART0_BASE,
+.initial_baud = BSP_CONSOLE_BAUD,
 };
 
 const console_device console_device_table[] = {
-  {
-.device_file = "/dev/ttyS0",
-.probe = console_device_probe_default,
-.handler = _pl011_fns,
-.context = _4_context.base
-  }
+{
+.device_file = "/dev/ttyAMA0",
+.probe   = console_device_probe_default,
+.handler = _pl011_fns,
+.context = ,
+},
 };
 
 const size_t console_device_count = RTEMS_ARRAY_SIZE(console_device_table);
 
-static void output_char( char c )
-{
-  arm_pl011_write_polled(_4_context.base, c);
+static void output_char(char c) {
+arm_pl011_write_polled(, c);
 }
 
-BSP_output_char_function_type BSP_output_char = output_char;
-
+BSP_output_char_function_type BSP_output_char   = output_char;
 BSP_polling_getchar_function_type BSP_poll_char = NULL;
diff --git a/bsps/aarch64/raspberrypi/include/bsp.h 
b/bsps/aarch64/raspberrypi/include/bsp.h
index 4fa81edd40..0c2b4c98eb 100644
--- a/bsps/aarch64/raspberrypi/include/bsp.h
+++ b/bsps/aarch64/raspberrypi/include/bsp.h
@@ -3,13 +3,14 @@
 /**
  * @file
  *
- * @ingroup RTEMSBSPsAArch64Raspberrypi4
+ * @ingroup RTEMSBSPsAArch64RaspberryPi
  *
  * @brief Core BSP definitions
  */
 
 /*
  * Copyright (C) 2022 Mohd Noor Aman
+ * Copyright (C) 2023 Utkarsh Verma
  *
  *
  * Redistribution and use in source and binary forms, with or without
@@ -34,8 +35,8 @@
  * POSSIBILITY OF SUCH DA

[PATCH 0/2] Refactor aarch64/raspberrypi4b BSP

2023-08-06 Thread Utkarsh Verma
This patch refactors the Raspberry Pi 4B BSP with the following changes:

- Build spec organization
- IWYU(include what you use) includes
- Self contained sources and headers
- More specific MMU mapping
- A basic API to allow extending this BSP to other variants of the RPi
  family

Utkarsh Verma (2):
  bsps/aarch64/raspberrypi: Refactor code base
  bsps/aarch64/raspberrypi: Refactor code base

 .gitignore|   4 +
 bsps/aarch64/raspberrypi/console/console.c|  41 +-
 bsps/aarch64/raspberrypi/include/bsp.h|  33 +-
 .../aarch64/raspberrypi/include/bsp/bcm2711.h |  98 
 bsps/aarch64/raspberrypi/include/bsp/irq.h|  96 ++--
 .../raspberrypi/include/bsp/raspberrypi.h | 471 --
 .../include/bsp/start/bspstartmmu.h   |  45 ++
 bsps/aarch64/raspberrypi/include/tm27.h   |   5 +-
 bsps/aarch64/raspberrypi/start/bspstart.c |  18 +-
 .../aarch64/raspberrypi/start/bspstarthooks.c |  28 +-
 bsps/aarch64/raspberrypi/start/bspstartmmu.c  |  66 +--
 spec/build/bsps/aarch64/raspberrypi/abi.yml   |  37 +-
 spec/build/bsps/aarch64/raspberrypi/bsp4b.yml |  23 +
 .../aarch64/raspberrypi/bspraspberrypi4.yml   |  72 ---
 spec/build/bsps/aarch64/raspberrypi/grp.yml   |  49 ++
 spec/build/bsps/aarch64/raspberrypi/grp4b.yml |  26 +
 .../{linkercmds.yml => linkcmds.yml}  |  25 +-
 spec/build/bsps/aarch64/raspberrypi/obj.yml   |  50 ++
 .../aarch64/raspberrypi/objconsolepl011.yml   |  24 +
 .../aarch64/raspberrypi/optclockpl011freq.yml |  23 +
 .../aarch64/raspberrypi/optconsolebaud.yml|  23 +
 21 files changed, 528 insertions(+), 729 deletions(-)
 create mode 100644 bsps/aarch64/raspberrypi/include/bsp/bcm2711.h
 delete mode 100644 bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
 create mode 100644 bsps/aarch64/raspberrypi/include/bsp/start/bspstartmmu.h
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/bsp4b.yml
 delete mode 100644 spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/grp.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/grp4b.yml
 rename spec/build/bsps/aarch64/raspberrypi/{linkercmds.yml => linkcmds.yml} 
(90%)
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/obj.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/objconsolepl011.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/optclockpl011freq.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/optconsolebaud.yml

-- 
2.41.0

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Need community suggestions for a new generic GPIO API

2023-07-07 Thread Utkarsh Verma
Dear all,

While working on the Raspberry Pi 4 BSP, I realized that the GPIO API
could be improved. It seems that last year, a GSoC student worked on
introducing a new GPIO API, called GPIO2 to RTEMS. However, it did not
get merged. Discussing this topic with my mentor and on RTEMS Discord
revealed that it would be a good idea to get it merged. For that, I
would like to ask the community the following:

- Moving forward, will GPIO2 API be the community-preferred GPIO API?
- What would be the recommended way in this new API to select
alternate pin functions? Will that be left for the BSP to decide?

Here are the links associated with GPIO2:
Git Repo: https://github.com/dtbpkmte/GSoC-2022-RTEMS
GPIO2 commit: https://github.com/dtbpkmte/GSoC-2022-RTEMS/commit/0aec268f1209c
Blog post about the API:
https://medium.com/@dtbpkmte/gsoc-2022-rtems-coding-period-week-4-gpio-wiki-1f10e5c4458
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 1/1] user/bsp/raspberrypi4: Fix incorrect config.txt typo

2023-06-14 Thread Utkarsh Verma
This commit removes spaces in config.txt which made it invalid.
---
 user/bsps/aarch64/raspberrypi4.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/user/bsps/aarch64/raspberrypi4.rst 
b/user/bsps/aarch64/raspberrypi4.rst
index efb09b6..ad817aa 100644
--- a/user/bsps/aarch64/raspberrypi4.rst
+++ b/user/bsps/aarch64/raspberrypi4.rst
@@ -63,7 +63,7 @@ default Mini-uart.
   # if user wants to enable GIC, uncomment the next line
   # enable_gic=1
   arm_64bit=1
-  dtoverlay = disable-bt
+  dtoverlay=disable-bt
   enable_uart=1
 
 .. note::
-- 
2.41.0

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 0/1] Fix Raspberry Pi 4B's UART setup's config.txt

2023-06-14 Thread Utkarsh Verma
This is a simple patch fixing a typo made in the config.txt

Utkarsh Verma (1):
  user/bsp/raspberrypi4: Fix incorrect config.txt typo

 user/bsps/aarch64/raspberrypi4.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.41.0

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 0/1] Fix config.txt for Raspberry Pi 4B's UART setup

2023-06-14 Thread Utkarsh Verma
The config.txt included in the docs is invalid as it includes spaces in
the parameter assignment. This patch fixes that typo by removing the
spaces.

Utkarsh Verma (1):
  user/bsps/raspberrypi4: Fix config.txt for UART setup

 user/bsps/aarch64/raspberrypi4.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.41.0

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 1/1] eng: Fix builds for newer Sphinx versions (>=7)

2023-06-13 Thread Utkarsh Verma
The current Sphinx theme depends on the `style` parameter which got
deprecated in v5.1 and finally got removed in v7. Now, the `styles` key
should be preferred which is a list of stylesheets. This commit
implements this change.
---
 common/sphinx_rtd_theme_rtems/layout.html | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/common/sphinx_rtd_theme_rtems/layout.html 
b/common/sphinx_rtd_theme_rtems/layout.html
index 0fe6c65..91d67b5 100644
--- a/common/sphinx_rtd_theme_rtems/layout.html
+++ b/common/sphinx_rtd_theme_rtems/layout.html
@@ -67,7 +67,9 @@
   {%- endblock %}
 
   {# CSS #}
+  {% for style in styles %}
   
+  {% endfor %}
   
   {%- for css in css_files %}
 {%- if css|attr("rel") %}
-- 
2.41.0

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 0/1] eng: Fix builds for newer Sphinx versions (>=7)

2023-06-13 Thread Utkarsh Verma
The current Sphinx theme depends on the `style` parameter which got
deprecated in v5.1 and finally got removed in v7. Now, the `styles` key
should be preferred which is a list of stylesheets. This commit
implements this change.

Utkarsh Verma (1):
  eng: Fix builds for newer Sphinx versions (>=7)

 common/sphinx_rtd_theme_rtems/layout.html | 2 ++
 1 file changed, 2 insertions(+)

-- 
2.41.0

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH 0/1] Improve coherence of user/start docs

2023-04-06 Thread Utkarsh Verma
Hi,

This is just a gentle reminder for this patch. Please let me know if I
could improve anything.

Regards,
Utkarsh

On Wed, Mar 29, 2023 at 6:08 AM Utkarsh Verma  wrote:

> This patch improves consistency of the documentation in the user/start
> section. In app.rst, absolute path has been removed because the PATH had
> already been set appropriately in the previous page, i.e. bsp-buil. In
> bsp-build.rst, instructions have been removed for manually creating a
> build directory as it is unnecessary. Apart from that, minor grammatical
> fixes have been made.
>
> Utkarsh Verma (1):
>   bsp-howto: Fix grammar and improve coherence.
>
>  user/start/app.rst   |  2 +-
>  user/start/bsp-build.rst | 17 +
>  2 files changed, 6 insertions(+), 13 deletions(-)
>
> --
> 2.40.0
>
>
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

GSoC Proposal Draft - Improve Raspberry Pi 4 BSP

2023-04-03 Thread Utkarsh Verma
I have drafted my GSoC proposal and uploaded it to Google Docs. You
can leave suggestions as comments in the document.

https://docs.google.com/document/d/1dL5zl_iSYeyx6ZoOpKjy-CkLh_OvgGDJvblrPH5q6rg/edit?usp=sharing

I apologize for not giving you much time for this review.

Regards,
Utkarsh
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 1/1] bsp-howto: Fix grammar and improve coherence.

2023-03-28 Thread Utkarsh Verma
---
 user/start/app.rst   |  2 +-
 user/start/bsp-build.rst | 17 +
 2 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/user/start/app.rst b/user/start/app.rst
index ce9a44d..0599305 100644
--- a/user/start/app.rst
+++ b/user/start/app.rst
@@ -209,7 +209,7 @@ Run the executable:
 
 .. code-block:: none
 
-$HOME/quick-start/rtems/@rtems-ver-major@/bin/rtems-run 
--rtems-bsps=erc32-sis build/sparc-rtems@rtems-ver-major@-erc32/hello.exe
+rtems-run --rtems-bsps=erc32-sis 
build/sparc-rtems@rtems-ver-major@-erc32/hello.exe
 
 The output will be something close to:
 
diff --git a/user/start/bsp-build.rst b/user/start/bsp-build.rst
index 8401d71..585d009 100644
--- a/user/start/bsp-build.rst
+++ b/user/start/bsp-build.rst
@@ -99,16 +99,9 @@ If you have built a BSP with the RSB, you can move on to
 Manual BSP Build
 
 
-We manually build the BSP in four steps.  The first step is to create a build
-directory.  It must be separate from the RTEMS source directory.  We use
-:file:`$HOME/quick-start/build/b-erc32`.
-
-.. code-block:: none
-
-mkdir -p $HOME/quick-start/build/b-erc32
-
-The second step is to set your path. Prepend the RTEMS tool suite binary
-directory to your ``$PATH`` throughout the remaining steps. Run the command:
+We manually build the BSP in four steps. The first step is to set your path.
+Prepend the RTEMS tool suite binary directory to your ``$PATH`` throughout the
+remaining steps. Run the command:
 
 .. code-block:: none
 
@@ -133,7 +126,7 @@ has not been correctly set. Check the contents of the path
 file cannot be found return to :ref:`QuickStartTools` and install the tools
 again.
 
-The first step is to configure the BSP.  There are various BSP build
+The second step is to configure the BSP.  There are various BSP build
 configuration options available.  Some options are BSP-specific.  Each section
 in the INI-style configuration file ``config.ini`` instructs the build system 
to
 build a particular BSP variant (`sparc/erc32` in our case).  We enable the 
build
@@ -179,7 +172,7 @@ by ``$BASE``.
 Checking for program 'xz': $BASE/anaconda3/bin/xz
 'configure' finished successfully (0.414s)
 
-Building the BSP is the second step.
+Building the BSP is the third step.
 
 .. code-block:: none
 
-- 
2.40.0

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 0/1] Improve coherence of user/start docs

2023-03-28 Thread Utkarsh Verma
This patch improves consistency of the documentation in the user/start
section. In app.rst, absolute path has been removed because the PATH had
already been set appropriately in the previous page, i.e. bsp-buil. In
bsp-build.rst, instructions have been removed for manually creating a
build directory as it is unnecessary. Apart from that, minor grammatical
fixes have been made.

Utkarsh Verma (1):
  bsp-howto: Fix grammar and improve coherence.

 user/start/app.rst   |  2 +-
 user/start/bsp-build.rst | 17 +
 2 files changed, 6 insertions(+), 13 deletions(-)

-- 
2.40.0

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Improve docs for quickstart guide

2023-03-22 Thread Utkarsh Verma
Dear all,

I have made a small patch to improve the documentation of the quickstart
guide. Please have a look and let me know what you think.

P.S.: This is my first patch so feel free to let me know if I made any
mistakes.

Regards,
Utkarsh
From 1377d30f47b22133f8514d2525d6390573e181ca Mon Sep 17 00:00:00 2001
From: Utkarsh Verma 
Date: Thu, 23 Mar 2023 09:13:09 +0530
Subject: [PATCH 0/1] *** Improve coherence of user/start docs ***

This patch improves consistency of the documentation in the user/start
section. In app.rst, absolute path has been removed because the PATH had
already been set appropriately in the previous page, i.e. bsp-buil. In
bsp-build.rst, instructions have been removed for manually creating a
build directory as it is unnecessary. Apart from that, minor grammatical
fixes have been made.

Utkarsh Verma (1):
  bsp-howto: Fix grammar and improve coherence.

 user/start/app.rst   |  2 +-
 user/start/bsp-build.rst | 17 +
 2 files changed, 6 insertions(+), 13 deletions(-)

-- 
2.40.0

From 1377d30f47b22133f8514d2525d6390573e181ca Mon Sep 17 00:00:00 2001
From: Utkarsh Verma 
Date: Thu, 23 Mar 2023 09:10:47 +0530
Subject: [PATCH 1/1] bsp-howto: Fix grammar and improve coherence.

---
 user/start/app.rst   |  2 +-
 user/start/bsp-build.rst | 17 +
 2 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/user/start/app.rst b/user/start/app.rst
index ce9a44d..0599305 100644
--- a/user/start/app.rst
+++ b/user/start/app.rst
@@ -209,7 +209,7 @@ Run the executable:
 
 .. code-block:: none
 
-$HOME/quick-start/rtems/@rtems-ver-major@/bin/rtems-run --rtems-bsps=erc32-sis build/sparc-rtems@rtems-ver-major@-erc32/hello.exe
+rtems-run --rtems-bsps=erc32-sis build/sparc-rtems@rtems-ver-major@-erc32/hello.exe
 
 The output will be something close to:
 
diff --git a/user/start/bsp-build.rst b/user/start/bsp-build.rst
index 8401d71..585d009 100644
--- a/user/start/bsp-build.rst
+++ b/user/start/bsp-build.rst
@@ -99,16 +99,9 @@ If you have built a BSP with the RSB, you can move on to
 Manual BSP Build
 
 
-We manually build the BSP in four steps.  The first step is to create a build
-directory.  It must be separate from the RTEMS source directory.  We use
-:file:`$HOME/quick-start/build/b-erc32`.
-
-.. code-block:: none
-
-mkdir -p $HOME/quick-start/build/b-erc32
-
-The second step is to set your path. Prepend the RTEMS tool suite binary
-directory to your ``$PATH`` throughout the remaining steps. Run the command:
+We manually build the BSP in four steps. The first step is to set your path.
+Prepend the RTEMS tool suite binary directory to your ``$PATH`` throughout the
+remaining steps. Run the command:
 
 .. code-block:: none
 
@@ -133,7 +126,7 @@ has not been correctly set. Check the contents of the path
 file cannot be found return to :ref:`QuickStartTools` and install the tools
 again.
 
-The first step is to configure the BSP.  There are various BSP build
+The second step is to configure the BSP.  There are various BSP build
 configuration options available.  Some options are BSP-specific.  Each section
 in the INI-style configuration file ``config.ini`` instructs the build system to
 build a particular BSP variant (`sparc/erc32` in our case).  We enable the build
@@ -179,7 +172,7 @@ by ``$BASE``.
 Checking for program 'xz': $BASE/anaconda3/bin/xz
 'configure' finished successfully (0.414s)
 
-Building the BSP is the second step.
+Building the BSP is the third step.
 
 .. code-block:: none
 
-- 
2.40.0

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

GSoC Contributor Introduction

2023-03-22 Thread Utkarsh Verma
Dear all,

I am a final-year electronics undergrad from India. I love working with
hardware and the challenges resource-constrained embedded devices offer
while developing a solution. Moreover, I also like to develop software for
Linux in my free time. Therefore, I believe working on RTEMS would be a
good mix of both for me. Hence, I would like to participate in GSoC 23 and
contribute to the RTEMS project.

For GSoC, I would like to add support for new boards to RTEMS. Hence, I
found the following projects to be particularly interesting:

   - Improve the Raspberry Pi BSP (#2899
   <https://devel.rtems.org/ticket/2899>)
   - Improve PC386 BSP (#2900 <https://devel.rtems.org/ticket/2900>)
   - Beagleboard BSP projects (#2891 <https://devel.rtems.org/ticket/2891>)

Additionally, I am excited about using Rust for embedded applications, so
am also inclined to work towards "Port Rust to RTEMS (#4182
<https://devel.rtems.org/ticket/4182>)".

I have completed the GSoC hello world task and the output is attached to
this email.

Therefore, please let me know how I could proceed further based on the
projects mentioned above. If there are any pending tasks I could
contribute, and so on.

Regards,
Utkarsh Verma
https://utkarshverma.me
RTEMS Testing - Run, 6.0.not_released
 Command Line: /home/subaru/gsoc/rtems/rtems/6/bin//rtems-run 
--rtems-bsp=erc32-sis build/sparc-rtems6-erc32/hello.exe
 Host: Linux metia 6.2.7-arch1-1 #1 SMP PREEMPT_DYNAMIC Sat, 18 Mar 2023 
01:06:36 + x86_64
 Python: 3.10.10 (main, Mar  5 2023, 22:26:53) [GCC 12.2.1 20230201]
Host: Linux-6.2.7-arch1-1-x86_64-with-glibc2.37 (Linux metia 6.2.7-arch1-1 #1 
SMP PREEMPT_DYNAMIC Sat, 18 Mar 2023 01:06:36 + x86_64 )

 SIS - SPARC/RISCV instruction simulator 2.30,  copyright Jiri Gaisler 2020
 Bug-reports to j...@gaisler.se

 ERC32 emulation enabled

 Loaded build/sparc-rtems6-erc32/hello.exe, entry 0x0200

Hello, my name is Utkarsh, and I'm looking forward to GSoC 23!

[ RTEMS shutdown ]
RTEMS version: 6.0.0.74a6b33f3b48f8f2bd1b8e9a5026803965123eea
RTEMS tools: 12.2.1 20230224 (RTEMS 6, RSB 
f0e34eab8bf33b833a7d9d0b2bddd3b89f6d83cb, Newlib 17ac400)
executing thread ID: 0x0a010001
executing thread name: UI1 
cpu 0 in error mode (tt = 0x101)
93832  0200d460:  91d02000   ta  0x0
Run time : 0:00:00.255128
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel