[PATCH rtems-docs v2] raspberrypi4.rst: Added Documentation for the new AArch64 Raspberry pi 4B BSP

2022-10-04 Thread Mohd Noor Aman
This patch adds the relevant documentations required for booting the new BSP.
JTAG support is added for debugging. I have built the HTML docs and verified
them.
---
 user/bsps/aarch64/raspberrypi4.rst | 99 ++
 user/bsps/bsps-aarch64.rst |  1 +
 2 files changed, 100 insertions(+)
 create mode 100644 user/bsps/aarch64/raspberrypi4.rst

diff --git a/user/bsps/aarch64/raspberrypi4.rst 
b/user/bsps/aarch64/raspberrypi4.rst
new file mode 100644
index 000..5a45c65
--- /dev/null
+++ b/user/bsps/aarch64/raspberrypi4.rst
@@ -0,0 +1,99 @@
+.. SPDX-License-Identifier: CC-BY-SA-4.0
+
+.. Copyright (C) 2022 Mohd Noor Aman
+
+.. _BSP_aarch64_Raspberrypi_4:
+
+Raspberry Pi 4B
+===
+
+The 'raspberrypi4b' BSP currently supports only the LP64 ABI. ILP32 is not
+supported. Raspberry pi 4B all variants and Raspberry Pi 400  are supported. 
The
+default bootloader which is used by the Raspbian OS or other OS can be used to
+boot the RTEMS. Currently, QEMU emulation is not supported. 
+
+Clock Driver
+
+
+The clock driver uses the `ARM Generic Timer`.
+
+Console Driver
+--
+
+Raspberry pi 4B has 2 types of UARTs, ARM PL011 and Mini-uart. The PL011 is a
+capable, broadly 16550-compatible UART, while the mini UART has a reduced
+feature set. The console driver supports the default Qemu emulated ARM PL011
+PrimeCell UART as well as the physical ARM PL011 PrimeCell UART in the
+raspberrypi hardware. Mini-uart is not supported.
+
+Preparing to boot
+--
+
+Raspberry Pi uses a different mechanism to boot. First the GPU initializes,
+loads the bootloader and then looks for the kernel img. By default the arm64
+mode looks for the ``kernel8.img``. Any other kernel can be loaded by adding
+`kernel=` to the ``config.txt``.
+
+The Firmware files are required in order to boot RTEMS. The latest firmware can
+be downloaded from the `Raspberry Pi Firmware Repository
+`_. USB boot is supported. All the
+files (Firmwares and kernel) must be place in the FAT32 partition only. Add
+``arm_64bit=1`` in the config.txt file in order to boot the BSP in 64bit kernel
+mode. 
+
+
+UART Setup
+^^
+
+Connect your serial device to the GPIO15 and GPIO14. Add the following to the
+config.txt file in order to use the PL011 UART0 and thus disabling the default
+Mini-uart.
+
+.. code-block:: none
+
+  dtoverlay = disable-bt
+  enable_uart=1
+
+.. note:: 
+  The Raspberry Pi 4B and 400 have an additional four PL011 UARTs. They are 
not 
+  supported.
+
+Generating kernel image 
+^^^
+
+The following steps show how to run ``hello.exe`` on the BSP. Other executables
+can be processed in a similar way.
+
+To create the kernel image:
+
+.. code-block:: shell
+
+  $ aarch64-rtems@rtems-ver-major@-objcopy -Obinary hello.exe kernel8.img
+
+Copy the kernel image to the SD card.
+
+JTAG Setup
+--
+
+The Raspberry Pi 4 doesn't have dedicated JTAG pins. Instead, you must 
configure
+the GPIO pins (GPIO22-GPIO27) to activate the JTAG functionality. The RPi 4
+documentation refers to this as Alt4 functions of those pins. Alt5 does exist
+too, which goes from GPIO4, 5, 6, 12 and 13. you can check this out from
+`pinout.xyz `_ or `eLinux
+`_
+
+One more thing to note on JTAG with Raspberry pi 4B is that, by default, All 
the
+GPIO pins are pulled down, according to the `BCM2711 documentation
+`_. This
+wasn't the case in the earlier models. So in order to let the data flow freely,
+we will have to disable them.
+
+.. code-block:: none
+
+  # Disable pull downs
+  gpio=22-27=np
+
+  # Enable jtag pins (i.e. GPIO22-GPIO27)
+  enable_jtag_gpio=1
+
+
diff --git a/user/bsps/bsps-aarch64.rst b/user/bsps/bsps-aarch64.rst
index 933370f..f3aa15c 100644
--- a/user/bsps/bsps-aarch64.rst
+++ b/user/bsps/bsps-aarch64.rst
@@ -9,3 +9,4 @@ aarch64 (AArch64)
 .. include:: aarch64/a72.rst
 .. include:: aarch64/xilinx-versal.rst
 .. include:: aarch64/xilinx-zynqmp.rst
+.. include:: aarch64/raspberrypi4.rst
\ No newline at end of file
-- 
2.37.3

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


Re: [PATCH 06/13] config: Add rtems_malloc_task_stack_for_idle()

2022-10-04 Thread Sebastian Huber

On 04/10/2022 23:21, Chris Johns wrote:

On 5/10/2022 12:41 am, Sebastian Huber wrote:

On 04/10/2022 15:21, Joel Sherrill wrote:

On Tue, Oct 4, 2022 at 12:40 AM Sebastian Huber
mailto:sebastian.hu...@embedded-brains.de>> wrote:

     On 30/09/2022 23:39, Chris Johns wrote:
  > On 30/9/2022 7:21 pm, Sebastian Huber wrote:
  >> Update #4524.
  >> ---
  >>   cpukit/doxygen/appl-config.h                | 13 +
  >>   cpukit/include/rtems/rtems/config.h         | 29 +-
  >>   cpukit/include/rtems/score/interr.h         |  1 +
  >>   cpukit/sapi/src/interrtext.c                |  3 +-
  >>   cpukit/sapi/src/malloctaskstackforidle.c    | 59
     +
  >>   spec/build/cpukit/librtemscpu.yml           |  1 +
  >>   spec/build/testsuites/sptests/grp.yml       |  2 +
  >>   spec/build/testsuites/sptests/spfatal36.yml | 19 +++
  >>   testsuites/sptests/spfatal36/init.c         | 52
     ++
  >>   testsuites/sptests/spfatal36/spfatal36.doc  | 11 
  >>   testsuites/sptests/spinternalerror02/init.c |  2 +-
  >>   testsuites/sptests/sptls04/init.c           |  2 +
  >>   12 files changed, 191 insertions(+), 3 deletions(-)
  >>   create mode 100644 cpukit/sapi/src/malloctaskstackforidle.c
  >>   create mode 100644 spec/build/testsuites/sptests/spfatal36.yml
  >>   create mode 100644 testsuites/sptests/spfatal36/init.c
  >>   create mode 100644 testsuites/sptests/spfatal36/spfatal36.doc
  >>
  >> diff --git a/cpukit/doxygen/appl-config.h
     b/cpukit/doxygen/appl-config.h
  >> index aa6dbae648..ee647dc961 100644
  >> --- a/cpukit/doxygen/appl-config.h
  >> +++ b/cpukit/doxygen/appl-config.h
  >> @@ -4842,6 +4842,19 @@
  >>    * configuration options.  It is assumed that any memory
     allocated for the
  >>    * stack of an IDLE task will not be from the RTEMS Workspace
     or the memory
  >>    * statically allocated by default.
  >> + *
  >> + * For applications with a thread-local storage size which is
     completely
  >> + * unknown at the time the application configuration is
     defined, RTEMS provides
  >> + * an IDLE task stack allocator which uses rtems_malloc().
  >
  > I thought the TLS size was static and set by the linker? Has this
     changed?

     No, this didn't change.

  >
  > I am confused about the relationship between an unknown TLS size
     and IDLE task?
  > And the relationship of the TLS size and stack size?

     Currently, the IDLE task storage area is statically allocated. The size
     of this area is defined by CONFIGURE_IDLE_TASK_STACK_SIZE. So, this
     configuration option doesn't directly specify the IDLE task stack size.
     This size covers also the TLS area.


Thanks for speaking up Chris. I also don't like the idea that something that
has said and meant IDLE stack size was getting other items lumped into it.


  >
  >> * * The size of the
  >> + * allocated thread storage area is the sum of stack size
     defined by the
  >> + * #CONFIGURE_IDLE_TASK_STACK_SIZE configuration option and the
     actual
  >> + * thread-local storage size of the application.
  >
  > The label CONFIGURE_IDLE_TASK_STACK_SIZE provides no insight into
     it being
  > effected by the TLS size.
  >
  >> * * Define this configuration
  >> + * option to ``rtems_malloc_task_stack_for_idle`` to use this
     allocator.  If
  >> + * the memory allocation fails, then the system terminates with the
  >> + * INTERNAL_ERROR_CORE fatal source and the
  >> + * INTERNAL_ERROR_NO_MEMORY_FOR_IDLE_TASK_STACK fatal code
     during system
  >> + * initialization.
  >> + * @endparblock
  >
  > I am confused about the how and why I would use this change?

     With the statically allocated storage area for the IDLE task you
     need at
     least an estimate of the size if you define the application
     configuration. If you can't estimate it, then one option is to simply
     allocate it dynamically.

     Maybe a better approach is to allocate the IDLE task storage from the
     workspace by default and use the CONFIGURE_IDLE_TASK_STACK_SIZE really
     for the stack size and not the complete storage area. We could add a
     new
     configuration option (for example CONFIGURE_IDLE_TASK_STORAGE_SIZE) to
     enable the static allocation.



CONFIGURE_IDLE_TASK_STORAGE_SIZE could default to the size of stack size
plus other items but it seems over complicated. Just have IDLE stack size and
the other
area for other items.

I don't know when IDLE task storage size was introduced but it has been a long
time ago. Changing the semantics of it seems quite wrong.


Ok, I will send a v2 of the patch which:


I suggest we get a clearer understand of what is happening first.


* Changes the default IDLE task storage allocation to the workspace.  It 

Re: [PATCH rtems-docs] raspberrypi4.rst: Added Documentation for the new AArch64 Raspberry pi 4B BSP

2022-10-04 Thread Noor Aman
Here is the documentation patch. I've generated the output and it works
fine. Reviews are required.

