This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit b5a3bff956b971bb15e2f45c3b73e66884a594d2 Author: Binh Nguyen <[email protected]> AuthorDate: Fri Nov 20 12:00:38 2026 +0000 Documentation/arm/rzv2h: Document RTC support Document RTC support for the RZV2H-EVK. Signed-off-by: Binh Nguyen <[email protected]> --- .../platforms/arm/rzv2h/boards/rzv2h-evk/index.rst | 192 ++++++++++++++------- .../platforms/arm/rzv2h/boards/rzv2h-rdk/index.rst | 192 ++++++++++++++++++++- Documentation/platforms/arm/rzv2h/index.rst | 22 ++- boards/arm/rzv2h/rzv2h-evk/configs/alarm/defconfig | 3 - 4 files changed, 331 insertions(+), 78 deletions(-) diff --git a/Documentation/platforms/arm/rzv2h/boards/rzv2h-evk/index.rst b/Documentation/platforms/arm/rzv2h/boards/rzv2h-evk/index.rst index 196cedaba57..1b9ce118687 100644 --- a/Documentation/platforms/arm/rzv2h/boards/rzv2h-evk/index.rst +++ b/Documentation/platforms/arm/rzv2h/boards/rzv2h-evk/index.rst @@ -1,15 +1,15 @@ -========= -RZV2H-EVK -========= +========== +RZ/V2H EVK +========== .. tags:: arch:arm, arch:armv7-r, arch:cortex-r8, chip:rzv2h, vendor:renesas -The RZV2H-EVK is an evaluation board for the Renesas RZ/V2H (R9A09G057) +The RZ/V2H EVK is an evaluation board for the Renesas RZ/V2H (R9A09G057) MPU. NuttX is ported to run on one of the two Cortex-R8 real-time cores (``CR8_0``). Board Overview -=============== +============== .. figure:: rzv2h-evk-overview.png :align: center @@ -148,8 +148,8 @@ Release the button and repeat the command; the value must return to ``0``. Each invocation of the standard ``apps/examples/gpio`` application performs one read and exits, so the button must remain pressed for the second command. -Current limitations -~~~~~~~~~~~~~~~~~~~ +GPIO limitations +~~~~~~~~~~~~~~~~ The current GPIO implementation supports synchronous read and write only. GPIO interrupt attachment and enablement are placeholders, so ``gpio -w`` @@ -185,24 +185,7 @@ The ``nsh`` configuration enables ``CONFIG_DEV_GPIO`` and NuttX application repository at ``apps/examples/gpio``; it is not an RZ/V2H-specific application. The RZ/V2H board port only configures the pins, registers ``/dev/gpio0`` through ``/dev/gpio2``, and enables the example in -the board configuration. The upstream example source is used without -board-specific polling logic. - -The GPIO application uses the following command format:: - - gpio [-t <pintype>] [-w <signo>] [-o <value>] <driver-path> - -.. note:: - - At this stage, the RZ/V2H GPIO driver supports only GPIO read and write - operations for application testing. Changing the pin type is not - supported: ``GPIOC_SETPINTYPE`` does not reconfigure the hardware. - GPIO interrupt attachment and enablement are also placeholders, so - interrupt notification is not available. - - Consequently, use only ``gpio <driver-path>`` for reading and - ``gpio -o <0|1> <driver-path>`` for writing. Do not use the ``-t`` - pin-type option or the ``-w`` interrupt-wait option on this board. +the board configuration. For these LED outputs, only ``-o`` and the device path are needed. The ``-o`` option writes the logical pin level (zero or one), while the device @@ -214,27 +197,6 @@ LED on and one to turn it off. For example:: nsh> gpio -o 0 /dev/gpio2 nsh> gpio -o 1 /dev/gpio2 -For each command, the application reports the previous output level, the -level being written, and the level read back from the driver. For example, -if LED output 1 is currently off:: - - nsh> gpio -o 0 /dev/gpio1 - Driver: /dev/gpio1 - Output pin: Value=1 - Writing: Value=0 - Verify: Value=0 - -Omit ``-o`` to read the current output level without changing it:: - - nsh> gpio /dev/gpio1 - -Each invocation performs a single GPIO operation and then exits. This is -sufficient for the manual button and LED validation described here. - -Use ``gpio -h`` to display the generic application's command syntax. Some -options shown by that help text are not yet supported by the RZ/V2H GPIO -driver, as described above. - Using the NuttX user-LED application ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -292,21 +254,6 @@ The current button and LED tests both reuse the standard NuttX GPIO example: - Reused unchanged; it controls both active-low outputs through ``/dev/userleds`` -.. important:: - - No RZ/V2H-specific test application is required for the current manual - validation. Use the standard NuttX ``gpio`` example to read the button - through ``/dev/gpio0`` and to control the LEDs through ``/dev/gpio1`` and - ``/dev/gpio2``. A separate polling application is needed only if - continuous monitoring, transition detection, or debounce testing is - required later. - - The GPIO devices are registered from the board late-initialization path, so - ``CONFIG_BOARD_LATE_INITIALIZE`` must remain enabled. - - The user-controlled ``board_userled_*()`` hooks and ``/dev/userleds`` are - supported. The automatic ``board_autoled_*()`` hooks selected by - ``CONFIG_ARCH_LEDS`` remain placeholders. Serial Consoles =============== @@ -992,13 +939,87 @@ once it is mounted, so log messages persist across resets. This requires / flight-log partition described above, not in the firmware or parameter partitions. +Real-Time Clock (RTC) +===================== + +The RZ/V2H RTC provides a calendar clock, a one-shot alarm and a periodic +wakeup. It is registered through ``CONFIG_RTC_ARCH`` so a single driver both +exposes ``/dev/rtc0`` and seeds the NuttX system clock at boot. If the RTC +has never been set, the system clock falls back to the build-time default +date. + +RTC Clock source +---------------- + +On the RZ/V2H-EVK the RTC sub-clock is driven from a 32.768 kHz crystal. +Alarm and periodic wakeup have been verified running on the EVK. + +RTC configuration +----------------- + +Enable the RTC on top of an existing configuration (for example +``rzv2h-evk:nsh``) with the following options:: + + CONFIG_RTC=y + CONFIG_RTC_DATETIME=y + CONFIG_RTC_DRIVER=y + CONFIG_RTC_ARCH=y + CONFIG_RTC_ALARM=y + CONFIG_RTC_NALARMS=1 + CONFIG_RTC_PERIODIC=y + CONFIG_RZV2H_RTC=y + CONFIG_NSH_DISABLE_DATE=n + CONFIG_SIG_EVTHREAD=y + CONFIG_SCHED_LPWORK=y + CONFIG_EXAMPLES_ALARM=y + CONFIG_BOARD_LATE_INITIALIZE=y + +With these options the board registers ``/dev/rtc0`` during board +initialization. + +RTC NSH +------- + +Read and set the calendar with the NSH ``date`` builtin +(``CONFIG_NSH_DISABLE_DATE=n``). If the RTC has never been set, the boot +log reports the fallback and ``date`` shows the build-time default: + +.. code-block:: console + + rzv2h_rtc: RTC not set; using build-time default date + NuttShell (NSH) NuttX-13.0.0 + nsh> date -s "Jul 29 15:30:00 2026" + nsh> date + Wed, Jul 29 15:30:01 2026 + +Arm a relative alarm with the standard ``apps/examples/alarm`` application +(``CONFIG_EXAMPLES_ALARM``). The example starts an ``alarm_daemon`` on first +use; the daemon prints when the alarm signal is received: + +.. code-block:: console + + nsh> alarm 5 + alarm_daemon started + alarm_daemon: Running + Opening /dev/rtc0 + Alarm 0 set in 5 seconds + nsh> alarm_daemon: alarm 0 received + +A pending alarm can be read back, and an armed alarm can be cancelled: + +.. code-block:: console + + nsh> alarm 30 + Opening /dev/rtc0 + Alarm 0 set in 30 seconds + nsh> alarm -c -a 0 + Opening /dev/rtc0 + Alarm 0 has been canceled + Bring-up ======== -This section describes what has been brought up so far for the CR8_0 core. -Clock, MPU, GIC, timer, GPIO, and SCI-B UART support described on this -page are implemented. Board options not described here may still be -placeholders. +This section describes what has been brought up so far. Clock control ------------- @@ -1051,6 +1072,41 @@ as the system tick source. Its clock is ``BSP_CFG_CLOCK_I6CLK_HZ / 2``, and the reload value is derived from ``CLK_TCK`` so the timer fires every system tick. The Private Timer interrupt (BSP IRQn -3) maps to GIC INTID 29. + +RTC +--- + +When ``CONFIG_RZV2H_RTC`` is enabled, ``rzv2h_bringup()`` +(``boards/arm/rzv2h/rzv2h-evk/src/rzv2h_bringup.c``) initializes the RTC +during board late-initialization. It configures the RTC hardware, routes the +interrupt sources. +``/dev/rtc0`` and publishes the lower half to the ``CONFIG_RTC_ARCH`` bridge +so that a single driver both serves ``/dev/rtc0`` and seeds the NuttX system +clock. + +The system clock is seeded from the RTC at boot. If the RTC has never been +started it falls back to the build-time default date and the boot log prints +``rzv2h_rtc: RTC not set; using build-time default date``. See the Real-Time +Clock (RTC) section above for configuration and NSH usage. + +Linker script +------------- + +``boards/arm/rzv2h/rzv2h-evk/scripts/rzv2h-evk_cr8_0.ld`` defines the memory +map for CR8_0: + +- ``ITCM`` 0x00000000, 128 KB +- ``DTCM`` 0x00020000, 128 KB +- ``RAM`` 0x08180000, 512 KB (RCPU-SRAM; holds .vectors, .text, .data, + .bss, heap and stack) + +The exception vector table is linked into RAM (an LMA of 0 could not be +written by the debugger before ITCM is mapped) and copied into ITCM by +``arm_boot()`` at runtime. The read-only code region +(``__mpu_code_start``..``__mpu_code_end``) is padded up to a power of two so +the MPU code window above can be programmed as an exact-fit region with no +sub-region mask. + Loading Code ============ @@ -1141,3 +1197,9 @@ mounted as a single flat LittleFS volume at ``/mnt/qspi``. Partitioning enabled by this defconfig. As with the other configurations, there is no working console driver yet, so this is intended for bring-up validation with a debugger. + +alarm +----- + +NSH + RTC alarm example: enables RTC with alarm support and the +``apps/examples/alarm`` application. diff --git a/Documentation/platforms/arm/rzv2h/boards/rzv2h-rdk/index.rst b/Documentation/platforms/arm/rzv2h/boards/rzv2h-rdk/index.rst index a551f39085c..ac6b2238190 100644 --- a/Documentation/platforms/arm/rzv2h/boards/rzv2h-rdk/index.rst +++ b/Documentation/platforms/arm/rzv2h/boards/rzv2h-rdk/index.rst @@ -1,10 +1,10 @@ -========= -RZV2H-RDK -========= +========== +RZ/V2H RDK +========== .. tags:: arch:arm, arch:armv7-r, arch:cortex-r8, chip:rzv2h, vendor:renesas -The RZV2H-RDK is a development board for the Renesas RZ/V2H (R9A09G057) +The RZ/V2H RDK is a development board for the Renesas RZ/V2H (R9A09G057) MPU. NuttX is ported to run on one of the two Cortex-R8 real-time cores (``CR8_0``). @@ -138,9 +138,11 @@ Press and hold the button, then run the read command again:: Input pin: Value=1 Release the button and repeat the command; the value must return to ``0``. +Each invocation of the standard ``apps/examples/gpio`` application performs +one read and exits, so the button must remain pressed for the second command. -Current limitations -~~~~~~~~~~~~~~~~~~~ +GPIO limitations +~~~~~~~~~~~~~~~~ The current GPIO implementation supports synchronous read and write only. GPIO interrupt attachment and enablement are placeholders, so ``gpio -w`` @@ -706,6 +708,178 @@ once it is mounted, so log messages persist across resets. This requires / flight-log partition described above, not in the firmware or parameter partitions. +Real-Time Clock (RTC) +===================== + +The RZ/V2H RTC provides a calendar clock, a one-shot alarm and a periodic +wakeup. It is registered through ``CONFIG_RTC_ARCH`` so a single driver both +exposes ``/dev/rtc0`` and seeds the NuttX system clock at boot. If the RTC +has never been set, the system clock falls back to the build-time default +date. + +RTC Clock source +---------------- + +On the RZ/V2H-RDK the RTC sub-clock is driven from a 32.768 kHz crystal. + +RTC configuration +----------------- + +Enable the RTC on top of an existing configuration (for example +``rzv2h-rdk:nsh``) with the following options:: + + CONFIG_RTC=y + CONFIG_RTC_DATETIME=y + CONFIG_RTC_DRIVER=y + CONFIG_RTC_ARCH=y + CONFIG_RTC_ALARM=y + CONFIG_RTC_NALARMS=1 + CONFIG_RTC_PERIODIC=y + CONFIG_RZV2H_RTC=y + CONFIG_NSH_DISABLE_DATE=n + CONFIG_SIG_EVTHREAD=y + CONFIG_SCHED_LPWORK=y + CONFIG_EXAMPLES_ALARM=y + CONFIG_BOARD_LATE_INITIALIZE=y + +With these options the board registers ``/dev/rtc0`` during board +initialization. + +RTC NSH +------- + +Read and set the calendar with the NSH ``date`` builtin +(``CONFIG_NSH_DISABLE_DATE=n``). If the RTC has never been set, the boot +log reports the fallback and ``date`` shows the build-time default: + +.. code-block:: console + + rzv2h_rtc: RTC not set; using build-time default date + NuttShell (NSH) NuttX-13.0.0 + nsh> date -s "Jul 29 15:30:00 2026" + nsh> date + Wed, Jul 29 15:30:01 2026 + +Arm a relative alarm with the standard ``apps/examples/alarm`` application +(``CONFIG_EXAMPLES_ALARM``). The example starts an ``alarm_daemon`` on first +use; the daemon prints when the alarm signal is received: + +.. code-block:: console + + nsh> alarm 5 + alarm_daemon started + alarm_daemon: Running + Opening /dev/rtc0 + Alarm 0 set in 5 seconds + nsh> alarm_daemon: alarm 0 received + +A pending alarm can be read back, and an armed alarm can be cancelled: + +.. code-block:: console + + nsh> alarm 30 + Opening /dev/rtc0 + Alarm 0 set in 30 seconds + nsh> alarm -c -a 0 + Opening /dev/rtc0 + Alarm 0 has been canceled + +Bring-up +======== + +This section describes what has been brought up so far. + +Clock control +------------- + +``rzv2h_clockconfig()`` (``arch/arm/src/rzv2h/rzv2h_clockconfig.c``) calls +into ``bsp_clock_init()`` from the vendored Renesas FSP BSP +(``arch/arm/src/common/renesas/hal_renesas/...``), which programs the PLL and clock +tree. The system tick timer (see Timer below) derives its input clock from +the resulting ``BSP_CFG_CLOCK_I6CLK_HZ`` value, so this must run before the +timer is configured. + +MPU enablement +-------------- + +``arch/arm/src/rzv2h/rzv2h_mpu_region.c`` defines a static PMSAv7 region +table (``g_mpu_region_table[]``) for CR8 core 0: + +- Region 0 - ITCM (0x00000000, 128 KB), read-only, holds the exception + vector table copied there by ``arm_boot()``. +- Region 1 - DTCM (0x00020000, 128 KB), read/write, execute-never. +- Region 2 - RCPU-SRAM (cacheable), read/write, execute-never default for + the whole image range. +- Last region - the read-only code window (``__mpu_code_start`` .. + ``__mpu_code_end``, provided by the linker script), read-only and + executable, layered on top of region 2 so code remains executable while + data stays non-executable. + +Because PMSAv7 lets the highest-numbered matching region win, the +executable code window must be the last entry in the table, and its size +must be padded to a power of two by the linker script to satisfy PMSAv7's +size/alignment rule. + +Interrupt initialization +------------------------ + +``up_irqinitialize()`` (``arch/arm/src/rzv2h/rzv2h_irq.c``) brings up the +Generic Interrupt Controller (GIC): ``arm_gic0_initialize()`` runs once, on +CPU0 only, followed by ``arm_gic_initialize()`` on every CPU. Interrupts are +then unmasked with ``up_irq_enable()``. + +Beyond the GIC's fixed interrupt lines, the CR8 core's INTC also exposes a +pool of 127 programmable "SEL" lines used by peripherals and the TINT +pin-interrupt controller. + +Timer +----- + +``arch/arm/src/rzv2h/rzv2h_timerisr.c`` uses the Arm MPCore Private Timer +as the system tick source. Its clock is ``BSP_CFG_CLOCK_I6CLK_HZ / 2``, and +the reload value is derived from ``CLK_TCK`` so the timer fires every system +tick. The Private Timer interrupt (BSP IRQn -3) maps to GIC INTID 29. + + +RTC +--- + +When ``CONFIG_RZV2H_RTC`` is enabled, ``rzv2h_bringup()`` +(``boards/arm/rzv2h/rzv2h-evk/src/rzv2h_bringup.c``) initializes the RTC +during board late-initialization. It configures the RTC hardware, routes the +interrupt sources. +``/dev/rtc0`` and publishes the lower half to the ``CONFIG_RTC_ARCH`` bridge +so that a single driver both serves ``/dev/rtc0`` and seeds the NuttX system +clock. + +The system clock is seeded from the RTC at boot. If the RTC has never been +started it falls back to the build-time default date and the boot log prints +``rzv2h_rtc: RTC not set; using build-time default date``. See the Real-Time +Clock (RTC) section above for configuration and NSH usage. + +Linker script +------------- + +``boards/arm/rzv2h/rzv2h-evk/scripts/rzv2h-evk_cr8_0.ld`` defines the memory +map for CR8_0: + +- ``ITCM`` 0x00000000, 128 KB +- ``DTCM`` 0x00020000, 128 KB +- ``RAM`` 0x08180000, 512 KB (RCPU-SRAM; holds .vectors, .text, .data, + .bss, heap and stack) + +The exception vector table is linked into RAM (an LMA of 0 could not be +written by the debugger before ITCM is mapped) and copied into ITCM by +``arm_boot()`` at runtime. The read-only code region +(``__mpu_code_start``..``__mpu_code_end``) is padded up to a power of two so +the MPU code window above can be programmed as an exact-fit region with no +sub-region mask. + +Loading Code +============ + +Use a J-Link or another SWD/JTAG probe to load debugger configurations. + Configurations ============== @@ -782,3 +956,9 @@ mounted as a single flat LittleFS volume at ``/mnt/qspi``. Partitioning enabled by this defconfig. As with the other configurations, there is no working console driver yet, so this is intended for bring-up validation with a debugger. + +alarm +----- + +NSH + RTC alarm example: enables RTC with alarm support and the +``apps/examples/alarm`` application. diff --git a/Documentation/platforms/arm/rzv2h/index.rst b/Documentation/platforms/arm/rzv2h/index.rst index 1308eb47e76..ad761315beb 100644 --- a/Documentation/platforms/arm/rzv2h/index.rst +++ b/Documentation/platforms/arm/rzv2h/index.rst @@ -2,10 +2,9 @@ Renesas RZ/V2H ============== -The RZ/V2H is a Renesas AI-accelerated multicore MPU built around a -heterogeneous set of Arm cores: dual Cortex-A55 (application cores) plus -dual Cortex-R8 (real-time cores), alongside a DSP and an AI-MAC (DRP-AI3) -accelerator. +The RZ/V2H is a heterogeneous multicore MPU integrating dual Cortex-A55, +dual Cortex-R8, and Cortex-M33 cores, together with a DSP and the DRP-AI3 +AI accelerator. .. image:: RZV2H-block-chart-DRP-AI3.png :alt: RZV2H block chart DRP-AI3 @@ -44,6 +43,7 @@ SCI I2C Yes Interrupt-driven SCI simple I2C master on channels 0-9 PWM Yes GPT (General PWM Timer) PWM on channels 0-15 CAN Yes CAN-FD on channels 0-5 QSPI Yes xSPI controller in QSPI mode, manual-command transfers only +RTC Yes Calendar, one-shot alarm, periodic wakeup, system clock. ========== ======= ============================================================ CLOCK @@ -101,6 +101,20 @@ GPIO The GPIO driver provides fundamental support for pin configuration, read, and write operations. GPIO interrupt support is currently unavailable. +RTC +--- + +The RTC driver provides a calendar clock (date and time) through the +standard NuttX RTC lower-half. ``CONFIG_RZV2H_RTC`` enables it and requires +``CONFIG_RTC``, ``CONFIG_RTC_DATETIME``, ``CONFIG_RTC_DRIVER`` and +``CONFIG_RTC_ARCH``. It exposes ``/dev/rtc0`` and seeds the NuttX system +clock at boot. The supported calendar range is 2000-2099. If the RTC has +never been set, the system clock falls back to the build-time default date. + +``CONFIG_RTC_ALARM`` adds a single one-shot alarm (``CONFIG_RTC_NALARMS`` +must be 1) supporting absolute, relative, read-back and cancel operations. +``CONFIG_RTC_PERIODIC`` adds a periodic wakeup at rates from `1/128s` to `2s`. + INTC SEL (Interrupt Select) Lines --------------------------------- diff --git a/boards/arm/rzv2h/rzv2h-evk/configs/alarm/defconfig b/boards/arm/rzv2h/rzv2h-evk/configs/alarm/defconfig index e8b53e64f13..7d450827ade 100644 --- a/boards/arm/rzv2h/rzv2h-evk/configs/alarm/defconfig +++ b/boards/arm/rzv2h/rzv2h-evk/configs/alarm/defconfig @@ -80,9 +80,6 @@ CONFIG_SERIAL_TERMIOS=y CONFIG_DEV_CONSOLE=y CONFIG_SERIAL_CONSOLE=y -# Core Specific Configuration -CONFIG_RZV2H_CORTEXR8_0=y - # FPU Configuration CONFIG_ARCH_FPU=y CONFIG_ARCH_DPFPU=y
