This is an automated email from the ASF dual-hosted git repository.
acassis 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 f3721d83d0e drivers/segger: Let the SEGGER sources take part in
dependency checking.
f3721d83d0e is described below
commit f3721d83d0e4038cc75e0458dda6c721fc3c597d
Author: Marco Casaroli <[email protected]>
AuthorDate: Fri Jul 31 14:51:45 2026 +0200
drivers/segger: Let the SEGGER sources take part in dependency checking.
Every other driver subdirectory adds bare file names to CSRCS and points
VPATH and DEPPATH at itself, so drivers/lcd/st7365p.c is built as
drivers/st7365p.o. segger/Make.defs instead put the path in CSRCS, so its
objects were built as drivers/segger/serial_rtt.o and friends.
The generated rules in drivers/Make.dep name their target with the basename
of the source -- mkdeps calls basename() and prefixes --obj-path -- so they
read "serial_rtt.o: segger/serial_rtt.c ... nuttx/config.h". No such file
was ever built. The dependency rule and the compile rule named different
targets, and nothing under drivers/segger was ever recompiled when a header
or the configuration changed.
The result is a stale object silently linked against fresh ones. Enabling
CONFIG_TTY_SIGINT, for instance, adds a pid_t to struct uart_dev_s, which
moves every field after it. serial.c is rebuilt and reads dev->ops from its
new offset; serial_rtt.o is not, and its statically initialised device still
has ops four bytes lower. uart_open() then branches through whatever
follows it, and the board hard faults in uart_attach() before the console
has emitted a byte -- a symptom with no visible connection to its cause.
Use the same convention as the other subdirectories.
Tested on a Pimoroni Pico Plus 2 W with the RTT console
(pimoroni-pico-plus-2-w:nsh with CONFIG_SERIAL_RTT_CONSOLE). On master,
touching nuttx/serial/serial.h or enabling CONFIG_TTY_SIGINT does not
recompile segger/serial_rtt.c, and the incrementally built image prints
nothing on RTT. With this change, serial_rtt.c is recompiled in both
cases, and the same incremental build boots to NSH over RTT.
drivers/mtd/Make.defs has the same shape for its downloaded dhara and nvblk
sources and is left alone: it adds both nvblk.c and mtd/nvblk/src/nvblk.c,
whose basenames collide, so it needs more than a change of convention.
Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Marco Casaroli <[email protected]>
---
drivers/segger/Make.defs | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/drivers/segger/Make.defs b/drivers/segger/Make.defs
index d86b4f35caa..5e87864ba27 100644
--- a/drivers/segger/Make.defs
+++ b/drivers/segger/Make.defs
@@ -24,8 +24,8 @@ TARGET_ZIP =
SGDIR = segger
ifeq ($(CONFIG_SEGGER_RTT),y)
- CSRCS += segger/segger.c
- CSRCS += segger/SystemView/SEGGER/SEGGER_RTT.c
+ CSRCS += segger.c
+ CSRCS += SEGGER_RTT.c
CFLAGS += -Wno-shadow -Wno-pointer-to-int-cast
@@ -41,37 +41,43 @@ ifeq ($(CONFIG_SEGGER_RTT),y)
ifeq ($(CONFIG_ARCH_ARMV7M),y)
AFLAGS += ${INCDIR_PREFIX}segger$(DELIM)config
- ASRCS += segger/SystemView/SEGGER/SEGGER_RTT_ASM_ARMv7M.S
+ ASRCS += SEGGER_RTT_ASM_ARMv7M.S
endif
endif
ifeq ($(CONFIG_STREAM_RTT),y)
- CSRCS += segger/stream_rtt.c
+ CSRCS += stream_rtt.c
endif
ifeq ($(CONFIG_SYSLOG_RTT),y)
- CSRCS += segger/syslog_rtt.c
+ CSRCS += syslog_rtt.c
endif
ifeq ($(CONFIG_NOTE_RTT),y)
- CSRCS += segger/note_rtt.c
+ CSRCS += note_rtt.c
endif
ifeq ($(CONFIG_SERIAL_RTT),y)
- CSRCS += segger/serial_rtt.c
+ CSRCS += serial_rtt.c
endif
ifeq ($(CONFIG_SEGGER_SYSVIEW),y)
- CSRCS += segger/note_sysview.c
- CSRCS += segger/SystemView/SEGGER/SEGGER_SYSVIEW.c
+ CSRCS += note_sysview.c
+ CSRCS += SEGGER_SYSVIEW.c
CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)sched
endif
+DEPPATH += --dep-path segger
+VPATH += :segger
+
# Common settings for RTT and SYSTEMVIEW
ifneq ($(CONFIG_SEGGER_RTT)$(CONFIG_SEGGER_SYSVIEW),)
CFLAGS += ${INCDIR_PREFIX}segger$(DELIM)SystemView$(DELIM)SEGGER
+ DEPPATH += --dep-path segger/SystemView/SEGGER
+ VPATH += :segger/SystemView/SEGGER
+
SYSVIEW_VERSION ?= $(CONFIG_SEGGER_SYSVIEW_TARGET_SOURCE)
SYSVIEW_ZIP = SystemView_Src_V$(SYSVIEW_VERSION).zip