ImBonkers opened a new pull request, #18945:
URL: https://github.com/apache/nuttx/pull/18945

   ## Summary
   
     * **Why**: The three on-board user LEDs (LD5/LD6/LD7) are unused. This PR 
wires them for `autoleds` or `userleds`, and adds a `nucleo-n657x0-q:leds` 
configuration that bundles the userleds with `apps/examples/leds`.
     * **How**: The two driver files mirror 
`boards/arm/stm32h5/nucleo-h563zi/src/stm32_{autoleds,userleds}.c`, with the 
polarity inverted in `phy_set_led()` / `board_userled()` / 
`board_userled_all()` for the active-low wiring on this board. `ARCH_LEDS` and 
`USERLED` remain mutually exclusive per the H5/H7 convention. 
`arch/arm/src/stm32n6/stm32_idle.c` adds `#include <arch/board/board.h>` so 
`LED_IDLE` is defined when this file compiles. Without it the 
`BEGIN_IDLE/END_IDLE` macros silently expand to nothing and `up_idle()` never 
calls into the `autoleds` driver. H5's `stm32_idle.c` already does this.
     * **Related NuttX issue**: None.
     * **Related NuttX Apps issue / PR**: None.
   
   ## Impact
   
     * Is new feature added? Is existing feature changed? **YES**
   `autoleds` and `userleds` support, plus a `nucleo-n657x0-q:leds` 
configuration for the `userleds` path. No existing feature changed.
   
     * Impact on user (will user need to adapt to change)? **YES**
   The existing `nsh` and `ostest` defconfigs do not pin `CONFIG_ARCH_LEDS` and 
therefore inherit its Kconfig default (`y` when `ARCH_HAVE_LEDS` is selected), 
so after this patch they include the autoleds driver by default. This matches 
the convention on the comparable H5 and H7 Nucleo defconfigs, which also leave 
`ARCH_LEDS` at its default. Users who want the LEDs untouched can set 
`CONFIG_ARCH_LEDS=n` via `make menuconfig`, and users who want them from 
userspace can use the new `nucleo-n657x0-q:leds` configuration.
   
     * Impact on build (will build process change)? **NO**
   
     * Impact on hardware (will arch(s) / board(s) / driver(s) change)? **YES**
   Only the Nucleo-N657X0-Q board is affected. The one-line `select 
ARCH_HAVE_LEDS` is added inside the N6-specific `ARCH_BOARD_NUCLEO_N657X0_Q` in 
`boards/Kconfig`, so other boards are not touched.
   
     * Impact on documentation (is update required / provided)? **YES**
   The Nucleo-N657X0-Q board page is updated to describe the two LED paths and 
add the new `leds` configuration.
   
     * Impact on security (any sort of implications)? **NO**
   
     * Impact on compatibility (backward/forward/interoperability)? **NO**
   
     * Anything else? The three commits each build on their own.
   
   ## Testing
   
   I confirm that changes are verified on local setup and works as intended:
   
     * **Build Host**: Ubuntu 24.04 x86_64, `arm-none-eabi-gcc` (gcc 13.2.1) 
from the `ghcr.io/apache/nuttx/apache-nuttx-ci-linux` container image (`latest` 
tag as of this PR).
     * **Target**: STM Nucleo-N657X0-Q, flashed via the on-board ST-Link in DEV 
mode. Configs: `nucleo-n657x0-q:nsh`, `nucleo-n657x0-q:ostest`, and the new 
`nucleo-n657x0-q:leds`.
     * Reproduction steps:
   
       ```bash
       ./tools/configure.sh nucleo-n657x0-q:nsh   # or :ostest, or :leds
       make
       # -w32 0xE000ED08 0x34000400 points VTOR at the loaded image
       STM32_Programmer_CLI -c port=SWD mode=UR -halt \
         -d nuttx.bin 0x34000400 \
         -w32 0xE000ED08 0x34000400 \
         -g 0x34000400
       ```
   
   Testing logs:
   
   ```
   --- Run 1: nsh (CONFIG_ARCH_LEDS=y by default) ---
   
   $ ./tools/configure.sh nucleo-n657x0-q:nsh
   $ make
   ...
   Memory region         Used Size  Region Size  %age Used
               sram:       83196 B      4095 KB      1.98%
   CP: nuttx.bin
   
--------------------------------------------------------------------------------
   
   NuttShell (NSH) NuttX-12.13.0
   nsh> uname -a
   NuttX 12.13.0 db9029de8e May 22 2026 18:24:26 arm nucleo-n657x0-q
   nsh>
   
   Observed: LD6 (green) steady at the idle prompt (LED_IDLE),
   LD5 (red) pulses on every IRQ but the on-time is so brief it is barely 
visible.
   ```
   ```
   --- Run 2: ostest ---
   
   $ ./tools/configure.sh nucleo-n657x0-q:ostest
   $ make
   ...
   Memory region         Used Size  Region Size  %age Used
               sram:      149532 B      4095 KB      3.57%
   CP: nuttx.bin
   
--------------------------------------------------------------------------------
   
   nsh> uname -a
   NuttX 12.13.0 db9029de8e May 22 2026 18:25:04 arm nucleo-n657x0-q
   nsh> ostest
   stdio_test: write fd=1
   ...
   user_main: Exiting
   ostest_main: Exiting with status 0
   
   Observed: All of the three LEDs flash on new task.
   LD5 pulses on every IRQ but the on-time is so brief it is barely visible.
   
   ostest runs to completion with `ostest_main: Exiting with status 0`; no
   sub-test reported a failure.
   ```
   ```
   --- Run 3: leds ---
   
   $ ./tools/configure.sh nucleo-n657x0-q:leds
   $ make
   ...
   Memory region         Used Size  Region Size  %age Used
               sram:       85344 B      4095 KB      2.04%
   CP: nuttx.bin
   
--------------------------------------------------------------------------------
   
   NuttShell (NSH) NuttX-12.13.0
   nsh> uname -a
   NuttX 12.13.0 db9029de8e May 22 2026 18:28:19 arm nucleo-n657x0-q
   nsh> ls /dev
   /dev:
    console
    null
    ttyS0
    userleds
    zero
   nsh> leds
   leds_main: Starting the led_daemon
   leds_main: led_daemon started
   
   led_daemon (pid# 4): Running
   led_daemon: Opening /dev/userleds
   led_daemon: Supported LEDs 0x07
   led_daemon: LED set 0x01
   nsh> led_daemon: LED set 0x02
   led_daemon: LED set 0x03
   led_daemon: LED set 0x04
   led_daemon: LED set 0x05
   led_daemon: LED set 0x06
   led_daemon: LED set 0x07
   led_daemon: LED set 0x06
   led_daemon: LED set 0x05
   led_daemon: LED set 0x04
   led_daemon: LED set 0x03
   led_daemon: LED set 0x02
   led_daemon: LED set 0x01
   led_daemon: LED set 0x00
   led_daemon: LED set 0x01
   led_daemon: LED set 0x02
   led_daemon: LED set 0x03
   led_daemon: LED set 0x04
   ...
   
   Observed: LD5 (red) blinks fastest, LD6 (green) slower, LD7 (blue)
   slowest, the led_daemon cycles the userled_set_t bitmap and each
   LED toggles at the rate of the bit it owns.
   ```
   ```
   --- Lint ---
   
   $ ./tools/checkpatch.sh -g HEAD~3..HEAD  -> All checks pass
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to