def get_binary_and_program(): file_ext = os.path.splitext(config.Arguments.program_file)[1] if file_ext: if file_ext == ".c": if not distutils.spawn.find_executable(config.Arguments.GCC): debug.exit_message("Unable to find arm GCC cross compiler '%s' on your path" % config.Arguments.GCC) if not distutils.spawn.find_executable(config.Arguments.objdump): debug.exit_message( "Unable to find arm GCC object dump facility '%s' on your path" % config.Arguments.objdump ) if not config.Arguments.root: debug.exit_message("To compile and analyse a C file, you must supply a root function via -r.") binary = compile_program(config.Arguments.program_file) disassembly = disassemble_program(binary) program = arm.Disassembler(disassembly, config.Arguments.root).program program_input_output.write_disassembled_program_to_file(program, disassembly) return binary, program else: debug.exit_message( "Unable to compile '%s' because its extension is not '%s'" % (config.Arguments.program_file, ".c") ) else: binary = config.Arguments.program_file config.Arguments.program_file = binary + ".txt" if not os.access(binary, os.X_OK): debug.exit_message("The argument '%s' does not have execute permissions" % binary) if not os.path.exists(config.Arguments.program_file): debug.exit_message( "Expected to find file with program information in '%s' but it is not there" % config.Arguments.program_file ) program = program_input_output.read_file(config.Arguments.program_file) return binary, program
def get_binary_and_program(): file_ext = os.path.splitext(config.Arguments.program_file)[1] if file_ext: if file_ext == '.c': if not distutils.spawn.find_executable(config.Arguments.GCC): debug.exit_message( "Unable to find arm GCC cross compiler '%s' on your path" % config.Arguments.GCC) if not distutils.spawn.find_executable(config.Arguments.objdump): debug.exit_message( "Unable to find arm GCC object dump facility '%s' on your path" % config.Arguments.objdump) if not config.Arguments.root: debug.exit_message( "To compile and analyse a C file, you must supply a root function via -r." ) binary = compile_program(config.Arguments.program_file) disassembly = disassemble_program(binary) program = arm.Disassembler(disassembly, config.Arguments.root).program program_input_output.write_disassembled_program_to_file( program, disassembly) return binary, program else: debug.exit_message( "Unable to compile '%s' because its extension is not '%s'" % (config.Arguments.program_file, '.c')) else: binary = config.Arguments.program_file config.Arguments.program_file = binary + ".txt" if not os.access(binary, os.X_OK): debug.exit_message( "The argument '%s' does not have execute permissions" % binary) if not os.path.exists(config.Arguments.program_file): debug.exit_message( "Expected to find file with program information in '%s' but it is not there" % config.Arguments.program_file) program = program_input_output.read_file(config.Arguments.program_file) return binary, program
parser.add_argument("-v", "--verbose", action="store_true", help="be verbose", default=False) parser.parse_args(namespace=config.Arguments) if not (config.Arguments.ilp or config.Arguments.clp or config.Arguments.region_based or config.Arguments.region_based_super_block_CFG): debug.exit_message( "You must calculate specify how to calculate a WCET estimate with one or more of the following: %s" % ','.join(all_calculations)) config.Arguments.basename = os.path.splitext( os.path.basename(config.Arguments.program_file))[0] config.Arguments.basepath = os.path.abspath( os.path.dirname(config.Arguments.program_file)) if __name__ == "__main__": threading.stack_size(67108864) # 64MB stack sys.setrecursionlimit(2**20) the_command_line() data, program = program_input_output.read_file( config.Arguments.program_file) program.do_wcet_calculation(data) program.print_results()
choices=["vertices", "edges", "mixed"], required=True, help="instrument vertices, edges or both") parser.add_argument("--profile", choices=["vertices", "edges", "all", "choose"], required=True, help="instrument to profile all vertices, all edges, all vertices and edges or a choice of vertices and edges") parser.add_argument("-u", "--udraw", action="store_true", help="generate uDraw files to visualise graphs", default=False) parser.add_argument("-v", "--verbose", action="store_true", help="be verbose", default=False) parser.parse_args(namespace=config.Arguments) config.Arguments.basename = os.path.splitext(os.path.basename(config.Arguments.program_file))[0] config.Arguments.basepath = os.path.abspath(os.path.dirname(config.Arguments.program_file)) if __name__ == "__main__": the_command_line() program = program_input_output.read_file(config.Arguments.program_file) instrument_cfgs(program)