This is an automated email from the ASF dual-hosted git repository.

casaroli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new c0ec95bfb66 arch/arm/stm32h7: Handle serial lookup without UARTs.
c0ec95bfb66 is described below

commit c0ec95bfb66e2d1a097a8298632ff701bcfa2735
Author: yushuailong <[email protected]>
AuthorDate: Mon Nov 2 22:57:51 2026 +0800

    arch/arm/stm32h7: Handle serial lookup without UARTs.
    
    Compile stm32_serial_get_uart() only when HAVE_UART is defined,
    matching the condition that guards its g_uart_devs device table.
    Without this guard, enabling serial support with all hardware UARTs
    disabled fails to compile because the table is not defined.
    
    Follow the conditional function definition used by the common STM32
    serial driver. Keep the UART lookup function body unchanged.
    
    Validation:
    - Reproduced the undeclared g_uart_devs error on unmodified upstream.
    - Built nucleo-h743zi:nsh with USART3 enabled and with all hardware
      UARTs disabled and the USB CDC ACM console enabled.
    - Confirmed the lookup symbol is present only in the UART-enabled
      object and the function body is identical to upstream.
    - Patch style and whitespace checks passed.
    
    Assisted-by: Codex:GPT-6
    Signed-off-by: yushuailong <[email protected]>
---
 arch/arm/src/stm32h7/stm32_serial.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/src/stm32h7/stm32_serial.c 
b/arch/arm/src/stm32h7/stm32_serial.c
index f336edf26e2..4355c404540 100644
--- a/arch/arm/src/stm32h7/stm32_serial.c
+++ b/arch/arm/src/stm32h7/stm32_serial.c
@@ -3846,6 +3846,7 @@ static int up_pm_prepare(struct pm_callback_s *cb, int 
domain,
  *
  ****************************************************************************/
 
+#ifdef HAVE_UART
 uart_dev_t *stm32_serial_get_uart(int uart_num)
 {
   int uart_idx = uart_num - 1;
@@ -3862,6 +3863,7 @@ uart_dev_t *stm32_serial_get_uart(int uart_num)
 
   return &g_uart_devs[uart_idx]->dev;
 }
+#endif /* HAVE_UART */
 
 /****************************************************************************
  * Name: arm_earlyserialinit

Reply via email to