nuttx/drivers/segger
Marco Casaroli f3721d83d0 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 <marco.casaroli@gmail.com>
2026-10-08 15:54:35 -03:00
..
config spinlock: Better recursive spinlock implementation. 2025-06-25 22:13:00 +08:00
.gitignore
CMakeLists.txt cmake: Use NUTTX(_DIR/_BIN_DIR) instead CMAKE(_SRC_DIR/_BIN_DIR) 2026-08-09 11:13:08 -03:00
Kconfig drivers/segger: Add a kconfig to override Segger SystemView target sources version 2025-07-22 23:21:31 +08:00
Make.defs drivers/segger: Let the SEGGER sources take part in dependency checking. 2026-10-08 15:54:35 -03:00
note_rtt.c
note_sysview.c
segger.c spinlock: Better recursive spinlock implementation. 2025-06-25 22:13:00 +08:00
serial_rtt.c
stream_rtt.c
syslog_rtt.c