twister: Allow baud rates other than 115200
Fixes #38046 Document the changes in twister.rst Add baud rate to debug message in twister Add baud parameter to twister's add_device function Set the twister baud rate from input parameters Use 115200 as the default baud rate if not specified Add baud to the hwmap-schema.yaml file Add --device-serial-baud to twister arguments Fix compliance issues Fix mistake in parameter name from device-baud to device-serial-baud Refactoring of the code in orded to simplify the logic and clear multiple definitions of the default baud rate. Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no> Signed-off-by: Dennis Ruffer <daruffer@gmail.com>
This commit is contained in:
parent
18f26b843c
commit
c714c78743
4 changed files with 37 additions and 14 deletions
|
@ -733,7 +733,7 @@ class DeviceHandler(Handler):
|
|||
else:
|
||||
serial_device = hardware.serial
|
||||
|
||||
logger.debug("Using serial device {}".format(serial_device))
|
||||
logger.debug("Using serial device {} @ {} baud".format(serial_device, hardware.serial_baud))
|
||||
|
||||
if (self.suite.west_flash is not None) or runner:
|
||||
command = ["west", "flash", "--skip-rebuild", "-d", self.build_dir]
|
||||
|
@ -790,7 +790,7 @@ class DeviceHandler(Handler):
|
|||
try:
|
||||
ser = serial.Serial(
|
||||
serial_device,
|
||||
baudrate=115200,
|
||||
baudrate=hardware.serial_baud,
|
||||
parity=serial.PARITY_NONE,
|
||||
stopbits=serial.STOPBITS_ONE,
|
||||
bytesize=serial.EIGHTBITS,
|
||||
|
@ -3926,10 +3926,12 @@ class Gcovr(CoverageTool):
|
|||
["-o", os.path.join(subdir, "index.html")],
|
||||
stdout=coveragelog)
|
||||
|
||||
|
||||
class DUT(object):
|
||||
def __init__(self,
|
||||
id=None,
|
||||
serial=None,
|
||||
serial_baud=None,
|
||||
platform=None,
|
||||
product=None,
|
||||
serial_pty=None,
|
||||
|
@ -3940,6 +3942,9 @@ class DUT(object):
|
|||
runner=None):
|
||||
|
||||
self.serial = serial
|
||||
self.serial_baud = 115200
|
||||
if serial_baud:
|
||||
self.serial_baud = serial_baud
|
||||
self.platform = platform
|
||||
self.serial_pty = serial_pty
|
||||
self._counter = Value("i", 0)
|
||||
|
@ -4031,8 +4036,8 @@ class HardwareMap:
|
|||
self.detected = []
|
||||
self.duts = []
|
||||
|
||||
def add_device(self, serial, platform, pre_script, is_pty):
|
||||
device = DUT(platform=platform, connected=True, pre_script=pre_script)
|
||||
def add_device(self, serial, platform, pre_script, is_pty, baud=None):
|
||||
device = DUT(platform=platform, connected=True, pre_script=pre_script, serial_baud=baud)
|
||||
|
||||
if is_pty:
|
||||
device.serial_pty = serial
|
||||
|
@ -4052,6 +4057,7 @@ class HardwareMap:
|
|||
id = dut.get('id')
|
||||
runner = dut.get('runner')
|
||||
serial = dut.get('serial')
|
||||
baud = dut.get('baud', None)
|
||||
product = dut.get('product')
|
||||
fixtures = dut.get('fixtures', [])
|
||||
new_dut = DUT(platform=platform,
|
||||
|
@ -4059,6 +4065,7 @@ class HardwareMap:
|
|||
runner=runner,
|
||||
id=id,
|
||||
serial=serial,
|
||||
serial_baud=baud,
|
||||
connected=serial is not None,
|
||||
pre_script=pre_script,
|
||||
post_script=post_script,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue