stlink: add armv7m stlink handling
authorSpencer Oliver <spen@spen-soft.co.uk>
Fri, 11 May 2012 08:39:58 +0000 (09:39 +0100)
committerSpencer Oliver <spen@spen-soft.co.uk>
Mon, 14 May 2012 09:38:59 +0000 (09:38 +0000)
This enables us to better handle some of the low level functions that the
stlink does not support. It also enables us to share a few more of the
standard cortex_m3 functions if necessary.

Change-Id: I7a2c57450122012ec189245d8879d8967913e00e
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/637
Tested-by: jenkins
src/target/arm_adi_v5.c
src/target/armv7m.h
src/target/cortex_m.c
src/target/stm32_stlink.c

index 9a98f61d5652bde9925fb5e726128f85123e11b5..fd3a92ce3f45c0a3946bff69dfc3241eb16b8e0f 100644 (file)
@@ -1096,14 +1096,6 @@ int ahbap_debugport_init(struct adiv5_dap *dap)
 
        LOG_DEBUG(" ");
 
-       /* test for initialized low level jtag hardware
-        * this always fails for stlink hardware
-        */
-       if (!dap->jtag_info) {
-               LOG_DEBUG("No low level jtag hardware found");
-               return ERROR_OK;
-       }
-
        /* JTAG-DP or SWJ-DP, in JTAG mode
         * ... for SWD mode this is patched as part
         * of link switchover
index 6002b571fc10a6af0a05f472be4d6be95eca3ed6..bcf0ee1aaeb03c125791352fd6ce0b6f27221942 100644 (file)
@@ -171,9 +171,11 @@ struct armv7m_common {
        struct adiv5_dap dap;
 
        int fp_feature;
-
        uint32_t demcr;
 
+       /* stlink is a high level adapter, does not support all functions */
+       bool stlink;
+
        /* Direct processor core register read and writes */
        int (*load_core_reg_u32)(struct target *target,
                enum armv7m_regtype type, uint32_t num, uint32_t *value);
index f992bde4160acdbfd83536d720d8240618a61d98..acf280505c4dccf9429c7d13ab18815eea875bf8 100644 (file)
@@ -1780,9 +1780,13 @@ int cortex_m3_examine(struct target *target)
        struct adiv5_dap *swjdp = &cortex_m3->armv7m.dap;
        struct armv7m_common *armv7m = target_to_armv7m(target);
 
-       retval = ahbap_debugport_init(swjdp);
-       if (retval != ERROR_OK)
-               return retval;
+       /* stlink shares the examine handler but does not support
+        * all its calls */
+       if (!armv7m->stlink) {
+               retval = ahbap_debugport_init(swjdp);
+               if (retval != ERROR_OK)
+                       return retval;
+       }
 
        if (!target_was_examined(target)) {
                target_set_examined(target);
index 4044654cfe37c49b2d940d831889dd4234cde4b9..9afaae0bfc383acabafce477ea5b6cdc085c8f1a 100644 (file)
@@ -278,6 +278,7 @@ static int stm32_stlink_init_arch_info(struct target *target,
        armv7m->store_core_reg_u32 = stm32_stlink_store_core_reg_u32;
 
        armv7m->examine_debug_reason = stm32_stlink_examine_debug_reason;
+       armv7m->stlink = true;
 
        return ERROR_OK;
 }

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)