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 5bb2a7a185d drivers/serial: do not build serial drivers when
CONFIG_SERIAL is disabled
5bb2a7a185d is described below
commit 5bb2a7a185d06938383c49059e3650d870b34db8
Author: Swatantra Yadav <[email protected]>
AuthorDate: Thu Oct 29 01:01:33 2026 +0530
drivers/serial: do not build serial drivers when CONFIG_SERIAL is disabled
Previously, drivers/serial/Make.defs and CMakeLists.txt unconditionally
compiled serial.c and serial_io.c, even when CONFIG_SERIAL was disabled.
This caused unnecessary compilation and errors when CONFIG_SERIAL (which
selects CONFIG_FS_UIO) was disabled.
This change wraps serial driver compilation in drivers/serial/Make.defs
and drivers/serial/CMakeLists.txt under CONFIG_SERIAL.
Assisted-by: Google Gemini
Signed-off-by: Swatantra Yadav <[email protected]>
---
drivers/serial/CMakeLists.txt | 4 +++-
drivers/serial/Make.defs | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/serial/CMakeLists.txt b/drivers/serial/CMakeLists.txt
index ba039446bf3..80e381b159d 100644
--- a/drivers/serial/CMakeLists.txt
+++ b/drivers/serial/CMakeLists.txt
@@ -22,7 +22,9 @@
# Include serial drivers
-set(SRCS serial.c serial_io.c)
+if(CONFIG_SERIAL)
+ set(SRCS serial.c serial_io.c)
+endif()
if(CONFIG_SERIAL_GDBSTUB)
list(APPEND SRCS serial_gdbstub.c)
diff --git a/drivers/serial/Make.defs b/drivers/serial/Make.defs
index 22845e16959..12b35636460 100644
--- a/drivers/serial/Make.defs
+++ b/drivers/serial/Make.defs
@@ -22,7 +22,9 @@
# Include serial drivers
-CSRCS += serial.c serial_io.c
+ifeq ($(CONFIG_SERIAL),y)
+ CSRCS += serial.c serial_io.c
+endif
ifeq ($(CONFIG_SERIAL_GDBSTUB),y)
CSRCS += serial_gdbstub.c