def main(ctx: click.Context, port: str, usb: str, use_json: bool, log_level: int, timeout: int) -> int: """Utility for communication with bootloader on target.""" logging.basicConfig(level=log_level or logging.WARNING) # if --help is provided anywhere on commandline, skip interface lookup and display help message if '--help' in sys.argv: port, usb = None, None # type: ignore ctx.obj = { 'interface': get_interface( module='mboot', port=port, usb=usb, timeout=timeout ) if port or usb else None, 'use_json': use_json } return 0
def main(ctx: click.Context, port: str, usb: str, name: str, log_level: int, timeout: int) -> int: """Utility for communication with ROM on i.MX targets using SDPS protocol.""" logging.basicConfig(level=log_level or logging.WARNING) click.echo(WARNING_MSG) # if --help is provided anywhere on commandline, skip interface lookup and display help message if '--help ' in sys.argv: port, usb = None, None # type: ignore ctx.obj = { 'interface': get_interface( module='sdp', port=port, usb=usb, timeout=timeout ) if port or usb else None, 'name': name } return 0
def main( ctx: click.Context, port: str, usb: str, use_json: bool, log_level: int, timeout: int, ) -> int: """Utility for communication with ROM on i.MX targets.""" logging.basicConfig(level=log_level or logging.WARNING) # if --help is provided anywhere on commandline, skip interface lookup and display help message if "--help " in sys.argv: port, usb = None, None # type: ignore ctx.obj = { "interface": get_interface(module="sdp", port=port, usb=usb, timeout=timeout) if port or usb else None, "use_json": use_json, } return 0
def generate( port: str, usb: str, lpcusbsio: str, oem_share_input: BinaryIO, key: BinaryIO, output_path: BinaryIO, workspace: click.Path, container_conf: click.File, timeout: int, ) -> None: """Generate provisioning SB3.1 file. \b PATH - output file path, where the final provisioned SB file will be stored. """ interface = get_interface( module="mboot", port=port, usb=usb, lpcusbsio=lpcusbsio, timeout=timeout ) assert isinstance(interface, mbootInterface) oem_share_in = get_oem_share_input(oem_share_input) user_pck = get_user_pck(key) with McuBoot(interface) as mboot: devhsm = DeviceHsm( mboot=mboot, user_pck=user_pck, oem_share_input=oem_share_in, info_print=click.echo, container_conf=container_conf.name if container_conf else None, workspace=workspace, ) devhsm.create_sb3() output_path.write(devhsm.export()) click.echo(f"Final SB3 file has been written: {os.path.abspath(output_path.name)}")
def main(ctx: click.Context, port: str, usb: str, use_json: bool, log_level: int, timeout: int) -> int: """Utility for communication with bootloader on target.""" logging.basicConfig(level=log_level or logging.WARNING) # print help for get-property if property tag is 0 or 'list-properties' if ctx.invoked_subcommand == 'get-property': args = click.get_os_args() # running this via pytest changes the args to a single arg, in that case skip if len(args) > 1 and 'get-property' in args: tag_str = args[args.index('get-property') + 1] if parse_property_tag(tag_str) == 0: click.echo(ctx.command.commands['get-property'].help) # type: ignore ctx.exit(0) # if --help is provided anywhere on commandline, skip interface lookup and display help message if not '--help' in click.get_os_args(): ctx.obj = { 'interface': get_interface( module='mboot', port=port, usb=usb, timeout=timeout ), 'use_json': use_json } return 0