This is an automated email from Gerrit.

Paul Fertser (fercer...@gmail.com) just uploaded a new patch set to Gerrit, 
which you can find at http://openocd.zylin.com/2534

-- gerrit

commit 8b425daee7f219a4f7584c4ff8f62544b9c38ac4
Author: Paul Fertser <fercer...@gmail.com>
Date:   Fri Feb 6 22:19:41 2015 +0300

    target/cortex_a: add command to optionally force APB-AP access
    
    Change-Id: If41bae0859e9b55c035b6ae6b30a30bf8817297e
    Signed-off-by: Paul Fertser <fercer...@gmail.com>

diff --git a/doc/openocd.texi b/doc/openocd.texi
index 18e18b9..ec0dc34 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -7640,6 +7640,18 @@ the peripherals.
 @xref{targetevents,,Target Events}.
 @end deffn
 
+@subsection Cortex-A specific commands
+@cindex Cortex-A
+
+@deffn Command {cortex_a mem_ap_enable} (@option{0}|@option{1})
+This command can be used to override the memory access type.
+
+If the target has AHB-AP (aka MEM-AP) then OpenOCD will use it by
+default for all memory accesses. This option enables forcing APB-AP
+access instead and can be used as a workaround for bugs in AHB-AP code
+or for testing purposes.
+@end deffn
+
 @section Intel Architecture
 
 Intel Quark X10xx is the first product in the Quark family of SoCs. It is an 
IA-32
diff --git a/src/target/cortex_a.c b/src/target/cortex_a.c
index 6e0e52c..da9e08f 100644
--- a/src/target/cortex_a.c
+++ b/src/target/cortex_a.c
@@ -2770,6 +2770,30 @@ COMMAND_HANDLER(cortex_a_handle_smp_gdb_command)
        return ERROR_OK;
 }
 
+COMMAND_HANDLER(cortex_a_handle_mem_ap_enable_command)
+{
+       struct target *target = get_current_target(CMD_CTX);
+       struct armv7a_common *armv7a = target_to_armv7a(target);
+
+       if (CMD_ARGC == 1) {
+               int enable;
+               COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], enable);
+
+               if (enable) {
+                       int retval = dap_find_ap(armv7a->arm.dap, 
AP_TYPE_AHB_AP, &armv7a->memory_ap);
+                       if (retval != ERROR_OK) {
+                               LOG_ERROR("AHB-AP not found, can't enable");
+                               return ERROR_FAIL;
+                       }
+               }
+
+               armv7a->memory_ap_available = !!enable;
+
+               return ERROR_OK;
+       }
+       return ERROR_COMMAND_SYNTAX_ERROR;
+}
+
 static const struct command_registration cortex_a_exec_command_handlers[] = {
        {
                .name = "cache_info",
@@ -2804,6 +2828,13 @@ static const struct command_registration 
cortex_a_exec_command_handlers[] = {
                .help = "display/fix current core played to gdb",
                .usage = "",
        },
+       {
+               .name = "mem_ap_enable",
+               .handler = cortex_a_handle_mem_ap_enable_command,
+               .mode = COMMAND_EXEC,
+               .help = "force enable or disable memory access via AHB",
+               .usage = "mem_ap_enable (1|0)",
+       },
 
 
        COMMAND_REGISTRATION_DONE

-- 

------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to