target/arm: do not expose 'arm reg', 'arm mcr/mrc' commands on Cortex-M 01/7101/2
authorTomas Vanek <vanekt@fbl.cz>
Mon, 1 Aug 2022 17:28:18 +0000 (19:28 +0200)
committerTomas Vanek <vanekt@fbl.cz>
Sun, 14 Aug 2022 14:43:48 +0000 (14:43 +0000)
Tcl commands 'arm reg', 'arm mcr/mrc' do not work on M-profile based devices.
Isolate them from 'arm core_state' and 'arm disassemble' and do not chain
them from armv7m_command_handlers.

Change-Id: I2c6befdf82575e95cf05ed158ab5e6faa1a182c3
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7101
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
src/target/arm.h
src/target/armv4_5.c
src/target/armv7m.c

index f262255ab353668e63483ae29e354066131cb21e..bcfa85c79c948cd522a922ea44b09ffec5c7eee2 100644 (file)
@@ -273,6 +273,7 @@ void arm_free_reg_cache(struct arm *arm);
 struct reg_cache *armv8_build_reg_cache(struct target *target);
 
 extern const struct command_registration arm_command_handlers[];
+extern const struct command_registration arm_all_profiles_command_handlers[];
 
 int arm_arch_state(struct target *target);
 const char *arm_get_gdb_arch(struct target *target);
index 09cf143e65858be82bb67922dfa6452bbb9ee972..321772699bdd710a169fd04f5e46c195b4d3f24e 100644 (file)
@@ -1125,20 +1125,6 @@ static const struct command_registration arm_exec_command_handlers[] = {
                .help = "display ARM core registers",
                .usage = "",
        },
-       {
-               .name = "core_state",
-               .handler = handle_arm_core_state_command,
-               .mode = COMMAND_EXEC,
-               .usage = "['arm'|'thumb']",
-               .help = "display/change ARM core state",
-       },
-       {
-               .name = "disassemble",
-               .handler = handle_arm_disassemble_command,
-               .mode = COMMAND_EXEC,
-               .usage = "address [count ['thumb']]",
-               .help = "disassemble instructions",
-       },
        {
                .name = "mcr",
                .mode = COMMAND_EXEC,
@@ -1153,11 +1139,33 @@ static const struct command_registration arm_exec_command_handlers[] = {
                .help = "read coprocessor register",
                .usage = "cpnum op1 CRn CRm op2",
        },
+       {
+               .chain = arm_all_profiles_command_handlers,
+       },
+       COMMAND_REGISTRATION_DONE
+};
+
+const struct command_registration arm_all_profiles_command_handlers[] = {
+       {
+               .name = "core_state",
+               .handler = handle_arm_core_state_command,
+               .mode = COMMAND_EXEC,
+               .usage = "['arm'|'thumb']",
+               .help = "display/change ARM core state",
+       },
+       {
+               .name = "disassemble",
+               .handler = handle_arm_disassemble_command,
+               .mode = COMMAND_EXEC,
+               .usage = "address [count ['thumb']]",
+               .help = "disassemble instructions",
+       },
        {
                .chain = semihosting_common_handlers,
        },
        COMMAND_REGISTRATION_DONE
 };
+
 const struct command_registration arm_command_handlers[] = {
        {
                .name = "arm",
index 790e70e63d506ab00773fde924e30f9db7f6d1a9..be0de509b79d10cc5cbe52a30b15877ce4f6dd94 100644 (file)
@@ -1085,7 +1085,11 @@ int armv7m_maybe_skip_bkpt_inst(struct target *target, bool *inst_found)
 
 const struct command_registration armv7m_command_handlers[] = {
        {
-               .chain = arm_command_handlers,
+               .name = "arm",
+               .mode = COMMAND_ANY,
+               .help = "ARM command group",
+               .usage = "",
+               .chain = arm_all_profiles_command_handlers,
        },
        COMMAND_REGISTRATION_DONE
 };

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)