casaroli opened a new pull request, #20502: URL: https://github.com/apache/nuttx/pull/20502
## Summary `drivers/segger/Make.defs` adds its sources to `CSRCS` with the `segger/` path, so the objects are built as `drivers/segger/serial_rtt.o` and so on. The dependency rules in `drivers/Make.dep` name the target by the base name of the source (`serial_rtt.o: segger/serial_rtt.c ...`), so they never match. No SEGGER source is recompiled when a header or the configuration changes, and a stale object is linked with fresh ones. This change uses the same convention as the other driver subdirectories: bare file names in `CSRCS`, plus `VPATH` and `DEPPATH` for `segger` and `segger/SystemView/SEGGER`. No source base name in `drivers/` collides with a SEGGER one. ## Impact Make build only; CMake tracks the dependencies itself. Builds with `CONFIG_SEGGER_RTT` or `CONFIG_SEGGER_SYSVIEW` now rebuild the SEGGER objects when their dependencies change. A clean build does not change. `drivers/mtd/Make.defs` has the same problem for its downloaded dhara and nvblk sources, but two of its sources have the same base name, so this PR does not touch it. ## Testing `pimoroni-pico-plus-2-w:nsh` with the RTT console (`CONFIG_SERIAL_RTT_CONSOLE`, no UART console), Arm GNU Toolchain 13.2.rel1, Make build. After a clean build, touch `include/nuttx/serial/serial.h` and run `make`, then enable `CONFIG_TTY_SIGINT` (it adds a field to `struct uart_dev_s`) and run `make` again. Before: ``` --- touch serial.h and rebuild CC: chip/rp23xx_serial.c CC: serial/serial_dma.c CC: serial/serial_io.c CC: serial/serial.c --- enable CONFIG_TTY_SIGINT and rebuild incrementally CC: chip/rp23xx_serial.c CC: serial/serial_dma.c CC: serial/serial_io.c CC: serial/serial.c ``` After: ``` --- touch serial.h and rebuild CC: chip/rp23xx_serial.c CC: segger/serial_rtt.c CC: serial/serial_dma.c CC: serial/serial_io.c CC: serial/serial.c --- enable CONFIG_TTY_SIGINT and rebuild incrementally CC: chip/rp23xx_serial.c CC: segger/segger.c CC: segger/serial_rtt.c CC: segger/SystemView/SEGGER/SEGGER_RTT.c CC: serial/serial_dma.c CC: serial/serial_io.c CC: serial/serial.c ``` On a Pimoroni Pico Plus 2 W, read over RTT with probe-rs: | image | RTT console | |---|---| | master, clean build | `NuttShell (NSH)` | | master, incremental build after `CONFIG_TTY_SIGINT` | nothing (the stale `serial_rtt.o` uses the old `struct uart_dev_s` layout) | | this PR, the same incremental build | `NuttShell (NSH)` | `nucleo-f446re:systemview` and `nrf52832-dk:nxscope_rtt` build, including `SEGGER_SYSVIEW.c` and `SEGGER_RTT_ASM_ARMv7M.S`. `tools/checkpatch.sh -c -u -m -g` passes. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
