This is an automated email from Gerrit.

Patrick Stewart ([email protected]) just uploaded a new patch set to Gerrit, 
which you can find at http://openocd.zylin.com/2985

-- gerrit

commit fc4276dbcab7d348a7f87c189526ada34d72a852
Author: Patrick Stewart <[email protected]>
Date:   Mon Sep 28 13:54:02 2015 +0100

    cortex_m: Add command to select AP
    
    Adds a new 'cortex_m access_port x' command to select the AP the target 
core is connected to
    
    Change-Id: I9e5d600609c2197c3b86b5336a23915a67c3a6db
    Signed-off-by: Patrick Stewart <[email protected]>

diff --git a/src/target/cortex_m.c b/src/target/cortex_m.c
index 89dc913..85aab42 100644
--- a/src/target/cortex_m.c
+++ b/src/target/cortex_m.c
@@ -2323,6 +2323,36 @@ COMMAND_HANDLER(handle_cortex_m_reset_config_command)
        return ERROR_OK;
 }
 
+COMMAND_HANDLER(handle_cortex_m_access_port_command)
+{
+       struct target *target = get_current_target(CMD_CTX);
+       struct cortex_m_common *cortex_m = target_to_cm(target);
+       int retval;
+       uint32_t apsel;
+
+       retval = cortex_m_verify_pointer(CMD_CTX, cortex_m);
+       if (retval != ERROR_OK)
+               return retval;
+
+       switch (CMD_ARGC) {
+       case 0:
+               apsel = cortex_m->armv7m.debug_ap;
+               break;
+       case 1:
+               COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], apsel);
+               if (apsel >= 256)
+                       return ERROR_COMMAND_SYNTAX_ERROR;
+               cortex_m->armv7m.debug_ap = apsel;
+               break;
+       default:
+               return ERROR_COMMAND_SYNTAX_ERROR;
+       }
+
+       command_print(CMD_CTX, "ap %" PRIi32 " selected", apsel);
+
+       return ERROR_OK;
+}
+
 static const struct command_registration cortex_m_exec_command_handlers[] = {
        {
                .name = "maskisr",
@@ -2345,6 +2375,13 @@ static const struct command_registration 
cortex_m_exec_command_handlers[] = {
                .help = "configure software reset handling",
                .usage = "['srst'|'sysresetreq'|'vectreset']",
        },
+       {
+               .name = "access_port",
+               .handler = handle_cortex_m_access_port_command,
+               .mode = COMMAND_ANY,
+               .help = "set the AP",
+               .usage = "ap_number",
+       },
        COMMAND_REGISTRATION_DONE
 };
 static const struct command_registration cortex_m_command_handlers[] = {

-- 

------------------------------------------------------------------------------
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to