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


The following commit(s) were added to refs/heads/master by this push:
     new a88cdd368fd arch/arm/stm32: fix link error when no U(S)ART is enabled
a88cdd368fd is described below

commit a88cdd368fd0555816f75cf765e483ca3a6f0c1b
Author: raiden00pl <[email protected]>
AuthorDate: Mon Nov 16 09:52:54 2026 +0100

    arch/arm/stm32: fix link error when no U(S)ART is enabled
    
    Since the common STM32 sources were moved to arch/arm/src/common/stm32,
    stm32_serial_m3m4_v1v2v3v4.c is compiled only when CONFIG_STM32_USART
    is selected.
    
    This file provides not only the serial driver, but also the up_putc()
    fallback and the arm_serialinit()/arm_earlyserialinit() hooks used when
    no U(S)ART is enabled. Without it, configurations with all U(S)ARTs
    disabled fail to link:
    
      undefined reference to `up_putc'
      undefined reference to `arm_serialinit'
      undefined reference to `arm_earlyserialinit'
    
    Compile the file regardless of CONFIG_STM32_USART, as it was done
    before the directory split.
    
    Signed-off-by: raiden00pl <[email protected]>
---
 arch/arm/src/common/stm32/CMakeLists.txt | 12 +++++-------
 arch/arm/src/common/stm32/Make.defs      |  2 --
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/arch/arm/src/common/stm32/CMakeLists.txt 
b/arch/arm/src/common/stm32/CMakeLists.txt
index 2ce79704e10..143183f66c2 100644
--- a/arch/arm/src/common/stm32/CMakeLists.txt
+++ b/arch/arm/src/common/stm32/CMakeLists.txt
@@ -214,13 +214,11 @@ if(CONFIG_STM32_COMMON_LEGACY)
   list(APPEND SRCS stm32_pmstop_m3m4_v1.c stm32_pmstandby_m3m4_v1.c
        stm32_pmsleep_m3m4_v1.c)
 
-  if(CONFIG_STM32_USART)
-    if(CONFIG_STM32_HAVE_IP_USART_V1
-       OR CONFIG_STM32_HAVE_IP_USART_V2
-       OR CONFIG_STM32_HAVE_IP_USART_V3
-       OR CONFIG_STM32_HAVE_IP_USART_V4)
-      list(APPEND SRCS stm32_serial_m3m4_v1v2v3v4.c)
-    endif()
+  if(CONFIG_STM32_HAVE_IP_USART_V1
+     OR CONFIG_STM32_HAVE_IP_USART_V2
+     OR CONFIG_STM32_HAVE_IP_USART_V3
+     OR CONFIG_STM32_HAVE_IP_USART_V4)
+    list(APPEND SRCS stm32_serial_m3m4_v1v2v3v4.c)
   endif()
 
   if(CONFIG_STM32_DMA)
diff --git a/arch/arm/src/common/stm32/Make.defs 
b/arch/arm/src/common/stm32/Make.defs
index 48cd8e6a5b2..fda815e37b8 100644
--- a/arch/arm/src/common/stm32/Make.defs
+++ b/arch/arm/src/common/stm32/Make.defs
@@ -215,14 +215,12 @@ CHIP_CSRCS += stm32_pmstop_m3m4_v1.c
 CHIP_CSRCS += stm32_pmstandby_m3m4_v1.c
 CHIP_CSRCS += stm32_pmsleep_m3m4_v1.c
 
-ifeq ($(CONFIG_STM32_USART),y)
 ifneq ($(filter y,$(CONFIG_STM32_HAVE_IP_USART_V1) \
             $(CONFIG_STM32_HAVE_IP_USART_V2) \
             $(CONFIG_STM32_HAVE_IP_USART_V3) \
             $(CONFIG_STM32_HAVE_IP_USART_V4)),)
 CHIP_CSRCS += stm32_serial_m3m4_v1v2v3v4.c
 endif
-endif
 
 ifeq ($(CONFIG_STM32_DMA),y)
 ifeq ($(CONFIG_STM32_HAVE_IP_DMA_V1_7CH_DMAMUX),y)

Reply via email to