target: Only register mrc mcr commands when one of the targets support them.
authorØyvind Harboe <oyvind.harboe@zylin.com>
Sat, 24 Oct 2009 11:24:35 +0000 (13:24 +0200)
committerØyvind Harboe <oyvind.harboe@zylin.com>
Thu, 5 Nov 2009 22:56:37 +0000 (23:56 +0100)
This avoids polluting help for targets that can never support mrc/mcr

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
src/target/target.c

index 55fc2c8237ead31961d1a83aa5583bbcb2e5aeb9..d4662f71176b09b8368a23b970a48ff8496a40f8 100644 (file)
@@ -816,11 +816,22 @@ int target_init(struct command_context_s *cmd_ctx)
                if (target->type->mcr == NULL)
                {
                        target->type->mcr = default_mcr;
+               } else
+               {
+                       /* FIX! multiple targets will generally register global commands
+                        * multiple times. Only register this one if *one* of the
+                        * targets need the command. Hmm... make it a command on the
+                        * Jim Tcl target object?
+                        */
+                       register_jim(cmd_ctx, "mcr", jim_mcrmrc, "write coprocessor <cpnum> <op1> <op2> <CRn> <CRm> <value>");
                }
 
                if (target->type->mrc == NULL)
                {
                        target->type->mrc = default_mrc;
+               } else
+               {
+                       register_jim(cmd_ctx, "mrc", jim_mcrmrc, "read coprocessor <cpnum> <op1> <op2> <CRn> <CRm>");
                }
 
 
@@ -1660,9 +1671,6 @@ int target_register_user_commands(struct command_context_s *cmd_ctx)
        register_jim(cmd_ctx, "ocd_mem2array", jim_mem2array, "read memory and return as a TCL array for script processing <ARRAYNAME> <WIDTH = 32/16/8> <ADDRESS> <COUNT>");
        register_jim(cmd_ctx, "ocd_array2mem", jim_array2mem, "convert a TCL array to memory locations and write the values  <ARRAYNAME> <WIDTH = 32/16/8> <ADDRESS> <COUNT>");
 
-       register_jim(cmd_ctx, "mrc", jim_mcrmrc, "read coprocessor <cpnum> <op1> <op2> <CRn> <CRm>");
-       register_jim(cmd_ctx, "mcr", jim_mcrmrc, "write coprocessor <cpnum> <op1> <op2> <CRn> <CRm> <value>");
-
        register_command(cmd_ctx, NULL, "fast_load_image", handle_fast_load_image_command, COMMAND_ANY,
                        "same args as load_image, image stored in memory - mainly for profiling purposes");
 

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)