예제 #1
0
파일: gen_lfs.py 프로젝트: dilawar/gap_sdk
def main(custom_commandline=None, config=None, partition_config=None):
    """
	Main function for build Flash image

	custom_commandline - Optional override for default arguments parsing (that uses sys.argv), can be a list of custom arguments
	as strings. Arguments and their values need to be added as individual items to the list e.g. "-b 115200" thus
	becomes ['-b', '115200'].
	"""
    parser = argparse.ArgumentParser(
        description='Build a Gap flash image from binary files - v%s' %
        __version__,
        prog='build_flash_image',
        fromfile_prefix_chars='@')

    common.appendCommonOptions(parser)
    appendArgs(parser, partition_config)

    argcomplete.autocomplete(parser)

    # If no argument has been passed and a config has been passed, force arg_parse to not take arguments from sys.argv
    # as this would parse arguments for the calling script
    if custom_commandline is None and (config is not None
                                       or flash_config is not None):
        custom_commandline = []

    args = parser.parse_args(custom_commandline)

    try:
        operationFunc(args, config=partition_config)
    finally:
        try:  # Clean up AddrFilenamePairAction files
            for address, argfile in args.addr_filename:
                argfile.close()
        except AttributeError:
            pass
예제 #2
0
def main(custom_commandline=None):
    """Main function for elf2bin.
    
custom_commandline - Optional override for default arguments parsing (that uses sys.argv), can be a list of custom arguments
    as strings.Arguments and their values need to be added as individual items to the list e.g."-b 115200" thus
    becomes['-b', '115200'].
    """

    parser = argparse.ArgumentParser(
        description=
        'Convert GAP ELF App to a binary used by SSBL to load app. - v%s' %
        __version__,
        prog='elf2bin',
        fromfile_prefix_chars='@',
        formatter_class=argparse.ArgumentDefaultsHelpFormatter)

    common.appendCommonOptions(parser)

    appendArgs(parser)

    argcomplete.autocomplete(parser)
    args = parser.parse_args(custom_commandline)

    try:
        operationFunc(args)
    finally:
        try:  # Clean up AddrFilenamePairAction files
            for address, argfile in args.addr_filename:
                argfile.close()
        except AttributeError:
            pass
예제 #3
0
def main(custom_commandline=None, config=None):
    """
    Main function for run platform.

    custom_commandline - Optional override for default arguments parsing (that uses sys.argv), can be a list of custom arguments
    as strings.Arguments and their values need to be added as individual items to the list e.g."-b 115200" thus
    becomes['-b', '115200'].
    """

    parser = argparse.ArgumentParser(
        description='Run a specific platform - v%s' % __version__,
        prog='run',
        fromfile_prefix_chars='@',
        formatter_class=argparse.ArgumentDefaultsHelpFormatter)

    common.appendCommonOptions(parser)

    system = None
    if config is None:
        (config, system) = common.importConfig(parser)

    flashConfig = config.get(config.get_str("runner/boot/device"))
    appendArgs(parser, flashConfig)

    argcomplete.autocomplete(parser)
    args = parser.parse_args(custom_commandline)

    try:
        operationFunc(args, config, system)
    finally:
        try:  # Clean up AddrFilenamePairAction files
            for address, argfile in args.addr_filename:
                argfile.close()
        except AttributeError:
            pass
예제 #4
0
def main(custom_commandline=None):
    """
	Main
	function
	for build Flash image
	
	custom_commandline - Optional override for default arguments parsing (that uses sys.argv), can be a list of custom arguments
	as strings.Arguments and their values need to be added as individual items to the list e.g."-b 115200" thus
	becomes['-b', '115200'].
	"""

    parser = argparse.ArgumentParser(
        description=
        'Build a Gap flash image from binary files, partition table and partition images - v%s'
        % __version__,
        prog='gen_flash_image',
        fromfile_prefix_chars='@')

    common.appendCommonOptions(parser)
    appendArgs(parser)

    argcomplete.autocomplete(parser)
    args = parser.parse_args(custom_commandline)

    try:
        operationFunc(args)
    finally:
        try:  # Clean up AddrFilenamePairAction files
            for address, argfile in args.addr_filename:
                argfile.close()
        except AttributeError:
            pass
예제 #5
0
def main(custom_commandline = None):
	"""
	Main function for build Flash image

	custom_commandline - Optional override for default arguments parsing (that uses sys.argv), can be a list of custom arguments
	as strings. Arguments and their values need to be added as individual items to the list e.g. "-b 115200" thus
	becomes ['-b', '115200'].
	"""
	
	parser = argparse.ArgumentParser(
		description = 'GAP partition table utility - v%s' % __version__,
		prog = 'gen_partition',
		fromfile_prefix_chars = '@')
	
	common.appendCommonOptions(parser)
	appendArgs(parser)
	
	argcomplete.autocomplete(parser)
	args = parser.parse_args()
	
	operationFunc(args)