Skip to content

Commit 6f4635f

Browse files
cmake: modules: dts: Restore gen_defines.py warnings
Ever since 059aae7 (cmake: modules: dts: make Device Tree error messages more visible, PR #76472), warnings generated by gen_defines.py got only printed when the exit code signaled an error. Without this patch, the warning gets swallowed and the build continues: ``` $ west build --pristine --board nrf54l15pdk/nrf54l15/cpuapp \ samples/userspace/hello_world_user <snip> -- Found BOARD.dts: <snip>/boards/nordic/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.dts -- Generated zephyr.dts: <snip>/build/zephyr/zephyr.dts <snip> ``` With this patch, the behavior is back to how it was before 059aae7: ``` $ west build --pristine --board nrf54l15pdk/nrf54l15/cpuapp \ samples/userspace/hello_world_user <snip> -- Found BOARD.dts: <snip>/nrf54l15pdk/nrf54l15pdk_nrf54l15_cpuapp.dts unit address and first address in 'reg' (0x5004c000) don't match for /soc/peripheral@50000000/vpr@4c000/mailbox@1 -- Generated zephyr.dts: <snip>zephyr/build/zephyr/zephyr.dts <snip> ``` Signed-off-by: Reto Schneider <[email protected]>
1 parent 3f2790b commit 6f4635f

File tree

1 file changed

+6
-26
lines changed

1 file changed

+6
-26
lines changed

cmake/modules/dts.cmake

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -289,33 +289,13 @@ ${EXTRA_GEN_DEFINES_ARGS}
289289
execute_process(
290290
COMMAND ${CMD_GEN_DEFINES}
291291
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
292-
RESULT_VARIABLE ret
293-
ERROR_VARIABLE stderr
292+
COMMAND_ERROR_IS_FATAL ANY
294293
)
295-
if(NOT "${ret}" STREQUAL "0")
296-
if (stderr)
297-
# gen_defines.py failed after printing message(s) to stderr.
298-
# Append stream content to the FATAL_ERROR message on a new line.
299-
set(stderr "\n${stderr}")
300-
else()
301-
# gen_defines.py did not print anything on stderr. To inform users
302-
# of this condition, set ${stderr} to "<empty>" to have this printed
303-
# in the error message. Note that we do NOT want a newline, such that
304-
# the error message is printed as a single line, e.g.:
305-
#
306-
# gen_defines.py failed with result code: 1 - stderr contents: <empty>
307-
#
308-
set(stderr "<empty>")
309-
endif()
310-
message(STATUS "In: ${PROJECT_BINARY_DIR}, command: ${CMD_GEN_DEFINES}")
311-
message(FATAL_ERROR "gen_defines.py failed with result code: ${ret} - stderr contents: ${stderr}")
312-
else()
313-
zephyr_file_copy(${ZEPHYR_DTS}.new ${ZEPHYR_DTS} ONLY_IF_DIFFERENT)
314-
zephyr_file_copy(${DEVICETREE_GENERATED_H}.new ${DEVICETREE_GENERATED_H} ONLY_IF_DIFFERENT)
315-
file(REMOVE ${ZEPHYR_DTS}.new ${DEVICETREE_GENERATED_H}.new)
316-
message(STATUS "Generated zephyr.dts: ${ZEPHYR_DTS}")
317-
message(STATUS "Generated devicetree_generated.h: ${DEVICETREE_GENERATED_H}")
318-
endif()
294+
zephyr_file_copy(${ZEPHYR_DTS}.new ${ZEPHYR_DTS} ONLY_IF_DIFFERENT)
295+
zephyr_file_copy(${DEVICETREE_GENERATED_H}.new ${DEVICETREE_GENERATED_H} ONLY_IF_DIFFERENT)
296+
file(REMOVE ${ZEPHYR_DTS}.new ${DEVICETREE_GENERATED_H}.new)
297+
message(STATUS "Generated zephyr.dts: ${ZEPHYR_DTS}")
298+
message(STATUS "Generated devicetree_generated.h: ${DEVICETREE_GENERATED_H}")
319299

320300
#
321301
# Run GEN_DRIVER_KCONFIG_SCRIPT.

0 commit comments

Comments
 (0)