This is an automated email from Gerrit.

"Evgeniy Naydanov <evgeniy.nayda...@syntacore.com>" just uploaded a new patch 
set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/8860

-- gerrit

commit 4aae9356e4f041c537b856c5d99b0a04deebe684
Author: Evgeniy Naydanov <evgeniy.nayda...@syntacore.com>
Date:   Mon Apr 28 16:46:08 2025 +0300

    target: improve error messaging in `target create`
    
    There are a couple of issues with the usage string for `target create`,
    namely:
    * `-chain-position` is allowed to be not the first option.
    * `-chain-position` should be ommited alltogether on ARM targets when
      DAP is specified.
    
    Before the patch:
    ```
    > openocd -c 'target create name testee'
    ...
      target create name type '-chain-position' name [options ...]
    ```
    
    After the patch:
    ```
    > openocd -c 'target create name testee'
    ...
    -chain-position ?name? required when creating target
    > openocd -c 'target create'
    ...
      target create name type [options ...]
    ```
    
    Change-Id: Ia21a99ce6a4086e2e0676f5ef4685da3514a4f69
    Signed-off-by: Evgeniy Naydanov <evgeniy.nayda...@syntacore.com>

diff --git a/src/target/target.c b/src/target/target.c
index 40c8d3ed36..791da4b05e 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -5711,7 +5711,7 @@ COMMAND_HANDLER(handle_target_create)
        int retval = ERROR_OK;
        int x;
 
-       if (CMD_ARGC < 4)
+       if (CMD_ARGC < 2)
                return ERROR_COMMAND_SYNTAX_ERROR;
 
        /* check if the target name clashes with an existing command name */
@@ -6056,7 +6056,7 @@ static const struct command_registration 
target_subcommand_handlers[] = {
                .name = "create",
                .mode = COMMAND_CONFIG,
                .handler = handle_target_create,
-               .usage = "name type '-chain-position' name [options ...]",
+               .usage = "name type [options ...]",
                .help = "Creates and selects a new target",
        },
        {

-- 

Reply via email to