summaryrefslogtreecommitdiff
path: root/src/target/target.c
diff options
context:
space:
mode:
authorØyvind Harboe <oyvind.harboe@zylin.com>2009-10-24 13:24:35 +0200
committerØyvind Harboe <oyvind.harboe@zylin.com>2009-11-05 23:56:37 +0100
commitb64503e37f1080b8d78cc9303363179ae8e38269 (patch)
treef7e7b1e255125544f68ccd7316b8ce1ec900e7f6 /src/target/target.c
parent1ebdc244941c02503fc042e538991d617157184f (diff)
downloadopenocd_libswd-b64503e37f1080b8d78cc9303363179ae8e38269.tar.gz
openocd_libswd-b64503e37f1080b8d78cc9303363179ae8e38269.tar.bz2
openocd_libswd-b64503e37f1080b8d78cc9303363179ae8e38269.tar.xz
openocd_libswd-b64503e37f1080b8d78cc9303363179ae8e38269.zip
target: Only register mrc mcr commands when one of the targets support them.
This avoids polluting help for targets that can never support mrc/mcr Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Diffstat (limited to 'src/target/target.c')
-rw-r--r--src/target/target.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/target/target.c b/src/target/target.c
index 55fc2c82..d4662f71 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -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");