Hi Mr. Kinsey Moore,

I will send the patch based on the current RTEMS master as soon as possible.

I am an applicant for GSOC2024 and will continue to improve RPi4 BSP the year. 
I'm currently working on debugging UART interrupt mode. Please let me know if 
there's anything I can do to help.

Best regards,

Ning

> 2024年4月12日 00:08,Kinsey Moore <kinsey.mo...@oarcorp.com> 写道:
> 
> Ah, that makes sense. If your patch depends on Utkarsh's work, then we'll 
> need to work on getting that into upstream RTEMS as well. If your patch can 
> be rebased on to current RTEMS master, that would be ideal.
> 
> Regarding Utkarsh's work not being merged into RTEMS, patches sometimes slip 
> through the cracks and fail to get the reviews they need to progress to a 
> point where they can be accepted into RTEMS. I'm actually working on Noor's 
> SMP patch for RPi4 (also one of last year's GSoC projects) right now to get 
> it into good condition for merging into RTEMS.
> 
> Kinsey
> 
> On Thu, Apr 11, 2024 at 10:59 AM Ning Yang <yan...@qq.com> wrote:
> Hi Mr. Kinsey Moore:
> 
> I am using the RPi4 BSP (project of GSOC2023) written by Utkarsh Verma. For 
> some reason it wasn't merged.
> https://lists.rtems.org/pipermail/devel/2023-August/076152.html
> I got the code from his github: https://github.com/UtkarshVerma/rtems
> 
> Best regards,
> 
> Ning
> 
> > 2024年4月11日 23:22,Kinsey Moore <kinsey.mo...@oarcorp.com> 写道:
> > 
> > I couldn't get this patch to apply. Are you sure it came from the right 
> > branch and has no merge commits ahead of it?
> > 
> > Kinsey
> > 
> > On Wed, Apr 10, 2024 at 9:24 AM Ning Yang <yan...@qq.com> wrote:
> > The clock from the ARM timer is derived from the system clock. This clock 
> > can change dynamically e.g. if the system goes into reduced power or in low 
> > power mode. Thus the clock speed adapts to the overall system performance 
> > capabilities. For accurate timing it is recommended to use the system 
> > timers.
> > 
> > if BSP_CLOCK_USE_SYSTEMTIMER = 1, use the System Timer, otherwise use the 
> > ARM Timer.
> > ---
> >  .../aarch64/raspberrypi/include/bsp/bcm2711.h | 28 ++++++++++++
> >  .../raspberrypi/include/bsp/raspberrypi.h     | 43 +++++++++++++++++++
> >  bsps/aarch64/raspberrypi/start/bspstartmmu.c  |  8 ++++
> >  spec/build/bsps/aarch64/raspberrypi/bsp4b.yml |  1 +
> >  spec/build/bsps/aarch64/raspberrypi/obj.yml   |  3 ++
> >  .../bsps/aarch64/raspberrypi/objclock.yml     |  4 +-
> >  .../aarch64/raspberrypi/objsystemtimer.yml    | 22 ++++++++++
> >  .../aarch64/raspberrypi/optsystemtimer.yml    | 24 +++++++++++
> >  8 files changed, 132 insertions(+), 1 deletion(-)
> >  create mode 100644 bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
> >  create mode 100644 spec/build/bsps/aarch64/raspberrypi/objsystemtimer.yml
> >  create mode 100644 spec/build/bsps/aarch64/raspberrypi/optsystemtimer.yml
> > 
> > diff --git a/bsps/aarch64/raspberrypi/include/bsp/bcm2711.h 
> > b/bsps/aarch64/raspberrypi/include/bsp/bcm2711.h
> > index e6c77fa025..8707582ebb 100644
> > --- a/bsps/aarch64/raspberrypi/include/bsp/bcm2711.h
> > +++ b/bsps/aarch64/raspberrypi/include/bsp/bcm2711.h
> > @@ -11,6 +11,7 @@
> >  /*
> >   * Copyright (C) 2022 Mohd Noor Aman
> >   * Copyright (C) 2023 Utkarsh Verma
> > + * Copyright (C) 2024 Ning Yang
> >   *
> >   *
> >   * Redistribution and use in source and binary forms, with or without
> > @@ -91,6 +92,27 @@
> >  #define BCM2711_UART5_BASE (BCM2711_PL011_BASE + 0xa00)
> >  #define BCM2711_UART5_SIZE BCM2711_PL011_DEVICE_SIZE
> > 
> > +/* System Timer */
> > +/**
> > + * NOTE: The GPU uses Compare registers 0 and 2 for
> > + *       it's own RTOS. 1 and 3 are available for use in
> > + *       RTEMS.
> > + */
> > +#define BCM2835_GPU_TIMER_BASE    (BCM2711_PERIPHERAL_BASE + 0x2000000+ 
> > 0x3000)
> > +#define BCM2835_GPU_TIMER_SIZE    0x1C
> > +
> > +#define BCM2835_GPU_TIMER_CS      (BCM2835_GPU_TIMER_BASE + 0x00)
> > +#define BCM2835_GPU_TIMER_CS_M0   0x00000001
> > +#define BCM2835_GPU_TIMER_CS_M1   0x00000002
> > +#define BCM2835_GPU_TIMER_CS_M2   0x00000004
> > +#define BCM2835_GPU_TIMER_CS_M3   0x00000008
> > +#define BCM2835_GPU_TIMER_CLO     (BCM2835_GPU_TIMER_BASE + 0x04)
> > +#define BCM2835_GPU_TIMER_CHI     (BCM2835_GPU_TIMER_BASE + 0x08)
> > +#define BCM2835_GPU_TIMER_C0      (BCM2835_GPU_TIMER_BASE + 0x0C)
> > +#define BCM2835_GPU_TIMER_C1      (BCM2835_GPU_TIMER_BASE + 0x10)
> > +#define BCM2835_GPU_TIMER_C2      (BCM2835_GPU_TIMER_BASE + 0x14)
> > +#define BCM2835_GPU_TIMER_C3      (BCM2835_GPU_TIMER_BASE + 0x18)
> > +
> >  /* ARM Local */
> >  #define BCM2711_ARM_LOCAL_BASE 0xff800000LL
> >  #define BCM2711_ARM_LOCAL_SIZE 0x800000
> > @@ -114,4 +136,10 @@
> >  #define BCM2711_IRQ_AUX                (BCM2711_IRQ_VC_PERIPHERAL_BASE + 
> > 29)
> >  #define BCM2711_IRQ_PL011_UART         (BCM2711_IRQ_VC_PERIPHERAL_BASE + 
> > 57)
> > 
> > +/* Interrupt Vectors: System Timer */
> > +#define BCM2835_IRQ_ID_GPU_TIMER_M0    (BCM2711_IRQ_VC_PERIPHERAL_BASE + 0)
> > +#define BCM2835_IRQ_ID_GPU_TIMER_M1    (BCM2711_IRQ_VC_PERIPHERAL_BASE + 1)
> > +#define BCM2835_IRQ_ID_GPU_TIMER_M2    (BCM2711_IRQ_VC_PERIPHERAL_BASE + 2)
> > +#define BCM2835_IRQ_ID_GPU_TIMER_M3    (BCM2711_IRQ_VC_PERIPHERAL_BASE + 3)
> > +
> >  #endif /* LIBBSP_AARCH64_RASPBERRYPI_BSP_BCM2711_H */
> > diff --git a/bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h 
> > b/bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
> > new file mode 100644
> > index 0000000000..2e1c673bfb
> > --- /dev/null
> > +++ b/bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
> > @@ -0,0 +1,43 @@
> > +/* SPDX-License-Identifier: BSD-2-Clause */
> > +
> > +/**
> > + * @file
> > + *
> > + * @ingroup RTEMSBSPsAArch64RaspberryPi
> > + *
> > + * @brief RaspberryPi shared Register Definitions
> > + */
> > +
> > +/*
> > + * Copyright (C) 2024 Ning Yang
> > + *
> > + *
> > + * 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_AARCH64_RASPBERRYPI_RASPBERRYPI_H
> > +#define LIBBSP_AARCH64_RASPBERRYPI_RASPBERRYPI_H
> > +
> > +#include <bsp/bcm2711.h>
> > +#define BCM2835_REG(addr)          *(volatile uint32_t*)(addr)
> > +
> > +#endif /* LIBBSP_AARCH64_RASPBERRYPI_RASPBERRYPI_H */
> > \ No newline at end of file
> > diff --git a/bsps/aarch64/raspberrypi/start/bspstartmmu.c 
> > b/bsps/aarch64/raspberrypi/start/bspstartmmu.c
> > index d5d1381357..eb59b8f31b 100644
> > --- a/bsps/aarch64/raspberrypi/start/bspstartmmu.c
> > +++ b/bsps/aarch64/raspberrypi/start/bspstartmmu.c
> > @@ -11,6 +11,7 @@
> >  /*
> >   * Copyright (C) 2022 Mohd Noor Aman
> >   * Copyright (C) 2023 Utkarsh Verma
> > + * Copyright (C) 2024 Ning Yang
> >   *
> >   *
> >   * Redistribution and use in source and binary forms, with or without
> > @@ -45,6 +46,7 @@
> >  #include "bsp/irq.h"
> >  #include "bsp/mbox.h"
> >  #include "bsp/rpi-gpio.h"
> > +#include "bsp/bcm2711.h"
> > 
> >  #define CONSOLE_DEVICE_MMU_CONFIG(_port, _file, base, size, ...) \
> >      {.begin = base, .end = base + size, .flags = AARCH64_MMU_DEVICE},
> > @@ -52,6 +54,12 @@
> >  BSP_START_DATA_SECTION static const aarch64_mmu_config_entry
> >      bsp_mmu_config_table[] = {
> >          AARCH64_MMU_DEFAULT_SECTIONS,
> > +        {
> > +            /* System Timer */
> > +            .begin = BCM2835_GPU_TIMER_BASE,
> > +            .end   = BCM2835_GPU_TIMER_BASE + BCM2835_GPU_TIMER_SIZE,
> > +            .flags = AARCH64_MMU_DEVICE,
> > +        },
> > 
> >          /* clang-format off */
> >          CONSOLE_DEVICES(CONSOLE_DEVICE_MMU_CONFIG)
> > diff --git a/spec/build/bsps/aarch64/raspberrypi/bsp4b.yml 
> > b/spec/build/bsps/aarch64/raspberrypi/bsp4b.yml
> > index 4347235208..fd1f1ab33f 100644
> > --- a/spec/build/bsps/aarch64/raspberrypi/bsp4b.yml
> > +++ b/spec/build/bsps/aarch64/raspberrypi/bsp4b.yml
> > @@ -17,6 +17,7 @@ includes: []
> >  install:
> >    - destination: ${BSP_INCLUDEDIR}/bsp
> >      source:
> > +      - bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h
> >        - bsps/aarch64/raspberrypi/include/bsp/bcm2711.h
> > 
> >  source: []
> > diff --git a/spec/build/bsps/aarch64/raspberrypi/obj.yml 
> > b/spec/build/bsps/aarch64/raspberrypi/obj.yml
> > index 4a320336b7..9692cc955f 100644
> > --- a/spec/build/bsps/aarch64/raspberrypi/obj.yml
> > +++ b/spec/build/bsps/aarch64/raspberrypi/obj.yml
> > @@ -2,6 +2,7 @@ SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
> >  copyrights:
> >    - Copyright (C) 2022 Mohd Noor Aman
> >    - Copyright (C) 2023 Utkarsh Verma
> > +  - Copyright (C) 2024 Ning Yang
> > 
> >  type: build
> >  enabled-by: true
> > @@ -31,6 +32,8 @@ links:
> >      uid: objcache
> >    - role: build-dependency
> >      uid: objclock
> > +  - role: build-dependency
> > +    uid: objsystemtimer
> >    - role: build-dependency
> >      uid: objconsole
> >    - role: build-dependency
> > diff --git a/spec/build/bsps/aarch64/raspberrypi/objclock.yml 
> > b/spec/build/bsps/aarch64/raspberrypi/objclock.yml
> > index 550df8029a..317919026e 100644
> > --- a/spec/build/bsps/aarch64/raspberrypi/objclock.yml
> > +++ b/spec/build/bsps/aarch64/raspberrypi/objclock.yml
> > @@ -2,9 +2,11 @@ SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
> >  copyrights:
> >    - Copyright (C) 2022 Mohd Noor Aman
> >    - Copyright (C) 2023 Utkarsh Verma
> > +  - Copyright (C) 2024 Ning Yang
> > 
> >  type: build
> > -enabled-by: true
> > +enabled-by:
> > +  not: BSP_CLOCK_USE_SYSTEMTIMER
> > 
> >  build-type: objects
> >  cflags: []
> > diff --git a/spec/build/bsps/aarch64/raspberrypi/objsystemtimer.yml 
> > b/spec/build/bsps/aarch64/raspberrypi/objsystemtimer.yml
> > new file mode 100644
> > index 0000000000..7fc4118d0e
> > --- /dev/null
> > +++ b/spec/build/bsps/aarch64/raspberrypi/objsystemtimer.yml
> > @@ -0,0 +1,22 @@
> > +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
> > +copyrights:
> > +  - Copyright (C) 2024 Ning Yang
> > +
> > +type: build
> > +enabled-by: 
> > +- BSP_CLOCK_USE_SYSTEMTIMER
> > +
> > +build-type: objects
> > +cflags: []
> > +cppflags: []
> > +cxxflags: []
> > +includes: []
> > +install: []
> > +
> > +source:
> > +  - bsps/shared/dev/clock/bcm2835-system-timer.c
> > +  - bsps/shared/dev/cpucounter/cpucounterfrequency.c
> > +  - bsps/shared/dev/cpucounter/cpucounterread.c
> > +  - bsps/shared/dev/getentropy/getentropy-cpucounter.c
> > +
> > +links: []
> > \ No newline at end of file
> > diff --git a/spec/build/bsps/aarch64/raspberrypi/optsystemtimer.yml 
> > b/spec/build/bsps/aarch64/raspberrypi/optsystemtimer.yml
> > new file mode 100644
> > index 0000000000..1cceebf22b
> > --- /dev/null
> > +++ b/spec/build/bsps/aarch64/raspberrypi/optsystemtimer.yml
> > @@ -0,0 +1,24 @@
> > +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
> > +copyrights:
> > +  - Copyright (C) 2024 Ning Yang
> > +
> > +type: build
> > +build-type: option
> > +
> > +enabled-by: true
> > +name: BSP_CLOCK_USE_SYSTEMTIMER
> > +description: |
> > +  The clock from the ARM timer is derived from the system clock. This 
> > clock can change dynamically e.g. if the system
> > +  goes into reduced power or in low power mode. Thus the clock speed 
> > adapts to the overall system performance
> > +  capabilities. For accurate timing it is recommended to use the system 
> > timers.
> > +
> > +actions:
> > +  - get-boolean: null
> > +  - define-condition: null
> > +  - env-enable: null
> > +default:
> > +  - enabled-by: 
> > +    - aarch64/raspberrypi4b
> > +    value: false
> > +
> > +links: []
> > \ No newline at end of file
> > -- 
> > 2.34.1
> > 
> > _______________________________________________
> > devel mailing list
> > devel@rtems.org
> > http://lists.rtems.org/mailman/listinfo/devel
> 
> _______________________________________________
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel

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

Reply via email to