Skip to content

Commit 717aa9c

Browse files
committed
cmake: dts: Tweak warning flags for unit_address check
In Zephyr we have dts in which multiple peripherals can be at the same MMIO address. So we want to disable the `unique_unit_address` check via (-Wno-unique_unit_address). However, newer dtc support a check that makes sure if we have duplicate unit-address devices that only one is enabled. So if the dtc flag is supported we enable (-Wunique_unit_address_if_enabled). Signed-off-by: Kumar Gala <[email protected]>
1 parent 1718b07 commit 717aa9c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cmake/dts.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,20 @@ if(CONFIG_HAS_DTS)
8080
endif()
8181

8282
# Run the DTC on *.dts.pre.tmp to create the intermediary file *.dts_compiled
83+
84+
set(DTC_WARN_UNIT_ADDR_IF_ENABLED "")
85+
check_dtc_flag("-Wunique_unit_address_if_enabled" check)
86+
if (check)
87+
set(DTC_WARN_UNIT_ADDR_IF_ENABLED "-Wunique_unit_address_if_enabled")
88+
endif()
8389
execute_process(
8490
COMMAND ${DTC}
8591
-O dts
8692
-o ${BOARD}.dts_compiled
8793
-b 0
8894
-E unit_address_vs_reg
95+
-W no-unique_unit_address
96+
${DTC_WARN_UNIT_ADDR_IF_ENABLED}
8997
${EXTRA_DTC_FLAGS} # User settable
9098
${BOARD}.dts.pre.tmp
9199
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}

0 commit comments

Comments
 (0)