Thanks,
Noor

On Mon, 26 Sept 2022 at 12:22, Mohd Noor Aman 
wrote:

> This patch adds the relevant documentations required for booting the new
> BSP. JTAG support is added for debugging. I have built the HTML docs and
> verified them.
> ---
>  user/bsps/aarch64/raspberrypi4.rst | 92 ++
>  user/bsps/bsps-aarch64.rst |  1 +
>  2 files changed, 93 insertions(+)
>  create mode 100644 user/bsps/aarch64/raspberrypi4.rst
>
> diff --git a/user/bsps/aarch64/raspberrypi4.rst
> b/user/bsps/aarch64/raspberrypi4.rst
> new file mode 100644
> index 000..94daacf
> --- /dev/null
> +++ b/user/bsps/aarch64/raspberrypi4.rst
> @@ -0,0 +1,92 @@
> +.. SPDX-License-Identifier: CC-BY-SA-4.0
> +
> +.. Copyright (C) 2022 Mohd Noor Aman
> +
> +.. _BSP_aarch64_Raspberrypi_4:
> +
> +Raspberry Pi 4B
> +===
> +
> +The 'raspberrypi4b' BSP currently supports only the LP64 ABI. Raspberry
> pi 4B
> +and Raspberry Pi 400  are supported. The default bootloader which is used
> by the
> +Raspbian OS or other OS can be used to boot the RTEMS. Currently, QEMU is
> not
> +supported. This BSP supports the GICv2 interrupt controller.
> +
> +Clock Driver
> +
> +
> +The clock driver uses the `ARM Generic Timer`.
> +
> +Console Driver
> +--
> +
> +The console driver supports the default Qemu emulated ARM PL011 PrimeCell
> UART
> +as well as the physical ARM PL011 PrimeCell UART in the raspberrypi
> hardware.
> +Only UART0 is supported as of now.
> +
> +Preparing to boot
> +--
> +
> +Raspberry Pi uses a different mechanism to boot. First the GPU
> initializes,
> +loads the bootloader and then looks for the kernel img. By default the
> arm64
> +mode looks for the ``kernel8.img``. Any other kernel can be loaded by
> adding
> +`kernel=` to the ``config.txt``.
> +
> +The Firmware files are required in order to boot RTEMS. The latest
> firmware can
> +be downloaded from the `Raspberry Pi Firmware Repository
> +`_. USB boot is supported. All
> the
> +files (Firmwares and kernel) must be place in the FAT32 partition only.
> Add
> +``arm_64bit=1`` in the config.txt file in order to boot the BSP in 64bit
> kernel
> +mode.
> +
> +
> +UART Setup
> +^^
> +
> +Connect your serial device to the GPIO15 and GPIO14. Add the following to
> the
> +config.txt file in order to use the PL011 UART0.
> +
> +.. code-block:: none
> +
> +  dtoverlay = disable-bt
> +  enable_uart=1
> +
> +Generating kernel image
> +^^^
> +
> +The following steps show how to run ``hello.exe`` on the BSP. Other
> executables
> +can be processed in a similar way.
> +
> +To create the kernel image:
> +
> +.. code-block:: shell
> +
> +  $ aarch64-rtems@rtems-ver-major@-objcopy -Obinary hello.exe kernel8.img
> +
> +Copy the kernel image to the SD card.
> +
> +JTAG Setup
> +--
> +
> +The Raspberry Pi 4 doesn't have dedicated JTAG pins. Instead, you must
> configure
> +the GPIO pins (GPIO22-GPIO27) to activate the JTAG functionality. The RPi
> 4
> +documentation refers to this as Alt4 functions of those pins. Alt5 does
> exist
> +too, which goes from GPIO4, 5, 6, 12 and 13. you can check this out from
> +`pinout.xyz `_ or `eLinux
> +`_
> +
> +One more thing to note on JTAG with Raspberry pi 4B is that, by default,
> All the
> +GPIO pins are pulled down, according to the `BCM2711 documentation
> +`_.
> This
> +wasn't the case in the earlier models. So in order to let the data flow
> freely,
> +we will have to disable them.
> +
> +.. code-block:: none
> +
> +  # Disable pull downs
> +  gpio=22-27=np
> +
> +  # Enable jtag pins (i.e. GPIO22-GPIO27)
> +  enable_jtag_gpio=1
> +
> +
> diff --git a/user/bsps/bsps-aarch64.rst b/user/bsps/bsps-aarch64.rst
> index 933370f..f3aa15c 100644
> --- a/user/bsps/bsps-aarch64.rst
> +++ b/user/bsps/bsps-aarch64.rst
> @@ -9,3 +9,4 @@ aarch64 (AArch64)
>  .. include:: aarch64/a72.rst
>  .. include:: aarch64/xilinx-versal.rst
>  .. include:: aarch64/xilinx-zynqmp.rst
> +.. include:: aarch64/raspberrypi4.rst
> \ No newline at end of file
> --
> 2.34.1
>
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH v3] bsp/aarch64: Add new Raspberry Pi 4B BSP

2022-10-04 Thread Noor Aman
I have sent the documentations earlier, Although reviews are required. I'll
reply to that patch to bring it up on the devel.
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [docs 1/5] c-user: Add CONFIGURE_IDLE_TASK_MINIMUM_STACK_SIZE

2022-10-04 Thread Chris Johns
Hi,

Can we please wait until the patches are sorted before this is merged?

Thanks
Chris

