<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div dir="ltr"><div>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.</div><div><br></div><div>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.</div><div><br></div><div>Kinsey<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Apr 11, 2024 at 10:59 AM Ning Yang <<a href="mailto:yangn0@qq.com">yangn0@qq.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Mr. Kinsey Moore:<br>
<br>
I am using the RPi4 BSP (project of GSOC2023) written by Utkarsh Verma. For some reason it wasn't merged.<br>
<a href="https://lists.rtems.org/pipermail/devel/2023-August/076152.html" rel="noreferrer" target="_blank">https://lists.rtems.org/pipermail/devel/2023-August/076152.html</a><br>
I got the code from his github: <a href="https://github.com/UtkarshVerma/rtems" rel="noreferrer" target="_blank">https://github.com/UtkarshVerma/rtems</a><br>
<br>
Best regards,<br>
<br>
Ning<br>
<br>
> 2024年4月11日 23:22,Kinsey Moore <<a href="mailto:kinsey.moore@oarcorp.com" target="_blank">kinsey.moore@oarcorp.com</a>> 写道:<br>
> <br>
> 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?<br>
> <br>
> Kinsey<br>
> <br>
> On Wed, Apr 10, 2024 at 9:24 AM Ning Yang <<a href="mailto:yangn0@qq.com" target="_blank">yangn0@qq.com</a>> wrote:<br>
> 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.<br>
> <br>
> if BSP_CLOCK_USE_SYSTEMTIMER = 1, use the System Timer, otherwise use the ARM Timer.<br>
> ---<br>
> .../aarch64/raspberrypi/include/bsp/bcm2711.h | 28 ++++++++++++<br>
> .../raspberrypi/include/bsp/raspberrypi.h | 43 +++++++++++++++++++<br>
> bsps/aarch64/raspberrypi/start/bspstartmmu.c | 8 ++++<br>
> spec/build/bsps/aarch64/raspberrypi/bsp4b.yml | 1 +<br>
> spec/build/bsps/aarch64/raspberrypi/obj.yml | 3 ++<br>
> .../bsps/aarch64/raspberrypi/objclock.yml | 4 +-<br>
> .../aarch64/raspberrypi/objsystemtimer.yml | 22 ++++++++++<br>
> .../aarch64/raspberrypi/optsystemtimer.yml | 24 +++++++++++<br>
> 8 files changed, 132 insertions(+), 1 deletion(-)<br>
> create mode 100644 bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h<br>
> create mode 100644 spec/build/bsps/aarch64/raspberrypi/objsystemtimer.yml<br>
> create mode 100644 spec/build/bsps/aarch64/raspberrypi/optsystemtimer.yml<br>
> <br>
> diff --git a/bsps/aarch64/raspberrypi/include/bsp/bcm2711.h b/bsps/aarch64/raspberrypi/include/bsp/bcm2711.h<br>
> index e6c77fa025..8707582ebb 100644<br>
> --- a/bsps/aarch64/raspberrypi/include/bsp/bcm2711.h<br>
> +++ b/bsps/aarch64/raspberrypi/include/bsp/bcm2711.h<br>
> @@ -11,6 +11,7 @@<br>
> /*<br>
> * Copyright (C) 2022 Mohd Noor Aman<br>
> * Copyright (C) 2023 Utkarsh Verma<br>
> + * Copyright (C) 2024 Ning Yang<br>
> *<br>
> *<br>
> * Redistribution and use in source and binary forms, with or without<br>
> @@ -91,6 +92,27 @@<br>
> #define BCM2711_UART5_BASE (BCM2711_PL011_BASE + 0xa00)<br>
> #define BCM2711_UART5_SIZE BCM2711_PL011_DEVICE_SIZE<br>
> <br>
> +/* System Timer */<br>
> +/**<br>
> + * NOTE: The GPU uses Compare registers 0 and 2 for<br>
> + * it's own RTOS. 1 and 3 are available for use in<br>
> + * RTEMS.<br>
> + */<br>
> +#define BCM2835_GPU_TIMER_BASE (BCM2711_PERIPHERAL_BASE + 0x2000000+ 0x3000)<br>
> +#define BCM2835_GPU_TIMER_SIZE 0x1C<br>
> +<br>
> +#define BCM2835_GPU_TIMER_CS (BCM2835_GPU_TIMER_BASE + 0x00)<br>
> +#define BCM2835_GPU_TIMER_CS_M0 0x00000001<br>
> +#define BCM2835_GPU_TIMER_CS_M1 0x00000002<br>
> +#define BCM2835_GPU_TIMER_CS_M2 0x00000004<br>
> +#define BCM2835_GPU_TIMER_CS_M3 0x00000008<br>
> +#define BCM2835_GPU_TIMER_CLO (BCM2835_GPU_TIMER_BASE + 0x04)<br>
> +#define BCM2835_GPU_TIMER_CHI (BCM2835_GPU_TIMER_BASE + 0x08)<br>
> +#define BCM2835_GPU_TIMER_C0 (BCM2835_GPU_TIMER_BASE + 0x0C)<br>
> +#define BCM2835_GPU_TIMER_C1 (BCM2835_GPU_TIMER_BASE + 0x10)<br>
> +#define BCM2835_GPU_TIMER_C2 (BCM2835_GPU_TIMER_BASE + 0x14)<br>
> +#define BCM2835_GPU_TIMER_C3 (BCM2835_GPU_TIMER_BASE + 0x18)<br>
> +<br>
> /* ARM Local */<br>
> #define BCM2711_ARM_LOCAL_BASE 0xff800000LL<br>
> #define BCM2711_ARM_LOCAL_SIZE 0x800000<br>
> @@ -114,4 +136,10 @@<br>
> #define BCM2711_IRQ_AUX (BCM2711_IRQ_VC_PERIPHERAL_BASE + 29)<br>
> #define BCM2711_IRQ_PL011_UART (BCM2711_IRQ_VC_PERIPHERAL_BASE + 57)<br>
> <br>
> +/* Interrupt Vectors: System Timer */<br>
> +#define BCM2835_IRQ_ID_GPU_TIMER_M0 (BCM2711_IRQ_VC_PERIPHERAL_BASE + 0)<br>
> +#define BCM2835_IRQ_ID_GPU_TIMER_M1 (BCM2711_IRQ_VC_PERIPHERAL_BASE + 1)<br>
> +#define BCM2835_IRQ_ID_GPU_TIMER_M2 (BCM2711_IRQ_VC_PERIPHERAL_BASE + 2)<br>
> +#define BCM2835_IRQ_ID_GPU_TIMER_M3 (BCM2711_IRQ_VC_PERIPHERAL_BASE + 3)<br>
> +<br>
> #endif /* LIBBSP_AARCH64_RASPBERRYPI_BSP_BCM2711_H */<br>
> diff --git a/bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h b/bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h<br>
> new file mode 100644<br>
> index 0000000000..2e1c673bfb<br>
> --- /dev/null<br>
> +++ b/bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h<br>
> @@ -0,0 +1,43 @@<br>
> +/* SPDX-License-Identifier: BSD-2-Clause */<br>
> +<br>
> +/**<br>
> + * @file<br>
> + *<br>
> + * @ingroup RTEMSBSPsAArch64RaspberryPi<br>
> + *<br>
> + * @brief RaspberryPi shared Register Definitions<br>
> + */<br>
> +<br>
> +/*<br>
> + * Copyright (C) 2024 Ning Yang<br>
> + *<br>
> + *<br>
> + * Redistribution and use in source and binary forms, with or without<br>
> + * modification, are permitted provided that the following conditions<br>
> + * are met:<br>
> + * 1. Redistributions of source code must retain the above copyright<br>
> + * notice, this list of conditions and the following disclaimer.<br>
> + * 2. Redistributions in binary form must reproduce the above copyright<br>
> + * notice, this list of conditions and the following disclaimer in the<br>
> + * documentation and/or other materials provided with the distribution.<br>
> + *<br>
> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"<br>
> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE<br>
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE<br>
> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE<br>
> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR<br>
> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF<br>
> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS<br>
> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN<br>
> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)<br>
> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE<br>
> + * POSSIBILITY OF SUCH DAMAGE.<br>
> + */<br>
> +<br>
> +#ifndef LIBBSP_AARCH64_RASPBERRYPI_RASPBERRYPI_H<br>
> +#define LIBBSP_AARCH64_RASPBERRYPI_RASPBERRYPI_H<br>
> +<br>
> +#include <bsp/bcm2711.h><br>
> +#define BCM2835_REG(addr) *(volatile uint32_t*)(addr)<br>
> +<br>
> +#endif /* LIBBSP_AARCH64_RASPBERRYPI_RASPBERRYPI_H */<br>
> \ No newline at end of file<br>
> diff --git a/bsps/aarch64/raspberrypi/start/bspstartmmu.c b/bsps/aarch64/raspberrypi/start/bspstartmmu.c<br>
> index d5d1381357..eb59b8f31b 100644<br>
> --- a/bsps/aarch64/raspberrypi/start/bspstartmmu.c<br>
> +++ b/bsps/aarch64/raspberrypi/start/bspstartmmu.c<br>
> @@ -11,6 +11,7 @@<br>
> /*<br>
> * Copyright (C) 2022 Mohd Noor Aman<br>
> * Copyright (C) 2023 Utkarsh Verma<br>
> + * Copyright (C) 2024 Ning Yang<br>
> *<br>
> *<br>
> * Redistribution and use in source and binary forms, with or without<br>
> @@ -45,6 +46,7 @@<br>
> #include "bsp/irq.h"<br>
> #include "bsp/mbox.h"<br>
> #include "bsp/rpi-gpio.h"<br>
> +#include "bsp/bcm2711.h"<br>
> <br>
> #define CONSOLE_DEVICE_MMU_CONFIG(_port, _file, base, size, ...) \<br>
> {.begin = base, .end = base + size, .flags = AARCH64_MMU_DEVICE},<br>
> @@ -52,6 +54,12 @@<br>
> BSP_START_DATA_SECTION static const aarch64_mmu_config_entry<br>
> bsp_mmu_config_table[] = {<br>
> AARCH64_MMU_DEFAULT_SECTIONS,<br>
> + {<br>
> + /* System Timer */<br>
> + .begin = BCM2835_GPU_TIMER_BASE,<br>
> + .end = BCM2835_GPU_TIMER_BASE + BCM2835_GPU_TIMER_SIZE,<br>
> + .flags = AARCH64_MMU_DEVICE,<br>
> + },<br>
> <br>
> /* clang-format off */<br>
> CONSOLE_DEVICES(CONSOLE_DEVICE_MMU_CONFIG)<br>
> diff --git a/spec/build/bsps/aarch64/raspberrypi/bsp4b.yml b/spec/build/bsps/aarch64/raspberrypi/bsp4b.yml<br>
> index 4347235208..fd1f1ab33f 100644<br>
> --- a/spec/build/bsps/aarch64/raspberrypi/bsp4b.yml<br>
> +++ b/spec/build/bsps/aarch64/raspberrypi/bsp4b.yml<br>
> @@ -17,6 +17,7 @@ includes: []<br>
> install:<br>
> - destination: ${BSP_INCLUDEDIR}/bsp<br>
> source:<br>
> + - bsps/aarch64/raspberrypi/include/bsp/raspberrypi.h<br>
> - bsps/aarch64/raspberrypi/include/bsp/bcm2711.h<br>
> <br>
> source: []<br>
> diff --git a/spec/build/bsps/aarch64/raspberrypi/obj.yml b/spec/build/bsps/aarch64/raspberrypi/obj.yml<br>
> index 4a320336b7..9692cc955f 100644<br>
> --- a/spec/build/bsps/aarch64/raspberrypi/obj.yml<br>
> +++ b/spec/build/bsps/aarch64/raspberrypi/obj.yml<br>
> @@ -2,6 +2,7 @@ SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause<br>
> copyrights:<br>
> - Copyright (C) 2022 Mohd Noor Aman<br>
> - Copyright (C) 2023 Utkarsh Verma<br>
> + - Copyright (C) 2024 Ning Yang<br>
> <br>
> type: build<br>
> enabled-by: true<br>
> @@ -31,6 +32,8 @@ links:<br>
> uid: objcache<br>
> - role: build-dependency<br>
> uid: objclock<br>
> + - role: build-dependency<br>
> + uid: objsystemtimer<br>
> - role: build-dependency<br>
> uid: objconsole<br>
> - role: build-dependency<br>
> diff --git a/spec/build/bsps/aarch64/raspberrypi/objclock.yml b/spec/build/bsps/aarch64/raspberrypi/objclock.yml<br>
> index 550df8029a..317919026e 100644<br>
> --- a/spec/build/bsps/aarch64/raspberrypi/objclock.yml<br>
> +++ b/spec/build/bsps/aarch64/raspberrypi/objclock.yml<br>
> @@ -2,9 +2,11 @@ SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause<br>
> copyrights:<br>
> - Copyright (C) 2022 Mohd Noor Aman<br>
> - Copyright (C) 2023 Utkarsh Verma<br>
> + - Copyright (C) 2024 Ning Yang<br>
> <br>
> type: build<br>
> -enabled-by: true<br>
> +enabled-by:<br>
> + not: BSP_CLOCK_USE_SYSTEMTIMER<br>
> <br>
> build-type: objects<br>
> cflags: []<br>
> diff --git a/spec/build/bsps/aarch64/raspberrypi/objsystemtimer.yml b/spec/build/bsps/aarch64/raspberrypi/objsystemtimer.yml<br>
> new file mode 100644<br>
> index 0000000000..7fc4118d0e<br>
> --- /dev/null<br>
> +++ b/spec/build/bsps/aarch64/raspberrypi/objsystemtimer.yml<br>
> @@ -0,0 +1,22 @@<br>
> +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause<br>
> +copyrights:<br>
> + - Copyright (C) 2024 Ning Yang<br>
> +<br>
> +type: build<br>
> +enabled-by: <br>
> +- BSP_CLOCK_USE_SYSTEMTIMER<br>
> +<br>
> +build-type: objects<br>
> +cflags: []<br>
> +cppflags: []<br>
> +cxxflags: []<br>
> +includes: []<br>
> +install: []<br>
> +<br>
> +source:<br>
> + - bsps/shared/dev/clock/bcm2835-system-timer.c<br>
> + - bsps/shared/dev/cpucounter/cpucounterfrequency.c<br>
> + - bsps/shared/dev/cpucounter/cpucounterread.c<br>
> + - bsps/shared/dev/getentropy/getentropy-cpucounter.c<br>
> +<br>
> +links: []<br>
> \ No newline at end of file<br>
> diff --git a/spec/build/bsps/aarch64/raspberrypi/optsystemtimer.yml b/spec/build/bsps/aarch64/raspberrypi/optsystemtimer.yml<br>
> new file mode 100644<br>
> index 0000000000..1cceebf22b<br>
> --- /dev/null<br>
> +++ b/spec/build/bsps/aarch64/raspberrypi/optsystemtimer.yml<br>
> @@ -0,0 +1,24 @@<br>
> +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause<br>
> +copyrights:<br>
> + - Copyright (C) 2024 Ning Yang<br>
> +<br>
> +type: build<br>
> +build-type: option<br>
> +<br>
> +enabled-by: true<br>
> +name: BSP_CLOCK_USE_SYSTEMTIMER<br>
> +description: |<br>
> + The clock from the ARM timer is derived from the system clock. This clock can change dynamically e.g. if the system<br>
> + goes into reduced power or in low power mode. Thus the clock speed adapts to the overall system performance<br>
> + capabilities. For accurate timing it is recommended to use the system timers.<br>
> +<br>
> +actions:<br>
> + - get-boolean: null<br>
> + - define-condition: null<br>
> + - env-enable: null<br>
> +default:<br>
> + - enabled-by: <br>
> + - aarch64/raspberrypi4b<br>
> + value: false<br>
> +<br>
> +links: []<br>
> \ No newline at end of file<br>
> -- <br>
> 2.34.1<br>
> <br>
> _______________________________________________<br>
> devel mailing list<br>
> <a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
> <a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a><br>
<br>
_______________________________________________<br>
devel mailing list<br>
<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a></blockquote></div>