diff --git a/tools/oneclick/prestudy/YAML/args_demo.py b/tools/oneclick/prestudy/YAML/args_demo.py index 8fea23933f9483569ffd1068aeabe3d448d19db1..e146f26ed7271c3bd15d559f5cef15bcf251e866 100755 --- a/tools/oneclick/prestudy/YAML/args_demo.py +++ b/tools/oneclick/prestudy/YAML/args_demo.py @@ -78,14 +78,17 @@ if __name__ == "__main__": # Parse command line arguments parser = argparse.ArgumentParser(description=""" - =Args demo=\r + =Args demo= system and peripheral config command line parser arguments """) parser.add_argument('-p','--peripheral', nargs='*', default=[], help="peripheral names separated by spaces") parser.add_argument('-s','--system', nargs='*', default=[], help="system names separated by spaces") parser.add_argument('-v','--verbosity', default='INFO', help="verbosity level can be [ERROR | WARNING | INFO | DEBUG]") args = parser.parse_args() - + + if not args.peripheral and not args.system: + parser.print_help() + unit_logger.set_stdout_log_level(args.verbosity) logger.debug("Used arguments: {}".format(args)) diff --git a/tools/oneclick/prestudy/YAML/args_documentation.py b/tools/oneclick/prestudy/YAML/args_documentation.py index 4d92dc1d0e2031a61065601879c690a535d84cb7..3d400f495c41e543544b482b07d49cdd7fdcc85b 100755 --- a/tools/oneclick/prestudy/YAML/args_documentation.py +++ b/tools/oneclick/prestudy/YAML/args_documentation.py @@ -34,6 +34,7 @@ import argparse import subprocess import traceback import yaml +import time from subprocess import CalledProcessError from pylatex import Document, Section, Subsection, Command, Package, Tabular, MultiColumn, MultiRow, SmallText, LargeText from pylatex.utils import italic, bold, NoEscape, verbatim, escape_latex @@ -45,27 +46,42 @@ import common as cm def main(): try: for systemname in args.system: - system_filename = "./systems/{}.system.yaml".format(systemname) - config = yaml.load(open(system_filename, "r")) - name = config['system_name'] - documentation = Documentation(name) - system = System(system_filename) - documentation.add(config['system_name'], system) - documentation.generate_pdf() + try: + system_filename = "./systems/{}.system.yaml".format(systemname) + config = yaml.load(open(system_filename, "r")) + name = config['system_name'] + documentation = Documentation(name) + system = System(system_filename) + documentation.add(config['system_name'], system) + documentation.generate_pdf() + del documentation + del system + time.sleep(1.0) + except CalledProcessError: + pass for peripheralname in args.peripheral: - peripheral_filename = "./peripherals/{}.peripheral.yaml".format(peripheralname) - config = yaml.load(open(peripheral_filename, "r")) - name = config['hdl_library_name'] - documentation = Documentation(name) - peripheral = Peripheral(peripheral_filename) - peripheral.eval_peripheral() - documentation.add(config['hdl_library_name'], peripheral) - documentation.generate_pdf() + try: + peripheral_filename = "./peripherals/{}.peripheral.yaml".format(peripheralname) + logger.info("Load peripheral(s) from '%s'", peripheral_filename) + config = yaml.load(open(peripheral_filename, "r")) + name = config['hdl_library_name'] + for peripheral_config in config['peripherals']: + peripheral = Peripheral(peripheral_config) + logger.info(" read peripheral '%s'" % peripheral.component_name()) + peripheral.eval_peripheral() + documentation = Documentation(name) + peripheral.eval_peripheral() + documentation.add(config['hdl_library_name'], peripheral) + documentation.generate_pdf() + del documentation + del system + time.sleep(1.0) + except CalledProcessError: + pass + except IOError: logger.error("config file '{}' does not exist".format(filename)) - except CalledProcessError: - pass class Documentation(object): """ make documentation for system or peripheral(s) @@ -121,7 +137,7 @@ class Documentation(object): def add_peripheral(self, header, data): """ add a peripheral to the document """ - self.add_section(data.get_name(), data.get_description() ) + self.add_section(data.name(), data.get_description() ) def add_system(self, header, data): """ add a system to the document """ @@ -309,7 +325,10 @@ if __name__ == "__main__": parser.add_argument('-p','--peripheral', nargs='*', default=[], help="peripheral names separated by spaces") parser.add_argument('-v','--verbosity', default='INFO', help="verbosity level can be [ERROR | WARNING | INFO | DEBUG]") args = parser.parse_args() - + + if not args.peripheral and not args.system: + parser.print_help() + unit_logger.set_stdout_log_level(args.verbosity) logger.debug("Used arguments: {}".format(args)) diff --git a/tools/oneclick/prestudy/YAML/uniboard_rom_system_info.py b/tools/oneclick/prestudy/YAML/uniboard_rom_system_info.py index 7a533fb612f2ae3b6fd87fc69538e4aaf13a6220..cf81589bb3bde0c2248eec3bb9296c9359b9c27d 100644 --- a/tools/oneclick/prestudy/YAML/uniboard_rom_system_info.py +++ b/tools/oneclick/prestudy/YAML/uniboard_rom_system_info.py @@ -412,7 +412,10 @@ if __name__ == "__main__": parser.add_argument('-q','--qsys', action='store_true', default=False, help="Use start address from QSYS reg file") parser.add_argument('-v','--verbosity', default='INFO', help="verbosity = [INFO | DEBUG]") args = parser.parse_args() - + + if not args.peripheral and not args.system: + parser.print_help() + unit_logger.set_stdout_log_level(args.verbosity) logger.debug("Used arguments: {}".format(args))