]> git.sur5r.net Git - openocd/commitdiff
ARMv7M: add arm cmd group
authorSpencer Oliver <ntfreak@users.sourceforge.net>
Fri, 26 Feb 2010 23:14:51 +0000 (23:14 +0000)
committerSpencer Oliver <ntfreak@users.sourceforge.net>
Sun, 28 Feb 2010 22:47:51 +0000 (22:47 +0000)
- Add arm cmd group to armv7m cmd chain.
 - arm cmd's now check the core type before running a cmd.
 - todo: add support for armv7m registers for reg cmd.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
src/target/armv4_5.c
src/target/armv7m.c

index a4a15b40df695b4b64767d45d7d38ce207ccced3..36101b0208a6ebcc71d10852bc77b96638029f38 100644 (file)
@@ -627,6 +627,12 @@ COMMAND_HANDLER(handle_armv4_5_reg_command)
                return ERROR_FAIL;
        }
 
+       if (armv4_5->core_type != ARM_MODE_ANY)
+       {
+               command_print(CMD_CTX, "Microcontroller Profile not supported - use standard reg cmd");
+               return ERROR_OK;
+       }
+
        if (!is_arm_mode(armv4_5->core_mode))
                return ERROR_FAIL;
 
@@ -706,6 +712,13 @@ COMMAND_HANDLER(handle_armv4_5_core_state_command)
                return ERROR_FAIL;
        }
 
+       if (armv4_5->core_type == ARM_MODE_THREAD)
+       {
+               /* armv7m not supported */
+               command_print(CMD_CTX, "Unsupported Command");
+               return ERROR_OK;
+       }
+
        if (CMD_ARGC > 0)
        {
                if (strcmp(CMD_ARGV[0], "arm") == 0)
@@ -723,7 +736,7 @@ COMMAND_HANDLER(handle_armv4_5_core_state_command)
        return ERROR_OK;
 }
 
-COMMAND_HANDLER(handle_armv4_5_disassemble_command)
+COMMAND_HANDLER(handle_arm_disassemble_command)
 {
        int retval = ERROR_OK;
        struct target *target = get_current_target(CMD_CTX);
@@ -737,6 +750,12 @@ COMMAND_HANDLER(handle_armv4_5_disassemble_command)
                return ERROR_FAIL;
        }
 
+       if (arm->core_type == ARM_MODE_THREAD)
+       {
+               /* armv7m is always thumb mode */
+               thumb = 1;
+       }
+
        switch (CMD_ARGC) {
        case 3:
                if (strcmp(CMD_ARGV[2], "thumb") != 0)
@@ -821,6 +840,13 @@ static int jim_mcrmrc(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
                return JIM_ERR;
        }
 
+       if (arm->core_type == ARM_MODE_THREAD)
+       {
+               /* armv7m not supported */
+               LOG_ERROR("Unsupported Command");
+               return ERROR_OK;
+       }
+
        if ((argc < 6) || (argc > 7)) {
                /* FIXME use the command name to verify # params... */
                LOG_ERROR("%s: wrong number of arguments", __func__);
@@ -941,7 +967,7 @@ static const struct command_registration arm_exec_command_handlers[] = {
        },
        {
                .name = "disassemble",
-               .handler = handle_armv4_5_disassemble_command,
+               .handler = handle_arm_disassemble_command,
                .mode = COMMAND_EXEC,
                .usage = "address [count ['thumb']]",
                .help = "disassemble instructions ",
index 056ac7b2d066a411f6048a595d7f848ca5a55276..ec111760d5dd4e6f6914ebcd381b7005a5f68cbf 100644 (file)
@@ -877,6 +877,9 @@ static const struct command_registration armv7m_exec_command_handlers[] = {
        COMMAND_REGISTRATION_DONE
 };
 const struct command_registration armv7m_command_handlers[] = {
+       {
+               .chain = arm_command_handlers,
+       },
        {
                .name = "dap",
                .mode = COMMAND_EXEC,