On 30/9/2022 7:15 pm, Sebastian Huber wrote:
> ---
>  c-user/config/idle-task.rst| 95 --
>  c-user/config/task-stack-alloc.rst | 39 ++--
>  2 files changed, 124 insertions(+), 10 deletions(-)
> 
> diff --git a/c-user/config/idle-task.rst b/c-user/config/idle-task.rst
> index 359f862..d7b43ae 100644
> --- a/c-user/config/idle-task.rst
> +++ b/c-user/config/idle-task.rst
> @@ -1,6 +1,6 @@
>  .. SPDX-License-Identifier: CC-BY-SA-4.0
>  
> -.. Copyright (C) 2020, 2021 embedded brains GmbH 
> (http://www.embedded-brains.de)
> +.. Copyright (C) 2020, 2022 embedded brains GmbH 
> (http://www.embedded-brains.de)
>  .. Copyright (C) 1988, 2008 On-Line Applications Research Corporation (OAR)
>  
>  .. This file is part of the RTEMS quality process and was automatically
> @@ -134,6 +134,74 @@ options
>  
>  otherwise a compile time error in the configuration file will occur.
>  
> +.. Generated from spec:/acfg/if/idle-task-min-stack-size
> +
> +.. raw:: latex
> +
> +\clearpage
> +
> +.. index:: CONFIGURE_IDLE_TASK_MINIMUM_STACK_SIZE
> +.. index:: minimum task stack size
> +
> +.. _CONFIGURE_IDLE_TASK_MINIMUM_STACK_SIZE:
> +
> +CONFIGURE_IDLE_TASK_MINIMUM_STACK_SIZE
> +--
> +
> +.. rubric:: CONSTANT:
> +
> +``CONFIGURE_IDLE_TASK_MINIMUM_STACK_SIZE``
> +
> +.. rubric:: OPTION TYPE:
> +
> +This configuration option is an integer define.
> +
> +.. rubric:: DEFAULT VALUE:
> +
> +:c:macro:`CPU_STACK_MINIMUM_SIZE` / 4
> +
> +.. rubric:: DESCRIPTION:
> +
> +The value of this configuration option defines the minimum stack size in
> +bytes for every :term:`IDLE task` in the system.
> +
> +.. rubric:: NOTES:
> +
> +Adjusting this parameter should be done with caution.  Examining the actual
> +stack usage using the stack checker usage reporting facility is recommended
> +(see also :ref:`CONFIGURE_STACK_CHECKER_ENABLED`).
> +
> +This parameter can be used to increase the minimum from that
> +recommended. This can be used in higher memory systems to reduce the risk
> +of stack overflow without performing analysis on actual consumption.
> +
> +By default, the IDLE task storage areas are statically allocated.  The size
> +of the task storage area is defined by the 
> :ref:`CONFIGURE_IDLE_TASK_STACK_SIZE`
> +configuration option.  The task storage area contains the task stack, the
> +thread-local storage, and the floating-point context on architectures with a
> +separate floating-point context.  The size of the thread-local storage area
> +is defined at link time or by the 
> :ref:`CONFIGURE_MAXIMUM_THREAD_LOCAL_STORAGE_SIZE`
> +configuration option.  This configuration option is used to ensure that the
> +IDLE task stack size has at least the configured minimum size.  If the IDLE
> +task stack size is too small, for example because the thread-local storage
> +size is too large, then the system terminates with the
> +:ref:`INTERNAL_ERROR_CORE ` fatal source and the
> +:ref:`INTERNAL_ERROR_IDLE_THREAD_STACK_TOO_SMALL ` fatal 
> code during
> +system initialization.
> +
> +.. rubric:: CONSTRAINTS:
> +
> +The value of the configuration option shall be large enough so that
> +
> +* the thread handler can call the thread switch extensions for the IDLE task,
> +
> +* the thread handler can call the thread begin extensions for the IDLE task,
> +
> +* the thread handler can call the IDLE task body (see
> +  :ref:`CONFIGURE_IDLE_TASK_BODY`), and
> +
> +* the IDLE task can be interrupted by interrupt services.
> +
>  .. Generated from spec:/acfg/if/idle-task-stack-size
>  
>  .. raw:: latex
> @@ -165,13 +233,30 @@ defined by the :ref:`CONFIGURE_MINIMUM_TASK_STACK_SIZE` 
> configuration option.
>  
>  .. rubric:: DESCRIPTION:
>  
> -The value of this configuration option defines the task stack size for an
> -IDLE task.
> +The value of this configuration option defines the task storage area size for
> +an IDLE task.
>  
>  .. rubric:: NOTES:
>  
> -In SMP configurations, there is one IDLE task per configured processor, see
> -:ref:`CONFIGURE_MAXIMUM_PROCESSORS`.
> +Where the system was built with SMP support enabled, there is one IDLE task
> +for each configured processor, see :ref:`CONFIGURE_MAXIMUM_PROCESSORS`.
> +
> +By default, the IDLE task storage areas are statically allocated.  The size
> +of the task storage area for each IDLE task is defined by this configuration
> +option.  The task storage area contains the task stack, the thread-local
> +storage, and the floating-point context on architectures with a separate
> +floating-point context.  The size of the thread-local storage area is defined
> +at link time or by the :ref:`CONFIGURE_MAXIMUM_THREAD_LOCAL_STORAGE_SIZE` 
> configuration
> +option.  The :ref:`CONFIGURE_IDLE_TASK_MINIMUM_STACK_SIZE` configuration 
> option is used
> +to ensure that the IDLE task stack size has at least the configured minimum
> +size.  

Re: [PATCH v3] bsp/aarch64: Add new Raspberry Pi 4B BSP

2022-10-04 Thread Joel Sherrill
On Tue, Oct 4, 2022 at 5:03 PM Joel Sherrill  wrote:

>
>
> On Tue, Oct 4, 2022 at 4:38 PM Alan Cudmore 
> wrote:
>
>> It builds without error and boots for me!
>> I ran my RTEMS Kernel Image and tried out some task demos, whetstone,
>> dhrystone, created a RAM disk, etc.
>> Next will be a core Flight System (cFS) run.
>> This is going to be a very useful board to have RTEMS + SMP + Libbsd on,
>> especially when people can buy them again.
>> Thanks!
>> Alan
>>
>>
>> RTEMS Kernel Image Booting
>> *** RTEMS Info ***
>> 6.0.0.cc43dc3e22b21ddf902b7748fb27f16c9aee3719
>>  BSP Ticks Per Second = 100
>> *** End RTEMS info ***
>>
>> Populating Root file system from TAR file.
>> Setting up filesystems.
>> Initializing Local Commands.
>> Adding Target specific commands
>> Running /shell-init.
>>
>> 1: mkdir ram
>> 2: mkrfs /dev/rda
>> 3: mount -t rfs /dev/rda /ram
>> mounted /dev/rda -> /ram
>> 4: hello
>>   __  
>>/ __ \/_  __/ /  \/  / ___/
>>   / /_/ / / / / __/ / /\_/ /\__ \
>>  / _, _/ / / / /___/ /  / /___/ /
>> /_/ \_| /_/ /_/_/  /_///
>>
>> Hello RTEMS!
>> Create your own command here!
>> Starting shell
>>
>> RTEMS Shell on /dev/console. Use 'help' to list commands.
>> shell0 [/] #
>>
>
> Wow! I'm always impressed by how many RTEMS capabilities are
> available in a basic BSP.
>
> All it needs now is a network driver.  :)
>
> I'll merge this .
>

Well I couldn't stand to wait until morning to merge this. I just
pushed it. Please check that it is OK.

Are there any documentation patches?

--joel

> --joel
>
>>
>>
>> On Tue, Oct 4, 2022 at 2:40 PM Joel Sherrill  wrote:
>>
>>> Once Alan says it's OK, I will merge this.
>>>
>>> Great work! Please make sure code, docs, tester configuration, etc gets
>>> merged.
>>>
>>> On Tue, Oct 4, 2022 at 1:18 PM Kinsey Moore 
>>> wrote:
>>>
 I think all of the issues with this patch have been addressed; this
 looks good to me.

 Great work, Noor!

 Kinsey

 On Tue, Oct 4, 2022 at 11:12 AM Noor Aman 
 wrote:

> hey all,
> I've fixed the warning and edited the commit message to be more
> specific and to be in 80 words char limit.
>
> Thanks,
> Noor
>
> On Tue, 4 Oct 2022 at 16:08, Mohd Noor Aman 
> wrote:
>
>> This patch adds new Raspberry pi 4B AArch64 BSP to the RTEMS Family.
>> Currently
>> only LP64 ABI is supported. ILP32 is not supported. RAM starts from
>> 0x8 in
>> 64Bit kernel mode and MMU from 0x0. All Raspberrypi Pi 4B models and
>> Raspberry
>> Pi 400 are supported. All the IRQs are similiar to the older
>> Raspberry pi 2 ARM
>> BSP.
>>
>> Raspberry Pi 4B has 2 types of UARTs. Only PL011 serial is supported
>> currently.
>> Mini-UART is not supported. Mini-UART is default UART on the board so
>> it needs
>> to be disabled by adding "dtoverlay=disable-bt" to the config.txt. No
>> support
>> for additional 4 PL011-UARTs on the board.
>>
>> The raspberrypi.h includes many of the address required for the future
>> development of the RPi 4B BSP. This includes peripherals, ARM Timer,
>> VideoCore
>> Timer, Watchdog, Mailbox, AUX, FIQs and IRQs.
>> ---
>>  bsps/aarch64/raspberrypi/console/console.c|  69 +++
>>  bsps/aarch64/raspberrypi/include/bsp.h|  76 +++
>>  bsps/aarch64/raspberrypi/include/bsp/irq.h| 109 
>>  .../raspberrypi/include/bsp/raspberrypi.h | 471
>> ++
>>  bsps/aarch64/raspberrypi/include/tm27.h   |  46 ++
>>  bsps/aarch64/raspberrypi/start/bspstart.c |  49 ++
>>  .../aarch64/raspberrypi/start/bspstarthooks.c |  53 ++
>>  bsps/aarch64/raspberrypi/start/bspstartmmu.c  |  84 
>>  spec/build/bsps/aarch64/raspberrypi/abi.yml   |  21 +
>>  .../aarch64/raspberrypi/bspraspberrypi4.yml   |  81 +++
>>  .../bsps/aarch64/raspberrypi/linkercmds.yml   |  76 +++
>>  11 files changed, 1135 insertions(+)
>>  create mode 100644 bsps/aarch64/raspberrypi/console/console.c
>>  create mode 100644 bsps/aarch64/raspberrypi/include/bsp.h
>>  create mode 100644 bsps/aarch64/raspberrypi/include/bsp/irq.h
>>  create mode 100644 bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
>>  create mode 100644 bsps/aarch64/raspberrypi/include/tm27.h
>>  create mode 100644 bsps/aarch64/raspberrypi/start/bspstart.c
>>  create mode 100644 bsps/aarch64/raspberrypi/start/bspstarthooks.c
>>  create mode 100644 bsps/aarch64/raspberrypi/start/bspstartmmu.c
>>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/abi.yml
>>  create mode 100644
>> spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml
>>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/linkercmds.yml
>>
>> diff --git a/bsps/aarch64/raspberrypi/console/console.c
>> b/bsps/aarch64/raspberrypi/console/console.c
>> new file mode 100644
>> 

Re: [PATCH v3] bsp/aarch64: Add new Raspberry Pi 4B BSP

2022-10-04 Thread Joel Sherrill
On Tue, Oct 4, 2022 at 4:38 PM Alan Cudmore  wrote:

> It builds without error and boots for me!
> I ran my RTEMS Kernel Image and tried out some task demos, whetstone,
> dhrystone, created a RAM disk, etc.
> Next will be a core Flight System (cFS) run.
> This is going to be a very useful board to have RTEMS + SMP + Libbsd on,
> especially when people can buy them again.
> Thanks!
> Alan
>
>
> RTEMS Kernel Image Booting
> *** RTEMS Info ***
> 6.0.0.cc43dc3e22b21ddf902b7748fb27f16c9aee3719
>  BSP Ticks Per Second = 100
> *** End RTEMS info ***
>
> Populating Root file system from TAR file.
> Setting up filesystems.
> Initializing Local Commands.
> Adding Target specific commands
> Running /shell-init.
>
> 1: mkdir ram
> 2: mkrfs /dev/rda
> 3: mount -t rfs /dev/rda /ram
> mounted /dev/rda -> /ram
> 4: hello
>   __  
>/ __ \/_  __/ /  \/  / ___/
>   / /_/ / / / / __/ / /\_/ /\__ \
>  / _, _/ / / / /___/ /  / /___/ /
> /_/ \_| /_/ /_/_/  /_///
>
> Hello RTEMS!
> Create your own command here!
> Starting shell
>
> RTEMS Shell on /dev/console. Use 'help' to list commands.
> shell0 [/] #
>

Wow! I'm always impressed by how many RTEMS capabilities are
available in a basic BSP.

All it needs now is a network driver.  :)

I'll merge this .

--joel

>
>
> On Tue, Oct 4, 2022 at 2:40 PM Joel Sherrill  wrote:
>
>> Once Alan says it's OK, I will merge this.
>>
>> Great work! Please make sure code, docs, tester configuration, etc gets
>> merged.
>>
>> On Tue, Oct 4, 2022 at 1:18 PM Kinsey Moore 
>> wrote:
>>
>>> I think all of the issues with this patch have been addressed; this
>>> looks good to me.
>>>
>>> Great work, Noor!
>>>
>>> Kinsey
>>>
>>> On Tue, Oct 4, 2022 at 11:12 AM Noor Aman 
>>> wrote:
>>>
 hey all,
 I've fixed the warning and edited the commit message to be more
 specific and to be in 80 words char limit.

 Thanks,
 Noor

 On Tue, 4 Oct 2022 at 16:08, Mohd Noor Aman 
 wrote:

