cmake: dtc: Validate EXTRA_DTC_FLAGS flags

Make sure the flags in EXTRA_DTC_FLAGS are valid for the version of dtc
we have and only invoke dtc with flags it supports.

Fixes #32644

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
Kumar Gala 2021-02-24 20:40:52 -06:00 committed by Carles Cufí
commit 444a2d19a8

View file

@ -188,6 +188,14 @@ if(SUPPORTS_DTS)
if (check) if (check)
set(DTC_NO_WARN_UNIT_ADDR "-Wno-unique_unit_address") set(DTC_NO_WARN_UNIT_ADDR "-Wno-unique_unit_address")
endif() endif()
set(VALID_EXTRA_DTC_FLAGS "")
foreach(extra_opt ${EXTRA_DTC_FLAGS})
check_dtc_flag(${extra_opt} check)
if (check)
list(APPEND VALID_EXTRA_DTC_FLAGS ${extra_opt})
endif()
endforeach()
set(EXTRA_DTC_FLAGS ${VALID_EXTRA_DTC_FLAGS})
execute_process( execute_process(
COMMAND ${DTC} COMMAND ${DTC}
-O dts -O dts