Lines Matching +full:serial +full:- +full:port
4 # SPDX-License-Identifier: Apache-2.0
6 '''bossac-specific runner (flash only) for Atmel SAM microcontrollers.'''
25 '''Runner front-end for bossac.'''
27 def __init__(self, cfg, bossac='bossac', port=DEFAULT_BOSSAC_PORT, argument
31 self.port = port
46 parser.add_argument('--bossac', default='bossac',
48 parser.add_argument('--bossac-port', default=DEFAULT_BOSSAC_PORT,
49 help='serial port to use, default is ' +
51 parser.add_argument('--speed', default=DEFAULT_BOSSAC_SPEED,
52 help='serial port speed to use, default is ' +
54 parser.add_argument('--delay', default=0, type=float,
63 port=args.bossac_port, speed=args.speed,
67 """Run bossac --help and return the output as a list of lines"""
71 out = self.check_output([self.bossac, '--help']).decode()
92 # Get the EDT Node corresponding to the zephyr,code-partition
113 return edt.chosen_node('zephyr,code-partition')
138 ' --offset flag. Please upgrade to a newer Zephyr' \
149 ['stty', '--version'], capture_output=True, text=True, check=True
160 flag = '-F' if self.is_gnu_coreutils_stty() else '-f'
165 cmd_stty = ['stty', flag, self.port, 'raw', 'ispeed', self.speed,
166 'ospeed', self.speed, 'cs8', '-cstopb', 'ignpar',
184 cmd_flash = [self.bossac, '-p', self.port, '-R', '-w', '-v',
185 '-b', self.cfg.bin_file]
188 cmd_flash += ['-e']
194 error_msg = 'The device tree zephyr,code-partition chosen' \
199 offset = self.get_image_offset(self.supports('--offset'))
202 cmd_flash += ['-o', str(offset)]
208 ' zephyr,code-partition device tree node should not' \
209 ' be defined. Check Zephyr SAM-BA documentation.'
217 Get a list of candidate serial ports on Darwin by querying the IOKit
222 ioreg_out = self.check_output(['ioreg', '-r', '-c', 'IOSerialBSDClient',
223 '-k', 'IOCalloutDevice', '-a'])
226 return [port["IOCalloutDevice"] for port in serial_ports]
230 Ask the user to select the serial port from a set of candidate ports
238 raise RuntimeError('No candidate serial ports were found!')
240 print('Using only serial device on the system: ' + devices[0])
243 raise RuntimeError('Refusing to guess which serial port to use: '
246 'input is not a terminal - please specify a '
247 'port using --bossac-port instead)')
249 print('There are multiple serial ports available on this system:')
254 p = f'Please select one (1-{len(devices)}, or EOF to exit): '
268 return devices[value - 1]
277 elif platform.system() == 'Darwin' and self.port is None:
278 self.port = self.get_darwin_user_port_choice()