> This patch adds new Raspberry pi 4B AArch64 BSP to the RTEMS Family.
> Currently
> only LP64 ABI is supported. ILP32 is not supported. RAM starts from
> 0x8 in
> 64Bit kernel mode and MMU from 0x0. All Raspberrypi Pi 4B models and
> Raspberry
> Pi 400 are supported. All the IRQs are similiar to the older Raspberry
> pi 2 ARM
> BSP.
>
> Raspberry Pi 4B has 2 types of UARTs. Only PL011 serial is supported
> currently.
> Mini-UART is not supported. Mini-UART is default UART on the board so
> it needs
> to be disabled by adding "dtoverlay=disable-bt" to the config.txt. No
> support
> for additional 4 PL011-UARTs on the board.
>
> The raspberrypi.h includes many of the address required for the future
> development of the RPi 4B BSP. This includes peripherals, ARM Timer,
> VideoCore
> Timer, Watchdog, Mailbox, AUX, FIQs and IRQs.
> ---
>  bsps/aarch64/raspberrypi/console/console.c|  69 +++
>  bsps/aarch64/raspberrypi/include/bsp.h|  76 +++
>  bsps/aarch64/raspberrypi/include/bsp/irq.h| 109 
>  .../raspberrypi/include/bsp/raspberrypi.h | 471 ++
>  bsps/aarch64/raspberrypi/include/tm27.h   |  46 ++
>  bsps/aarch64/raspberrypi/start/bspstart.c |  49 ++
>  .../aarch64/raspberrypi/start/bspstarthooks.c |  53 ++
>  bsps/aarch64/raspberrypi/start/bspstartmmu.c  |  84 
>  spec/build/bsps/aarch64/raspberrypi/abi.yml   |  21 +
>  .../aarch64/raspberrypi/bspraspberrypi4.yml   |  81 +++
>  .../bsps/aarch64/raspberrypi/linkercmds.yml   |  76 +++
>  11 files changed, 1135 insertions(+)
>  create mode 100644 bsps/aarch64/raspberrypi/console/console.c
>  create mode 100644 bsps/aarch64/raspberrypi/include/bsp.h
>  create mode 100644 bsps/aarch64/raspberrypi/include/bsp/irq.h
>  create mode 100644 bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
>  create mode 100644 bsps/aarch64/raspberrypi/include/tm27.h
>  create mode 100644 bsps/aarch64/raspberrypi/start/bspstart.c
>  create mode 100644 bsps/aarch64/raspberrypi/start/bspstarthooks.c
>  create mode 100644 bsps/aarch64/raspberrypi/start/bspstartmmu.c
>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/abi.yml
>  create mode 100644
> spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml
>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/linkercmds.yml
>
> diff --git a/bsps/aarch64/raspberrypi/console/console.c
> b/bsps/aarch64/raspberrypi/console/console.c
> new file mode 100644
> index 00..73bb0036ff
> --- /dev/null
> +++ b/bsps/aarch64/raspberrypi/console/console.c
> @@ -0,0 +1,69 @@
> +/* SPDX-License-Identifier: BSD-2-Clause */
> +
> +/**
> + * @file
> + *
> + * @ingroup RTEMSBSPsAArch64Raspberrypi4
> + *
> + * @brief Console Configuration
> + */
> +
> +/*
> + * 

Re: [PATCH v3] bsp/aarch64: Add new Raspberry Pi 4B BSP

2022-10-04 Thread Alan Cudmore
It builds without error and boots for me!
I ran my RTEMS Kernel Image and tried out some task demos, whetstone,
dhrystone, created a RAM disk, etc.
Next will be a core Flight System (cFS) run.
This is going to be a very useful board to have RTEMS + SMP + Libbsd on,
especially when people can buy them again.
Thanks!
Alan


RTEMS Kernel Image Booting
*** RTEMS Info ***
6.0.0.cc43dc3e22b21ddf902b7748fb27f16c9aee3719
 BSP Ticks Per Second = 100
*** End RTEMS info ***

Populating Root file system from TAR file.
Setting up filesystems.
Initializing Local Commands.
Adding Target specific commands
Running /shell-init.

1: mkdir ram
2: mkrfs /dev/rda
3: mount -t rfs /dev/rda /ram
mounted /dev/rda -> /ram
4: hello
  __  
   / __ \/_  __/ /  \/  / ___/
  / /_/ / / / / __/ / /\_/ /\__ \
 / _, _/ / / / /___/ /  / /___/ /
/_/ \_| /_/ /_/_/  /_///

Hello RTEMS!
Create your own command here!
Starting shell

RTEMS Shell on /dev/console. Use 'help' to list commands.
shell0 [/] #


On Tue, Oct 4, 2022 at 2:40 PM Joel Sherrill  wrote:

> Once Alan says it's OK, I will merge this.
>
> Great work! Please make sure code, docs, tester configuration, etc gets
> merged.
>
> On Tue, Oct 4, 2022 at 1:18 PM Kinsey Moore 
> wrote:
>
>> I think all of the issues with this patch have been addressed; this looks
>> good to me.
>>
>> Great work, Noor!
>>
>> Kinsey
>>
>> On Tue, Oct 4, 2022 at 11:12 AM Noor Aman  wrote:
>>
>>> hey all,
>>> I've fixed the warning and edited the commit message to be more specific
>>> and to be in 80 words char limit.
>>>
>>> Thanks,
>>> Noor
>>>
>>> On Tue, 4 Oct 2022 at 16:08, Mohd Noor Aman 
>>> wrote:
>>>
 This patch adds new Raspberry pi 4B AArch64 BSP to the RTEMS Family.
 Currently
 only LP64 ABI is supported. ILP32 is not supported. RAM starts from
 0x8 in
 64Bit kernel mode and MMU from 0x0. All Raspberrypi Pi 4B models and
 Raspberry
 Pi 400 are supported. All the IRQs are similiar to the older Raspberry
 pi 2 ARM
 BSP.

 Raspberry Pi 4B has 2 types of UARTs. Only PL011 serial is supported
 currently.
 Mini-UART is not supported. Mini-UART is default UART on the board so
 it needs
 to be disabled by adding "dtoverlay=disable-bt" to the config.txt. No
 support
 for additional 4 PL011-UARTs on the board.

 The raspberrypi.h includes many of the address required for the future
 development of the RPi 4B BSP. This includes peripherals, ARM Timer,
 VideoCore
 Timer, Watchdog, Mailbox, AUX, FIQs and IRQs.
 ---
  bsps/aarch64/raspberrypi/console/console.c|  69 +++
  bsps/aarch64/raspberrypi/include/bsp.h|  76 +++
  bsps/aarch64/raspberrypi/include/bsp/irq.h| 109 
  .../raspberrypi/include/bsp/raspberrypi.h | 471 ++
  bsps/aarch64/raspberrypi/include/tm27.h   |  46 ++
  bsps/aarch64/raspberrypi/start/bspstart.c |  49 ++
  .../aarch64/raspberrypi/start/bspstarthooks.c |  53 ++
  bsps/aarch64/raspberrypi/start/bspstartmmu.c  |  84 
  spec/build/bsps/aarch64/raspberrypi/abi.yml   |  21 +
  .../aarch64/raspberrypi/bspraspberrypi4.yml   |  81 +++
  .../bsps/aarch64/raspberrypi/linkercmds.yml   |  76 +++
  11 files changed, 1135 insertions(+)
  create mode 100644 bsps/aarch64/raspberrypi/console/console.c
  create mode 100644 bsps/aarch64/raspberrypi/include/bsp.h
  create mode 100644 bsps/aarch64/raspberrypi/include/bsp/irq.h
  create mode 100644 bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
  create mode 100644 bsps/aarch64/raspberrypi/include/tm27.h
  create mode 100644 bsps/aarch64/raspberrypi/start/bspstart.c
  create mode 100644 bsps/aarch64/raspberrypi/start/bspstarthooks.c
  create mode 100644 bsps/aarch64/raspberrypi/start/bspstartmmu.c
  create mode 100644 spec/build/bsps/aarch64/raspberrypi/abi.yml
  create mode 100644
 spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml
  create mode 100644 spec/build/bsps/aarch64/raspberrypi/linkercmds.yml

 diff --git a/bsps/aarch64/raspberrypi/console/console.c
 b/bsps/aarch64/raspberrypi/console/console.c
 new file mode 100644
 index 00..73bb0036ff
 --- /dev/null
 +++ b/bsps/aarch64/raspberrypi/console/console.c
 @@ -0,0 +1,69 @@
 +/* SPDX-License-Identifier: BSD-2-Clause */
 +
 +/**
 + * @file
 + *
 + * @ingroup RTEMSBSPsAArch64Raspberrypi4
 + *
 + * @brief Console Configuration
 + */
 +
 +/*
 + * Copyright (C) 2022 Mohd Noor Aman
 + *
 + *
 + * 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. 

Re: [PATCH v3] bsp/aarch64: Add new Raspberry Pi 4B BSP

2022-10-04 Thread Chris Johns
On 5/10/2022 5:39 am, Joel Sherrill wrote:
> Once Alan says it's OK, I will merge this.
> 
> Great work! Please make sure code, docs, tester configuration, etc gets 
> merged.

Looks great, well done for all the hard work.

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


Re: [PATCH] gsed.cfg: Add check for gsed

2022-10-04 Thread Chris Johns
On 5/10/2022 12:52 am, Ryan Long wrote:
> It looks like gcc checks for gsed if sed is not the GNU version.

Thanks for checking this.

> I've installed it on FreeBSD and MacOS. I had to install it via Homebrew on
> MacOS, but that's because it fails to build gsed.

Homebrew complicates your work. I make sure my test Macs have never had Homebrew
or Macports installed. When I played with this a long time ago the install
prefix was /usr/local and after a while I found I had no idea what was installed
and what was provided by the OS and if the base OS versions were overwritten. I
believe Macports is not doing this these days (if it ever did) but I have not
looked.

> The error is "machine `arm64-apple' not recognized".

Does the GNU sed upstream project have a fix?

> So I added this check to get around that, and it built successfully.

Sorry, I see Homebrew and Macports as user options and not a project option. We
need repeatable builds and not builds based on a local checkout of some 
packages.

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


Re: [PATCH 06/13] config: Add rtems_malloc_task_stack_for_idle()

2022-10-04 Thread Chris Johns
On 5/10/2022 12:41 am, Sebastian Huber wrote:
> On 04/10/2022 15:21, Joel Sherrill wrote:
>> On Tue, Oct 4, 2022 at 12:40 AM Sebastian Huber
>> > > wrote:
>>
>>     On 30/09/2022 23:39, Chris Johns wrote:
>>  > On 30/9/2022 7:21 pm, Sebastian Huber wrote:
>>  >> Update #4524.
>>  >> ---
>>  >>   cpukit/doxygen/appl-config.h                | 13 +
>>  >>   cpukit/include/rtems/rtems/config.h         | 29 +-
>>  >>   cpukit/include/rtems/score/interr.h         |  1 +
>>  >>   cpukit/sapi/src/interrtext.c                |  3 +-
>>  >>   cpukit/sapi/src/malloctaskstackforidle.c    | 59
>>     +
>>  >>   spec/build/cpukit/librtemscpu.yml           |  1 +
>>  >>   spec/build/testsuites/sptests/grp.yml       |  2 +
>>  >>   spec/build/testsuites/sptests/spfatal36.yml | 19 +++
>>  >>   testsuites/sptests/spfatal36/init.c         | 52
>>     ++
>>  >>   testsuites/sptests/spfatal36/spfatal36.doc  | 11 
>>  >>   testsuites/sptests/spinternalerror02/init.c |  2 +-
>>  >>   testsuites/sptests/sptls04/init.c           |  2 +
>>  >>   12 files changed, 191 insertions(+), 3 deletions(-)
>>  >>   create mode 100644 cpukit/sapi/src/malloctaskstackforidle.c
>>  >>   create mode 100644 spec/build/testsuites/sptests/spfatal36.yml
>>  >>   create mode 100644 testsuites/sptests/spfatal36/init.c
>>  >>   create mode 100644 testsuites/sptests/spfatal36/spfatal36.doc
>>  >>
>>  >> diff --git a/cpukit/doxygen/appl-config.h
>>     b/cpukit/doxygen/appl-config.h
>>  >> index aa6dbae648..ee647dc961 100644
>>  >> --- a/cpukit/doxygen/appl-config.h
>>  >> +++ b/cpukit/doxygen/appl-config.h
>>  >> @@ -4842,6 +4842,19 @@
>>  >>    * configuration options.  It is assumed that any memory
>>     allocated for the
>>  >>    * stack of an IDLE task will not be from the RTEMS Workspace
>>     or the memory
>>  >>    * statically allocated by default.
>>  >> + *
>>  >> + * For applications with a thread-local storage size which is
>>     completely
>>  >> + * unknown at the time the application configuration is
>>     defined, RTEMS provides
>>  >> + * an IDLE task stack allocator which uses rtems_malloc().
>>  >
>>  > I thought the TLS size was static and set by the linker? Has this
>>     changed?
>>
>>     No, this didn't change.
>>
>>  >
>>  > I am confused about the relationship between an unknown TLS size
>>     and IDLE task?
>>  > And the relationship of the TLS size and stack size?
>>
>>     Currently, the IDLE task storage area is statically allocated. The size
>>     of this area is defined by CONFIGURE_IDLE_TASK_STACK_SIZE. So, this
>>     configuration option doesn't directly specify the IDLE task stack size.
>>     This size covers also the TLS area.
>>
>>
>> Thanks for speaking up Chris. I also don't like the idea that something that
>> has said and meant IDLE stack size was getting other items lumped into it.
>>
>>
>>  >
>>  >> * * The size of the
>>  >> + * allocated thread storage area is the sum of stack size
>>     defined by the
>>  >> + * #CONFIGURE_IDLE_TASK_STACK_SIZE configuration option and the
>>     actual
>>  >> + * thread-local storage size of the application.
>>  >
>>  > The label CONFIGURE_IDLE_TASK_STACK_SIZE provides no insight into
>>     it being
>>  > effected by the TLS size.
>>  >
>>  >> * * Define this configuration
>>  >> + * option to ``rtems_malloc_task_stack_for_idle`` to use this
>>     allocator.  If
>>  >> + * the memory allocation fails, then the system terminates with the
>>  >> + * INTERNAL_ERROR_CORE fatal source and the
>>  >> + * INTERNAL_ERROR_NO_MEMORY_FOR_IDLE_TASK_STACK fatal code
>>     during system
>>  >> + * initialization.
>>  >> + * @endparblock
>>  >
>>  > I am confused about the how and why I would use this change?
>>
>>     With the statically allocated storage area for the IDLE task you
>>     need at
>>     least an estimate of the size if you define the application
>>     configuration. If you can't estimate it, then one option is to simply
>>     allocate it dynamically.
>>
>>     Maybe a better approach is to allocate the IDLE task storage from the
>>     workspace by default and use the CONFIGURE_IDLE_TASK_STACK_SIZE really
>>     for the stack size and not the complete storage area. We could add a
>>     new
>>     configuration option (for example CONFIGURE_IDLE_TASK_STORAGE_SIZE) to
>>     enable the static allocation.
>>
>>
>>
>> CONFIGURE_IDLE_TASK_STORAGE_SIZE could default to the size of stack size
>> plus other items but it seems over complicated. Just have IDLE stack size and
>> the other
>> area for other items.
>>
>> I don't know when IDLE task storage size was introduced but it has been a 
>> long
>> time ago. Changing the semantics of it seems 

Re: [PATCH v3] bsp/aarch64: Add new Raspberry Pi 4B BSP

2022-10-04 Thread Joel Sherrill
Once Alan says it's OK, I will merge this.

Great work! Please make sure code, docs, tester configuration, etc gets
merged.

On Tue, Oct 4, 2022 at 1:18 PM Kinsey Moore 
wrote:

> I think all of the issues with this patch have been addressed; this looks
> good to me.
>
> Great work, Noor!
>
> Kinsey
>
> On Tue, Oct 4, 2022 at 11:12 AM Noor Aman  wrote:
>
>> hey all,
>> I've fixed the warning and edited the commit message to be more specific
>> and to be in 80 words char limit.
>>
>> Thanks,
>> Noor
>>
>> On Tue, 4 Oct 2022 at 16:08, Mohd Noor Aman 
>> wrote:
>>
>>> This patch adds new Raspberry pi 4B AArch64 BSP to the RTEMS Family.
>>> Currently
>>> only LP64 ABI is supported. ILP32 is not supported. RAM starts from
>>> 0x8 in
>>> 64Bit kernel mode and MMU from 0x0. All Raspberrypi Pi 4B models and
>>> Raspberry
>>> Pi 400 are supported. All the IRQs are similiar to the older Raspberry
>>> pi 2 ARM
>>> BSP.
>>>
>>> Raspberry Pi 4B has 2 types of UARTs. Only PL011 serial is supported
>>> currently.
>>> Mini-UART is not supported. Mini-UART is default UART on the board so it
>>> needs
>>> to be disabled by adding "dtoverlay=disable-bt" to the config.txt. No
>>> support
>>> for additional 4 PL011-UARTs on the board.
>>>
>>> The raspberrypi.h includes many of the address required for the future
>>> development of the RPi 4B BSP. This includes peripherals, ARM Timer,
>>> VideoCore
>>> Timer, Watchdog, Mailbox, AUX, FIQs and IRQs.
>>> ---
>>>  bsps/aarch64/raspberrypi/console/console.c|  69 +++
>>>  bsps/aarch64/raspberrypi/include/bsp.h|  76 +++
>>>  bsps/aarch64/raspberrypi/include/bsp/irq.h| 109 
>>>  .../raspberrypi/include/bsp/raspberrypi.h | 471 ++
>>>  bsps/aarch64/raspberrypi/include/tm27.h   |  46 ++
>>>  bsps/aarch64/raspberrypi/start/bspstart.c |  49 ++
>>>  .../aarch64/raspberrypi/start/bspstarthooks.c |  53 ++
>>>  bsps/aarch64/raspberrypi/start/bspstartmmu.c  |  84 
>>>  spec/build/bsps/aarch64/raspberrypi/abi.yml   |  21 +
>>>  .../aarch64/raspberrypi/bspraspberrypi4.yml   |  81 +++
>>>  .../bsps/aarch64/raspberrypi/linkercmds.yml   |  76 +++
>>>  11 files changed, 1135 insertions(+)
>>>  create mode 100644 bsps/aarch64/raspberrypi/console/console.c
>>>  create mode 100644 bsps/aarch64/raspberrypi/include/bsp.h
>>>  create mode 100644 bsps/aarch64/raspberrypi/include/bsp/irq.h
>>>  create mode 100644 bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
>>>  create mode 100644 bsps/aarch64/raspberrypi/include/tm27.h
>>>  create mode 100644 bsps/aarch64/raspberrypi/start/bspstart.c
>>>  create mode 100644 bsps/aarch64/raspberrypi/start/bspstarthooks.c
>>>  create mode 100644 bsps/aarch64/raspberrypi/start/bspstartmmu.c
>>>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/abi.yml
>>>  create mode 100644
>>> spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml
>>>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/linkercmds.yml
>>>
>>> diff --git a/bsps/aarch64/raspberrypi/console/console.c
>>> b/bsps/aarch64/raspberrypi/console/console.c
>>> new file mode 100644
>>> index 00..73bb0036ff
>>> --- /dev/null
>>> +++ b/bsps/aarch64/raspberrypi/console/console.c
>>> @@ -0,0 +1,69 @@
>>> +/* SPDX-License-Identifier: BSD-2-Clause */
>>> +
>>> +/**
>>> + * @file
>>> + *
>>> + * @ingroup RTEMSBSPsAArch64Raspberrypi4
>>> + *
>>> + * @brief Console Configuration
>>> + */
>>> +
>>> +/*
>>> + * Copyright (C) 2022 Mohd Noor Aman
>>> + *
>>> + *
>>> + * 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 
>>> +
>>> +#include 
>>> +#include 
>>> +#include 

Re: [PATCH v3] bsp/aarch64: Add new Raspberry Pi 4B BSP

2022-10-04 Thread Kinsey Moore
I think all of the issues with this patch have been addressed; this looks
good to me.

Great work, Noor!

Kinsey

On Tue, Oct 4, 2022 at 11:12 AM Noor Aman  wrote:

> hey all,
> I've fixed the warning and edited the commit message to be more specific
> and to be in 80 words char limit.
>
> Thanks,
> Noor
>
> On Tue, 4 Oct 2022 at 16:08, Mohd Noor Aman 
> wrote:
>
>> This patch adds new Raspberry pi 4B AArch64 BSP to the RTEMS Family.
>> Currently
>> only LP64 ABI is supported. ILP32 is not supported. RAM starts from
>> 0x8 in
>> 64Bit kernel mode and MMU from 0x0. All Raspberrypi Pi 4B models and
>> Raspberry
>> Pi 400 are supported. All the IRQs are similiar to the older Raspberry pi
>> 2 ARM
>> BSP.
>>
>> Raspberry Pi 4B has 2 types of UARTs. Only PL011 serial is supported
>> currently.
>> Mini-UART is not supported. Mini-UART is default UART on the board so it
>> needs
>> to be disabled by adding "dtoverlay=disable-bt" to the config.txt. No
>> support
>> for additional 4 PL011-UARTs on the board.
>>
>> The raspberrypi.h includes many of the address required for the future
>> development of the RPi 4B BSP. This includes peripherals, ARM Timer,
>> VideoCore
>> Timer, Watchdog, Mailbox, AUX, FIQs and IRQs.
>> ---
>>  bsps/aarch64/raspberrypi/console/console.c|  69 +++
>>  bsps/aarch64/raspberrypi/include/bsp.h|  76 +++
>>  bsps/aarch64/raspberrypi/include/bsp/irq.h| 109 
>>  .../raspberrypi/include/bsp/raspberrypi.h | 471 ++
>>  bsps/aarch64/raspberrypi/include/tm27.h   |  46 ++
>>  bsps/aarch64/raspberrypi/start/bspstart.c |  49 ++
>>  .../aarch64/raspberrypi/start/bspstarthooks.c |  53 ++
>>  bsps/aarch64/raspberrypi/start/bspstartmmu.c  |  84 
>>  spec/build/bsps/aarch64/raspberrypi/abi.yml   |  21 +
>>  .../aarch64/raspberrypi/bspraspberrypi4.yml   |  81 +++
>>  .../bsps/aarch64/raspberrypi/linkercmds.yml   |  76 +++
>>  11 files changed, 1135 insertions(+)
>>  create mode 100644 bsps/aarch64/raspberrypi/console/console.c
>>  create mode 100644 bsps/aarch64/raspberrypi/include/bsp.h
>>  create mode 100644 bsps/aarch64/raspberrypi/include/bsp/irq.h
>>  create mode 100644 bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
>>  create mode 100644 bsps/aarch64/raspberrypi/include/tm27.h
>>  create mode 100644 bsps/aarch64/raspberrypi/start/bspstart.c
>>  create mode 100644 bsps/aarch64/raspberrypi/start/bspstarthooks.c
>>  create mode 100644 bsps/aarch64/raspberrypi/start/bspstartmmu.c
>>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/abi.yml
>>  create mode 100644
>> spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml
>>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/linkercmds.yml
>>
>> diff --git a/bsps/aarch64/raspberrypi/console/console.c
>> b/bsps/aarch64/raspberrypi/console/console.c
>> new file mode 100644
>> index 00..73bb0036ff
>> --- /dev/null
>> +++ b/bsps/aarch64/raspberrypi/console/console.c
>> @@ -0,0 +1,69 @@
>> +/* SPDX-License-Identifier: BSD-2-Clause */
>> +
>> +/**
>> + * @file
>> + *
>> + * @ingroup RTEMSBSPsAArch64Raspberrypi4
>> + *
>> + * @brief Console Configuration
>> + */
>> +
>> +/*
>> + * Copyright (C) 2022 Mohd Noor Aman
>> + *
>> + *
>> + * 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 
>> +
>> +#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
>> +};
>> +
>> +const console_device console_device_table[] = {
>> +  {
>> +

Review request for DCAN support

2022-10-04 Thread Prashanth S
Hi All,

This is a review request for DCAN and CAN support (merge patch).

Attaching compressed file for DCAN patch, as file size exceeds 256KB.

Regards
Prashanth S


DCAN.tar.lzma
Description: application/lzma
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH v3] bsp/aarch64: Add new Raspberry Pi 4B BSP

2022-10-04 Thread Noor Aman
hey all,
I've fixed the warning and edited the commit message to be more specific
and to be in 80 words char limit.

Thanks,
Noor

On Tue, 4 Oct 2022 at 16:08, Mohd Noor Aman  wrote:

> This patch adds new Raspberry pi 4B AArch64 BSP to the RTEMS Family.
> Currently
> only LP64 ABI is supported. ILP32 is not supported. RAM starts from
> 0x8 in
> 64Bit kernel mode and MMU from 0x0. All Raspberrypi Pi 4B models and
> Raspberry
> Pi 400 are supported. All the IRQs are similiar to the older Raspberry pi
> 2 ARM
> BSP.
>
> Raspberry Pi 4B has 2 types of UARTs. Only PL011 serial is supported
> currently.
> Mini-UART is not supported. Mini-UART is default UART on the board so it
> needs
> to be disabled by adding "dtoverlay=disable-bt" to the config.txt. No
> support
> for additional 4 PL011-UARTs on the board.
>
> The raspberrypi.h includes many of the address required for the future
> development of the RPi 4B BSP. This includes peripherals, ARM Timer,
> VideoCore
> Timer, Watchdog, Mailbox, AUX, FIQs and IRQs.
> ---
>  bsps/aarch64/raspberrypi/console/console.c|  69 +++
>  bsps/aarch64/raspberrypi/include/bsp.h|  76 +++
>  bsps/aarch64/raspberrypi/include/bsp/irq.h| 109 
>  .../raspberrypi/include/bsp/raspberrypi.h | 471 ++
>  bsps/aarch64/raspberrypi/include/tm27.h   |  46 ++
>  bsps/aarch64/raspberrypi/start/bspstart.c |  49 ++
>  .../aarch64/raspberrypi/start/bspstarthooks.c |  53 ++
>  bsps/aarch64/raspberrypi/start/bspstartmmu.c  |  84 
>  spec/build/bsps/aarch64/raspberrypi/abi.yml   |  21 +
>  .../aarch64/raspberrypi/bspraspberrypi4.yml   |  81 +++
>  .../bsps/aarch64/raspberrypi/linkercmds.yml   |  76 +++
>  11 files changed, 1135 insertions(+)
>  create mode 100644 bsps/aarch64/raspberrypi/console/console.c
>  create mode 100644 bsps/aarch64/raspberrypi/include/bsp.h
>  create mode 100644 bsps/aarch64/raspberrypi/include/bsp/irq.h
>  create mode 100644 bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
>  create mode 100644 bsps/aarch64/raspberrypi/include/tm27.h
>  create mode 100644 bsps/aarch64/raspberrypi/start/bspstart.c
>  create mode 100644 bsps/aarch64/raspberrypi/start/bspstarthooks.c
>  create mode 100644 bsps/aarch64/raspberrypi/start/bspstartmmu.c
>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/abi.yml
>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml
>  create mode 100644 spec/build/bsps/aarch64/raspberrypi/linkercmds.yml
>
> diff --git a/bsps/aarch64/raspberrypi/console/console.c
> b/bsps/aarch64/raspberrypi/console/console.c
> new file mode 100644
> index 00..73bb0036ff
> --- /dev/null
> +++ b/bsps/aarch64/raspberrypi/console/console.c
> @@ -0,0 +1,69 @@
> +/* SPDX-License-Identifier: BSD-2-Clause */
> +
> +/**
> + * @file
> + *
> + * @ingroup RTEMSBSPsAArch64Raspberrypi4
> + *
> + * @brief Console Configuration
> + */
> +
> +/*
> + * Copyright (C) 2022 Mohd Noor Aman
> + *
> + *
> + * 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 
> +
> +#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
> +};
> +
> +const console_device console_device_table[] = {
> +  {
> +.device_file = "/dev/ttyS0",
> +.probe = console_device_probe_default,
> +.handler = _pl011_fns,
> +.context = _4_context.base
> +  }
> +};
> +
> +const size_t console_device_count =
> RTEMS_ARRAY_SIZE(console_device_table);
> +
> +static void output_char( char c )
> +{
> +  

[PATCH v5 1/2] cpukit/dev/can: Added CAN support

2022-10-04 Thread Prashanth S
---
 cpukit/dev/can/can-queue.h   | 230 +++
 cpukit/dev/can/can.c | 505 +++
 cpukit/include/dev/can/can-msg.h | 105 +
 cpukit/include/dev/can/can.h | 284 +
 spec/build/cpukit/librtemscpu.yml|   5 +
 spec/build/testsuites/libtests/can01.yml |  20 +
 spec/build/testsuites/libtests/grp.yml   |   2 +
 testsuites/libtests/can01/can-loopback.c | 110 +
 testsuites/libtests/can01/init.c | 251 +++
 9 files changed, 1512 insertions(+)
 create mode 100644 cpukit/dev/can/can-queue.h
 create mode 100644 cpukit/dev/can/can.c
 create mode 100644 cpukit/include/dev/can/can-msg.h
 create mode 100644 cpukit/include/dev/can/can.h
 create mode 100644 spec/build/testsuites/libtests/can01.yml
 create mode 100644 testsuites/libtests/can01/can-loopback.c
 create mode 100644 testsuites/libtests/can01/init.c

diff --git a/cpukit/dev/can/can-queue.h b/cpukit/dev/can/can-queue.h
new file mode 100644
index 00..9a3610c908
--- /dev/null
+++ b/cpukit/dev/can/can-queue.h
@@ -0,0 +1,230 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup CANBus
+ *
+ * @brief Controller Area Network (CAN) Bus Implementation
+ *
+ */
+
+/*
+ * Copyright (C) 2022 Prashanth S 
+ *
+ * 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 _DEV_CAN_CAN_QUEUE_H
+#define _DEV_CAN_CAN_QUEUE_H
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+/**
+ * @defgroup Controller Area Network (CAN) Driver
+ *
+ * @ingroup RTEMSDeviceDrivers
+ *
+ * @brief Controller Area Network (CAN) bus and device driver support.
+ *
+ * @{
+ */
+
+/**
+ * @defgroup CANBus CAN Bus Driver
+ *
+ * @ingroup CAN
+ *
+ * @{
+ */
+
+/**
+ * @brief Create CAN tx buffers.
+ *
+ * @param[in] bus Bus control structure.
+ *
+ * @retval 0 Successful operation.
+ * @retval >0 error number in case of an error.
+ */
+static rtems_status_code can_create_tx_buffers(struct can_bus *bus);
+
+/**
+ * @brief Free CAN tx buffers.
+ *
+ * @param[in] bus Bus control structure.
+ *
+ */
+static void can_free_tx_buffers(struct can_bus *bus);
+
+/**
+ * @brief Check for atleast one empty CAN tx buffer.
+ *
+ * @param[in] bus Bus control structure.
+ *
+ * @retval true If atleast one CAN buffer is empty.
+ * @retval false If no CAN buffer is empty.
+ */
+static bool can_tx_buf_isempty(struct can_bus *bus);
+
+/**
+ * @brief Get a produced tx buffer to transmit from the tx fifo.
+ *
+ * @param[in] bus Bus control structure.
+ *
+ * @retval can_msg Pointer to can_msg structure buffer.
+ * @retval NULL If no can_msg buffer.
+ */
+static struct can_msg *can_tx_get_data_buf(struct can_bus *bus);
+
+/**
+ * @brief Get a empty tx buffer.
+ *
+ * @param[in] bus Bus control structure.
+ *
+ * @retval can_msg Pointer to can_msg structure buffer.
+ * @retval NULL If no empty can_msg buffer.
+ */
+static struct can_msg *can_tx_get_empty_buf(struct can_bus *bus);
+
+/**
+ * @brief Creates tx buffers for the CAN bus driver.
+ *
+ * @param[in] bus Bus control structure.
+ *
+ * @retval rtems_status_code
+ */
+static rtems_status_code can_create_tx_buffers(struct can_bus *bus)
+{
+  bus->tx_fifo.pbuf = (struct can_msg *)malloc(CAN_TX_BUF_COUNT *
+  sizeof(struct can_msg));
+  if (bus->tx_fifo.pbuf == NULL) {
+CAN_ERR("can_create_tx_buffers: malloc failed\n");
+return RTEMS_NO_MEMORY;
+  }
+
+  bus->tx_fifo.empty_count = CAN_TX_BUF_COUNT;
+
+  return RTEMS_SUCCESSFUL;
+}
+
+/**
+ * @brief Free tx buffers for the CAN bus driver.
+ *
+ * @param[in] bus Bus control structure.
+ *
+ */
+static void can_free_tx_buffers(struct can_bus *bus)
+{
+  

[PATCH v3] bsp/aarch64: Add new Raspberry Pi 4B BSP

2022-10-04 Thread Mohd Noor Aman
This patch adds new Raspberry pi 4B AArch64 BSP to the RTEMS Family. Currently
only LP64 ABI is supported. ILP32 is not supported. RAM starts from 0x8 in
64Bit kernel mode and MMU from 0x0. All Raspberrypi Pi 4B models and Raspberry
Pi 400 are supported. All the IRQs are similiar to the older Raspberry pi 2 ARM
BSP.

Raspberry Pi 4B has 2 types of UARTs. Only PL011 serial is supported currently.
Mini-UART is not supported. Mini-UART is default UART on the board so it needs
to be disabled by adding "dtoverlay=disable-bt" to the config.txt. No support
for additional 4 PL011-UARTs on the board.

The raspberrypi.h includes many of the address required for the future
development of the RPi 4B BSP. This includes peripherals, ARM Timer, VideoCore
Timer, Watchdog, Mailbox, AUX, FIQs and IRQs.
---
 bsps/aarch64/raspberrypi/console/console.c|  69 +++
 bsps/aarch64/raspberrypi/include/bsp.h|  76 +++
 bsps/aarch64/raspberrypi/include/bsp/irq.h| 109 
 .../raspberrypi/include/bsp/raspberrypi.h | 471 ++
 bsps/aarch64/raspberrypi/include/tm27.h   |  46 ++
 bsps/aarch64/raspberrypi/start/bspstart.c |  49 ++
 .../aarch64/raspberrypi/start/bspstarthooks.c |  53 ++
 bsps/aarch64/raspberrypi/start/bspstartmmu.c  |  84 
 spec/build/bsps/aarch64/raspberrypi/abi.yml   |  21 +
 .../aarch64/raspberrypi/bspraspberrypi4.yml   |  81 +++
 .../bsps/aarch64/raspberrypi/linkercmds.yml   |  76 +++
 11 files changed, 1135 insertions(+)
 create mode 100644 bsps/aarch64/raspberrypi/console/console.c
 create mode 100644 bsps/aarch64/raspberrypi/include/bsp.h
 create mode 100644 bsps/aarch64/raspberrypi/include/bsp/irq.h
 create mode 100644 bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
 create mode 100644 bsps/aarch64/raspberrypi/include/tm27.h
 create mode 100644 bsps/aarch64/raspberrypi/start/bspstart.c
 create mode 100644 bsps/aarch64/raspberrypi/start/bspstarthooks.c
 create mode 100644 bsps/aarch64/raspberrypi/start/bspstartmmu.c
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/abi.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml
 create mode 100644 spec/build/bsps/aarch64/raspberrypi/linkercmds.yml

diff --git a/bsps/aarch64/raspberrypi/console/console.c 
b/bsps/aarch64/raspberrypi/console/console.c
new file mode 100644
index 00..73bb0036ff
--- /dev/null
+++ b/bsps/aarch64/raspberrypi/console/console.c
@@ -0,0 +1,69 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup RTEMSBSPsAArch64Raspberrypi4
+ *
+ * @brief Console Configuration
+ */
+
+/*
+ * Copyright (C) 2022 Mohd Noor Aman
+ *
+ *
+ * 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 
+
+#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
+};
+
+const console_device console_device_table[] = {
+  {
+.device_file = "/dev/ttyS0",
+.probe = console_device_probe_default,
+.handler = _pl011_fns,
+.context = _4_context.base
+  }
+};
+
+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);
+}
+
+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
new file mode 100644
index 00..4fa81edd40
--- /dev/null
+++ b/bsps/aarch64/raspberrypi/include/bsp.h
@@ -0,0 +1,76 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * 

Re: [PATCH] gsed.cfg: Add check for gsed

2022-10-04 Thread Ryan Long

It looks like gcc checks for gsed if sed is not the GNU version.

I've installed it on FreeBSD and MacOS. I had to install it via Homebrew 
on MacOS, but that's because it fails to build gsed. The error is 
"machine `arm64-apple' not recognized".


So I added this check to get around that, and it built successfully.

On 10/3/2022 8:13 PM, Chris Johns wrote:

On 4/10/2022 2:52 am, Ryan Long wrote:

---
  bare/config/textproc/gsed.cfg | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bare/config/textproc/gsed.cfg b/bare/config/textproc/gsed.cfg
index 8287c74..b4aaf4f 100644
--- a/bare/config/textproc/gsed.cfg
+++ b/bare/config/textproc/gsed.cfg
@@ -2,7 +2,7 @@
  # GNU sed has a version option, check for it.
  # If not found build it.
  #
-%define has_gnu_sed %(sed --version > /dev/null 2>&1; echo $?)
+%define has_gnu_sed %(sed --version > /dev/null 2>&1 || gsed --version > /dev/null 
2>&1; echo $?)
  %if %{has_gnu_sed} != 0
   %include %{_configdir}/textproc/gsed-4.8.cfg
  %endif

What does gcc require sed be as a command? Is it sed or gsed?

Which host has gsed installed?

Chris

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


Re: [PATCH 06/13] config: Add rtems_malloc_task_stack_for_idle()

2022-10-04 Thread Sebastian Huber

On 04/10/2022 15:21, Joel Sherrill wrote:
On Tue, Oct 4, 2022 at 12:40 AM Sebastian Huber 
> wrote:


On 30/09/2022 23:39, Chris Johns wrote:
 > On 30/9/2022 7:21 pm, Sebastian Huber wrote:
 >> Update #4524.
 >> ---
 >>   cpukit/doxygen/appl-config.h                | 13 +
 >>   cpukit/include/rtems/rtems/config.h         | 29 +-
 >>   cpukit/include/rtems/score/interr.h         |  1 +
 >>   cpukit/sapi/src/interrtext.c                |  3 +-
 >>   cpukit/sapi/src/malloctaskstackforidle.c    | 59
+
 >>   spec/build/cpukit/librtemscpu.yml           |  1 +
 >>   spec/build/testsuites/sptests/grp.yml       |  2 +
 >>   spec/build/testsuites/sptests/spfatal36.yml | 19 +++
 >>   testsuites/sptests/spfatal36/init.c         | 52
++
 >>   testsuites/sptests/spfatal36/spfatal36.doc  | 11 
 >>   testsuites/sptests/spinternalerror02/init.c |  2 +-
 >>   testsuites/sptests/sptls04/init.c           |  2 +
 >>   12 files changed, 191 insertions(+), 3 deletions(-)
 >>   create mode 100644 cpukit/sapi/src/malloctaskstackforidle.c
 >>   create mode 100644 spec/build/testsuites/sptests/spfatal36.yml
 >>   create mode 100644 testsuites/sptests/spfatal36/init.c
 >>   create mode 100644 testsuites/sptests/spfatal36/spfatal36.doc
 >>
 >> diff --git a/cpukit/doxygen/appl-config.h
b/cpukit/doxygen/appl-config.h
 >> index aa6dbae648..ee647dc961 100644
 >> --- a/cpukit/doxygen/appl-config.h
 >> +++ b/cpukit/doxygen/appl-config.h
 >> @@ -4842,6 +4842,19 @@
 >>    * configuration options.  It is assumed that any memory
allocated for the
 >>    * stack of an IDLE task will not be from the RTEMS Workspace
or the memory
 >>    * statically allocated by default.
 >> + *
 >> + * For applications with a thread-local storage size which is
completely
 >> + * unknown at the time the application configuration is
defined, RTEMS provides
 >> + * an IDLE task stack allocator which uses rtems_malloc().
 >
 > I thought the TLS size was static and set by the linker? Has this
changed?

No, this didn't change.

 >
 > I am confused about the relationship between an unknown TLS size
and IDLE task?
 > And the relationship of the TLS size and stack size?

Currently, the IDLE task storage area is statically allocated. The size
of this area is defined by CONFIGURE_IDLE_TASK_STACK_SIZE. So, this
configuration option doesn't directly specify the IDLE task stack size.
This size covers also the TLS area.


Thanks for speaking up Chris. I also don't like the idea that something that
has said and meant IDLE stack size was getting other items lumped into it.


 >
 >> * * The size of the
 >> + * allocated thread storage area is the sum of stack size
defined by the
 >> + * #CONFIGURE_IDLE_TASK_STACK_SIZE configuration option and the
actual
 >> + * thread-local storage size of the application.
 >
 > The label CONFIGURE_IDLE_TASK_STACK_SIZE provides no insight into
it being
 > effected by the TLS size.
 >
 >> * * Define this configuration
 >> + * option to ``rtems_malloc_task_stack_for_idle`` to use this
allocator.  If
 >> + * the memory allocation fails, then the system terminates with the
 >> + * INTERNAL_ERROR_CORE fatal source and the
 >> + * INTERNAL_ERROR_NO_MEMORY_FOR_IDLE_TASK_STACK fatal code
during system
 >> + * initialization.
 >> + * @endparblock
 >
 > I am confused about the how and why I would use this change?

With the statically allocated storage area for the IDLE task you
need at
least an estimate of the size if you define the application
configuration. If you can't estimate it, then one option is to simply
allocate it dynamically.

Maybe a better approach is to allocate the IDLE task storage from the
workspace by default and use the CONFIGURE_IDLE_TASK_STACK_SIZE really
for the stack size and not the complete storage area. We could add a
new
configuration option (for example CONFIGURE_IDLE_TASK_STORAGE_SIZE) to
enable the static allocation.



CONFIGURE_IDLE_TASK_STORAGE_SIZE could default to the size of stack size
plus other items but it seems over complicated. Just have IDLE stack 
size and the other

area for other items.

I don't know when IDLE task storage size was introduced but it has been 
a long

time ago. Changing the semantics of it seems quite wrong.


Ok, I will send a v2 of the patch which:

* Changes the default IDLE task storage allocation to the workspace.  It 
will use CONFIGURE_IDLE_TASK_STACK_SIZE and this size will define the 
stack size.


* Adds a new option CONFIGURE_IDLE_TASK_STORAGE_SIZE which will change 
the IDLE task storage allocation to a statically allocated area which 
will 

Re: [PATCH 06/13] config: Add rtems_malloc_task_stack_for_idle()

2022-10-04 Thread Joel Sherrill
On Tue, Oct 4, 2022 at 12:40 AM Sebastian Huber <
sebastian.hu...@embedded-brains.de> wrote:

> On 30/09/2022 23:39, Chris Johns wrote:
> > On 30/9/2022 7:21 pm, Sebastian Huber wrote:
> >> Update #4524.
> >> ---
> >>   cpukit/doxygen/appl-config.h| 13 +
> >>   cpukit/include/rtems/rtems/config.h | 29 +-
> >>   cpukit/include/rtems/score/interr.h |  1 +
> >>   cpukit/sapi/src/interrtext.c|  3 +-
> >>   cpukit/sapi/src/malloctaskstackforidle.c| 59 +
> >>   spec/build/cpukit/librtemscpu.yml   |  1 +
> >>   spec/build/testsuites/sptests/grp.yml   |  2 +
> >>   spec/build/testsuites/sptests/spfatal36.yml | 19 +++
> >>   testsuites/sptests/spfatal36/init.c | 52 ++
> >>   testsuites/sptests/spfatal36/spfatal36.doc  | 11 
> >>   testsuites/sptests/spinternalerror02/init.c |  2 +-
> >>   testsuites/sptests/sptls04/init.c   |  2 +
> >>   12 files changed, 191 insertions(+), 3 deletions(-)
> >>   create mode 100644 cpukit/sapi/src/malloctaskstackforidle.c
> >>   create mode 100644 spec/build/testsuites/sptests/spfatal36.yml
> >>   create mode 100644 testsuites/sptests/spfatal36/init.c
> >>   create mode 100644 testsuites/sptests/spfatal36/spfatal36.doc
> >>
> >> diff --git a/cpukit/doxygen/appl-config.h b/cpukit/doxygen/appl-config.h
> >> index aa6dbae648..ee647dc961 100644
> >> --- a/cpukit/doxygen/appl-config.h
> >> +++ b/cpukit/doxygen/appl-config.h
> >> @@ -4842,6 +4842,19 @@
> >>* configuration options.  It is assumed that any memory allocated
> for the
> >>* stack of an IDLE task will not be from the RTEMS Workspace or the
> memory
> >>* statically allocated by default.
> >> + *
> >> + * For applications with a thread-local storage size which is
> completely
> >> + * unknown at the time the application configuration is defined, RTEMS
> provides
> >> + * an IDLE task stack allocator which uses rtems_malloc().
> >
> > I thought the TLS size was static and set by the linker? Has this
> changed?
>
> No, this didn't change.
>
> >
> > I am confused about the relationship between an unknown TLS size and
> IDLE task?
> > And the relationship of the TLS size and stack size?
>
> Currently, the IDLE task storage area is statically allocated. The size
> of this area is defined by CONFIGURE_IDLE_TASK_STACK_SIZE. So, this
> configuration option doesn't directly specify the IDLE task stack size.
> This size covers also the TLS area.
>

Thanks for speaking up Chris. I also don't like the idea that something that
has said and meant IDLE stack size was getting other items lumped into it.


> >
> >> * * The size of the
> >> + * allocated thread storage area is the sum of stack size defined by
> the
> >> + * #CONFIGURE_IDLE_TASK_STACK_SIZE configuration option and the actual
> >> + * thread-local storage size of the application.
> >
> > The label CONFIGURE_IDLE_TASK_STACK_SIZE provides no insight into it
> being
> > effected by the TLS size.
> >
> >> * * Define this configuration
> >> + * option to ``rtems_malloc_task_stack_for_idle`` to use this
> allocator.  If
> >> + * the memory allocation fails, then the system terminates with the
> >> + * INTERNAL_ERROR_CORE fatal source and the
> >> + * INTERNAL_ERROR_NO_MEMORY_FOR_IDLE_TASK_STACK fatal code during
> system
> >> + * initialization.
> >> + * @endparblock
> >
> > I am confused about the how and why I would use this change?
>
> With the statically allocated storage area for the IDLE task you need at
> least an estimate of the size if you define the application
> configuration. If you can't estimate it, then one option is to simply
> allocate it dynamically.
>
> Maybe a better approach is to allocate the IDLE task storage from the
> workspace by default and use the CONFIGURE_IDLE_TASK_STACK_SIZE really
> for the stack size and not the complete storage area. We could add a new
> configuration option (for example CONFIGURE_IDLE_TASK_STORAGE_SIZE) to
> enable the static allocation.
>


CONFIGURE_IDLE_TASK_STORAGE_SIZE could default to the size of stack size
plus other items but it seems over complicated. Just have IDLE stack size
and the other
area for other items.

I don't know when IDLE task storage size was introduced but it has been a
long
time ago. Changing the semantics of it seems quite wrong.

--joel

>
> --
> embedded brains GmbH
> Herr Sebastian HUBER
> Dornierstr. 4
> 82178 Puchheim
> Germany
> email: sebastian.hu...@embedded-brains.de
> phone: +49-89-18 94 741 - 16
> fax:   +49-89-18 94 741 - 08
>
> Registergericht: Amtsgericht München
> Registernummer: HRB 157899
> Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
> Unsere Datenschutzerklärung finden Sie hier:
> https://embedded-brains.de/datenschutzerklaerung/
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
___
devel 

Re: [PATCH] c-user: Add application config info directives

2022-10-04 Thread Sebastian Huber

On 04/10/2022 09:04, Chris Johns wrote:

On 30/9/2022 11:34 pm, Sebastian Huber wrote:

On 17/09/2022 09:31, Chris Johns wrote:

+rtems_get_version_string()
+--
+
+Gets the RTEMS version string.
+
+.. rubric:: CALLING SEQUENCE:
+
+.. code-block:: c
+
+    const char *rtems_get_version_string( void );
+
+.. rubric:: RETURN VALUES:
+
+Returns the pointer to the RTEMS version string.

Is the version string subject to change across releases or do as set this string
format?

Is it worth discussing the revision values and what they mean?

The version string contains a lot of stuff:

const char _RTEMS_version[] =
   "rtems-" RTEMS_VERSION " (" CPU_NAME "/" CPU_MODEL_NAME "/"
   RTEMS_XSTRING( RTEMS_BSP ) ")";

I don't know if we should specify a particular format.


I agree. We should say it may change and parsing it may break.


Ok, I added this to the notes and checked in the updated patch.

--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.hu...@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH] c-user: Add application config info directives

2022-10-04 Thread Chris Johns


On 1/10/2022 12:25 am, Sebastian Huber wrote:
> On 17/09/2022 09:31, Chris Johns wrote:
>>> diff --git a/c-user/config/introduction.rst b/c-user/config/introduction.rst
>>> new file mode 100644
>>> index 000..d06662a
>>> --- /dev/null
>>> +++ b/c-user/config/introduction.rst
>>> @@ -0,0 +1,221 @@
>>> +.. SPDX-License-Identifier: CC-BY-SA-4.0
>>> +
>>> +.. Copyright (C) 2009, 2021 embedded brains GmbH
>>> (http://www.embedded-brains.de)
>>> +.. Copyright (C) 1988, 2021 On-Line Applications Research Corporation (OAR)
>> Is this right? I see in the diff fragments Gedare?
> 
> Yes, I think so. Gedare has a copyright in the unlimited objects section.
> 

Great and thanks

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


Re: [PATCH] c-user: Add application config info directives

2022-10-04 Thread Chris Johns
On 30/9/2022 11:43 pm, Sebastian Huber wrote:
> On 17/09/2022 09:31, Chris Johns wrote:
>>> +rtems_configuration_get_milliseconds_per_tick()
>>> +---
>>> +
>>> +Gets the number of milliseconds per clock tick configured for this 
>>> application.
>> There are other API calls that return this value. What should a user do?
> 
> I don't know another API function to get this value.

Yes there is not. It may have been 5 or 4.11 I was thinking about. I have been
working with those version.

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


Re: [PATCH] c-user: Add application config info directives

2022-10-04 Thread Chris Johns
On 30/9/2022 11:34 pm, Sebastian Huber wrote:
> On 17/09/2022 09:31, Chris Johns wrote:
>>> +rtems_get_version_string()
>>> +--
>>> +
>>> +Gets the RTEMS version string.
>>> +
>>> +.. rubric:: CALLING SEQUENCE:
>>> +
>>> +.. code-block:: c
>>> +
>>> +    const char *rtems_get_version_string( void );
>>> +
>>> +.. rubric:: RETURN VALUES:
>>> +
>>> +Returns the pointer to the RTEMS version string.
>> Is the version string subject to change across releases or do as set this 
>> string
>> format?
>>
>> Is it worth discussing the revision values and what they mean?
> 
> The version string contains a lot of stuff:
> 
> const char _RTEMS_version[] =
>   "rtems-" RTEMS_VERSION " (" CPU_NAME "/" CPU_MODEL_NAME "/"
>   RTEMS_XSTRING( RTEMS_BSP ) ")";
> 
> I don't know if we should specify a particular format.
> 

I agree. We should say it may change and parsing it may break.

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