Skip to content

Commit 97f0dfd

Browse files
committed
Add support for upload-only.
The --upload-only parameter lets us target devices that we have only manual SRST and UART control over.
1 parent ef4fd75 commit 97f0dfd

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

scripts/uart-test-exec.py

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,9 @@ def main():
380380
381381
# Custom pin numbers and timeout
382382
./uart-test-exec.py --srst-pin 25 --fwspick-pin 20 --test-timeout 300 /dev/ttyUSB0 firmware.bin
383+
384+
# Upload-only (no GPIO, no monitoring)
385+
./uart-test-exec.py --upload-only /dev/ttyUSB0 firmware.bin
383386
"""
384387
)
385388

@@ -420,13 +423,21 @@ def main():
420423
help="Run silently (no output)")
421424
parser.add_argument("--dry-run", action="store_true",
422425
help="Show what would be done without executing")
423-
426+
# NEW: upload-only mode (no GPIO, no monitoring)
427+
parser.add_argument("--upload-only", action="store_true",
428+
help="Skip all GPIO commands, open UART, upload firmware, then exit")
429+
424430
args = parser.parse_args()
425431

426432
# Validate arguments
427-
if not any([args.manual_srst, args.manual_fwspick, args.sequence, args.uart_device]):
428-
parser.error("Must specify either manual GPIO control, sequence, or UART device")
429-
433+
# NEW: validation for upload-only mode
434+
if args.upload_only:
435+
if not args.uart_device or not args.firmware:
436+
parser.error("--upload-only requires UART device and firmware file")
437+
else:
438+
if not any([args.manual_srst, args.manual_fwspick, args.sequence, args.uart_device]):
439+
parser.error("Must specify either manual GPIO control, sequence, or UART device")
440+
430441
if args.uart_device and not args.skip_uart and not Path(args.uart_device).exists():
431442
parser.error(f"UART device not found: {args.uart_device}")
432443

@@ -443,6 +454,15 @@ def main():
443454
state = "dh" if args.manual_fwspick in ['high', 'dh'] else "dl"
444455
executor.toggle_fwspick(state)
445456
return 0
457+
458+
# NEW: upload-only execution path (no GPIO, no monitoring)
459+
if args.upload_only:
460+
if not executor.open_serial():
461+
return 1
462+
# Directly upload firmware, skip GPIO and waiting/monitoring
463+
ok = executor.upload_firmware()
464+
executor.cleanup()
465+
return 0 if ok else 1
446466

447467
# Handle sequence operations
448468
if args.sequence == 'fwspick-mode':

0 commit comments

Comments
 (0)