def generate_board_and_save(board_name: str, config: Config, path_to_save: str = None, archive: bool = False) -> NoReturn: board = Board(board_name).setup(project_name=config.project_name, mips_type=config.mips_type, flt=config.configs, conf=config.functions_params, func=config.functions).generate() if archive: _ = board.archive(path=path_to_save) else: _ = board.dump(path=path_to_save)
sys.path.append(os.getcwd()) if __name__ == "__main__": # It's possible specify project name as first script's positional argument. project_name = None if len(sys.argv) < 2 else sys.argv[1] model = BOARDS[0] # Common 'engine' usage scenario (lifecycle). # This uses default parameters for all configurable values. board = Board(model) # 0 : initializing _ = board.setup(project_name=project_name) # 1 : configuring _ = board.generate() # 2 : generating project files _ = board.dump() # 3.1 : output as project (directory with files) _ = board.archive() # 3.2 : output as archive (packed project) _ = board.reset() # 4 : reload board configuration from static file # Generated content of project files can also be found # in 'configs' property of Board instance. # The same can also be performed as a chain of methods calls # (or even just as a sinle line of code). board = (Board(model) .setup(project_name=project_name) .generate() .dump() .archive() .reset()) # It's possible to setup which hardware to include in a project