cmake: dts: warn on unrecognized vendor prefixes

This uses the list of vendor prefixes provided by the user by default.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit is contained in:
Martí Bolívar 2021-05-18 15:09:49 -07:00 committed by Kumar Gala
parent 6719fae101
commit f261d77c75
2 changed files with 12 additions and 1 deletions

View file

@ -23,6 +23,8 @@ set(EDT_PICKLE ${PROJECT_BINARY_DIR}/edt.pickle)
set(DEVICETREE_UNFIXED_H ${PROJECT_BINARY_DIR}/include/generated/devicetree_unfixed.h)
set(DEVICE_EXTERN_H ${PROJECT_BINARY_DIR}/include/generated/device_extern.h)
set(DTS_POST_CPP ${PROJECT_BINARY_DIR}/${BOARD}.dts.pre.tmp)
# A list of generally accepted vendor prefixes.
set_ifndef(VENDOR_PREFIXES ${ZEPHYR_BASE}/dts/bindings/vendor-prefixes.txt)
set_ifndef(DTS_SOURCE ${BOARD_DIR}/${BOARD}.dts)
@ -228,6 +230,7 @@ if(SUPPORTS_DTS)
--device-header-out ${DEVICE_EXTERN_H}
--dts-out ${ZEPHYR_DTS} # As a debugging aid
--edt-pickle-out ${EDT_PICKLE}
--vendor-prefixes ${VENDOR_PREFIXES}
${EXTRA_GEN_DEFINES_ARGS}
)

View file

@ -57,6 +57,11 @@ def main():
setup_edtlib_logging()
if args.vendor_prefixes:
vendor_prefixes = edtlib.load_vendor_prefixes_txt(args.vendor_prefixes)
else:
vendor_prefixes = None
try:
edt = edtlib.EDT(args.dts, args.bindings_dirs,
# Suppress this warning if it's suppressed in dtc
@ -65,7 +70,8 @@ def main():
default_prop_types=True,
infer_binding_for_paths=["/zephyr,user"],
err_on_deprecated_properties=
args.err_on_deprecated_properties)
args.err_on_deprecated_properties,
vendor_prefixes=vendor_prefixes)
except edtlib.EDTError as e:
sys.exit(f"devicetree error: {e}")
@ -209,6 +215,8 @@ def parse_args():
help="path to write device struct extern header to")
parser.add_argument("--edt-pickle-out",
help="path to write pickled edtlib.EDT object to")
parser.add_argument("--vendor-prefixes",
help="vendor-prefixes.txt path; used for validation")
parser.add_argument("--err-on-deprecated-properties", action="store_true",
help="if set, deprecated property usage is an error")