This is an automated email from Gerrit.

"Karl Palsson <ka...@tweak.au>" just uploaded a new patch set to Gerrit, which 
you can find at https://review.openocd.org/c/openocd/+/8354

-- gerrit

commit 9675f039a78f658f294f59a96bcec13256ba4bcc
Author: Karl Palsson <karl.pals...@marel.com>
Date:   Tue Jan 16 13:52:56 2024 +0000

    rtt: default the ID to "SEGGER RTT"
    
    Instead of making people type this in all the time, just default to
    "SEGGER RTT" so more things work out of the box.
    
    Change-Id: I147142cf0a755e635d3f66e047be2eb5049cf511
    Signed-off-by: Karl Palsson <karl.pals...@marel.com>

diff --git a/doc/openocd.texi b/doc/openocd.texi
index 53730eafaf..1a76bb80a0 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -9465,11 +9465,12 @@ Channels are exposed via raw TCP/IP connections. One or 
more RTT servers can be
 assigned to each channel to make them accessible to an unlimited number
 of TCP/IP connections.
 
-@deffn {Command} {rtt setup} address size ID
+@deffn {Command} {rtt setup} address size [ID]
 Configure RTT for the currently selected target.
 Once RTT is started, OpenOCD searches for a control block with the
 identifier @var{ID} starting at the memory address @var{address} within the 
next
 @var{size} bytes.
+ID defaults to the string "SEGGER RTT"
 @end deffn
 
 @deffn {Command} {rtt start}
@@ -9512,7 +9513,7 @@ on the target device.
 @example
 resume
 
-rtt setup 0x20000000 2048 "SEGGER RTT"
+rtt setup 0x20000000 2048
 rtt start
 
 rtt server start 9090 0
diff --git a/src/rtt/tcl.c b/src/rtt/tcl.c
index 2b8822fce8..16804f1aea 100644
--- a/src/rtt/tcl.c
+++ b/src/rtt/tcl.c
@@ -19,8 +19,15 @@ COMMAND_HANDLER(handle_rtt_setup_command)
 {
        struct rtt_source source;
 
-       if (CMD_ARGC != 3)
+       const char *DEFAULT_ID = "SEGGER RTT";
+       const char *selected_id;
+       if (CMD_ARGC < 2 || CMD_ARGC > 3)
                return ERROR_COMMAND_SYNTAX_ERROR;
+       if (CMD_ARGC == 2) {
+               selected_id = DEFAULT_ID;
+       } else {
+               selected_id = CMD_ARGV[2];
+       }
 
        source.find_cb = &target_rtt_find_control_block;
        source.read_cb = &target_rtt_read_control_block;
@@ -38,7 +45,7 @@ COMMAND_HANDLER(handle_rtt_setup_command)
 
        rtt_register_source(source, get_current_target(CMD_CTX));
 
-       if (rtt_setup(address, size, CMD_ARGV[2]) != ERROR_OK)
+       if (rtt_setup(address, size, selected_id) != ERROR_OK)
                return ERROR_FAIL;
 
        return ERROR_OK;
@@ -218,7 +225,7 @@ static const struct command_registration 
rtt_subcommand_handlers[] = {
                .handler = handle_rtt_setup_command,
                .mode = COMMAND_ANY,
                .help = "setup RTT",
-               .usage = "<address> <size> <ID>"
+               .usage = "<address> <size> [ID]"
        },
        {
                .name = "start",

-- 

Reply via email to