1# 2# Copyright (c) 2024, Arm Limited and Contributors. All rights reserved. 3# 4# SPDX-License-Identifier: BSD-3-Clause 5# 6 7import sys 8from cot_dt2c.cot_parser import COT 9 10def generateMain(input, output=None): 11 cot = COT(input, output) 12 cot.generate_c_file() 13 14def validateMain(input): 15 cot = COT(input) 16 if not cot.validate_nodes(): 17 print("not a valid CoT DT file") 18 19def visualizeMain(input): 20 cot = COT(input) 21 cot.tree_visualization() 22 23if __name__=="__main__": 24 if (len(sys.argv) < 2): 25 print("usage: python3 " + sys.argv[0] + " [dtsi file path] [optional output c file path]") 26 exit() 27 if len(sys.argv) == 3: 28 generateMain(sys.argv[1], sys.argv[2]) 29 if len(sys.argv) == 2: 30 validateMain(sys.argv[1]) 31