Skip to content

Commit f890286

Browse files
mathieuchopstmcfriedt
authored andcommitted
runners: stlink_gdbserver: make it possible to disable SWD mode
The "--swd" argument had both an action='store_true' and default value of True so it wasn't possible to disable it: providing the argument would set its value to True, and not providing it would use the default=True! Add a new argument "--no-swd" which shares its destination variable with "--swd", but with action='store_false', such that either can be provided to enable/disable SWD mode. Both arguments are placed in a mutually exclusive group and use a common help message. Signed-off-by: Mathieu Choplain <[email protected]>
1 parent 0b48196 commit f890286

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

scripts/west_commands/runners/stlink_gdbserver.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,10 @@ def extload_help(cls) -> str:
100100
def do_add_parser(cls, parser: argparse.ArgumentParser):
101101
# Expose a subset of the ST-LINK GDB server arguments
102102
parser.add_argument(
103-
"--swd", action='store_true', default=True, help="Enable SWD debug mode"
103+
"--swd",
104+
default=True,
105+
action=argparse.BooleanOptionalAction,
106+
help="Enable SWD debug mode (default: %(default)s)\nUse --no-swd to disable.",
104107
)
105108
parser.add_argument("--apid", type=int, default=0, help="Target DAP ID")
106109
parser.add_argument(

0 commit comments

Comments
 (0)