diff --git a/cmake/dts.cmake b/cmake/dts.cmake index eb7382207b0..459f82fc7bb 100644 --- a/cmake/dts.cmake +++ b/cmake/dts.cmake @@ -198,6 +198,7 @@ if(SUPPORTS_DTS) --bindings-dirs ${DTS_ROOT_BINDINGS} --conf-out ${DEVICETREE_CONF} --header-out ${DEVICETREE_UNFIXED_H} + --dts-out ${PROJECT_BINARY_DIR}/zephyr.dts # As a debugging aid ) execute_process( @@ -209,6 +210,11 @@ if(SUPPORTS_DTS) message(FATAL_ERROR "new extractor failed with return code: ${ret}") endif() + # A file that used to be generated by 'dtc'. zephyr.dts is the new + # equivalent. Will be removed in Zephyr 2.3. + file(WRITE ${PROJECT_BINARY_DIR}/${BOARD}.dts_compiled + "See zephyr.dts for the final merged devicetree.") + else() file(WRITE ${DEVICETREE_UNFIXED_H} "/* WARNING. THIS FILE IS AUTO-GENERATED. DO NOT MODIFY! */") endif(SUPPORTS_DTS) diff --git a/scripts/dts/gen_defines.py b/scripts/dts/gen_defines.py index 049dd6c032c..cc15ca88b80 100755 --- a/scripts/dts/gen_defines.py +++ b/scripts/dts/gen_defines.py @@ -37,6 +37,10 @@ def main(): except edtlib.EDTError as e: sys.exit(f"devicetree error: {e}") + # Save merged DTS source, as a debugging aid + with open(args.dts_out, "w", encoding="utf-8") as f: + print(edt.dts_source, file=f) + conf_file = open(args.conf_out, "w", encoding="utf-8") header_file = open(args.header_out, "w", encoding="utf-8") @@ -87,6 +91,9 @@ def parse_args(): help="path to write header to") parser.add_argument("--conf-out", required=True, help="path to write configuration file to") + parser.add_argument("--dts-out", required=True, + help="path to write merged DTS source code to (e.g. " + "as a debugging aid)") return parser.parse_args()