diff --git a/scripts/pylib/twister/twisterlib/environment.py b/scripts/pylib/twister/twisterlib/environment.py index 4fb0fbb8ffe..cbc36e12ff8 100644 --- a/scripts/pylib/twister/twisterlib/environment.py +++ b/scripts/pylib/twister/twisterlib/environment.py @@ -222,6 +222,7 @@ Artificially long but functional example: help="""Flash device before attaching to serial port. This is useful for devices that share the same port for programming and serial console, or use soft-USB, where flash must come first. + Also, it skips reading remaining logs from the old image run. """) test_or_build.add_argument( @@ -971,10 +972,6 @@ def parse_arguments( logger.error("--device-flash-with-test does not apply when --flash-before is used") sys.exit(1) - if options.flash_before and options.device_serial_pty: - logger.error("--device-serial-pty cannot be used when --flash-before is set (for now)") - sys.exit(1) - if options.shuffle_tests and options.subset is None: logger.error("--shuffle-tests requires --subset") sys.exit(1) diff --git a/scripts/pylib/twister/twisterlib/hardwaremap.py b/scripts/pylib/twister/twisterlib/hardwaremap.py index d3308b8cbe3..74c384ab5d6 100644 --- a/scripts/pylib/twister/twisterlib/hardwaremap.py +++ b/scripts/pylib/twister/twisterlib/hardwaremap.py @@ -212,7 +212,7 @@ class HardwareMap: True, flash_timeout=self.options.device_flash_timeout, flash_with_test=self.options.device_flash_with_test, - flash_before=False, + flash_before=self.options.flash_before, ) # the fixtures given by twister command explicitly should be assigned to each DUT @@ -275,7 +275,7 @@ class HardwareMap: serial_pty = dut.get('serial_pty') flash_before = dut.get('flash_before') if flash_before is None: - flash_before = self.options.flash_before and (not (flash_with_test or serial_pty)) + flash_before = self.options.flash_before and (not flash_with_test) platform = dut.get('platform') if isinstance(platform, str): platforms = platform.split()