Only call cmsis_dap_cmd_DAP_SWD_Configure when swd_mode is enabled 94/4294/2
authorBas Vermeulen <bas@daedalean.ai>
Tue, 21 Nov 2017 16:12:24 +0000 (17:12 +0100)
committerSpencer Oliver <spen@spen-soft.co.uk>
Wed, 6 Dec 2017 21:07:10 +0000 (21:07 +0000)
The CMSIS-DAP used by NXP's LS1012ARDB board only supports JTAG,
and not SWD. Calling cmsis_dap_cmd_DAP_SWD_Configure returns with an
error (and doesn't actually do anything in the debugger).

Wrap the call to cmsis_dap_cmd_DAP_SWD_Configure in a check for
swd_mode, to make sure initialisation doesn't fail needlessly.

Change-Id: Id7e568cb6e36886bd7c5b3699d198a77a51c28c9
Signed-off-by: Bas Vermeulen <bas@daedalean.ai>
Reviewed-on: http://openocd.zylin.com/4294
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
src/jtag/drivers/cmsis_dap_usb.c

index 19c3b19c920ab7acddfa5cd59cf1ac92316e1dab..345c1fd7e8f62b127c1abbbe41c16eda5dd3b861 100644 (file)
@@ -958,11 +958,14 @@ static int cmsis_dap_init(void)
        retval = cmsis_dap_cmd_DAP_TFER_Configure(0, 64, 0);
        if (retval != ERROR_OK)
                return ERROR_FAIL;
        retval = cmsis_dap_cmd_DAP_TFER_Configure(0, 64, 0);
        if (retval != ERROR_OK)
                return ERROR_FAIL;
-       /* Data Phase (bit 2) must be set to 1 if sticky overrun
-        * detection is enabled */
-       retval = cmsis_dap_cmd_DAP_SWD_Configure(0);    /* 1 TRN, no Data Phase */
-       if (retval != ERROR_OK)
-               return ERROR_FAIL;
+
+       if (swd_mode) {
+               /* Data Phase (bit 2) must be set to 1 if sticky overrun
+                * detection is enabled */
+               retval = cmsis_dap_cmd_DAP_SWD_Configure(0);    /* 1 TRN, no Data Phase */
+               if (retval != ERROR_OK)
+                       return ERROR_FAIL;
+       }
 
        retval = cmsis_dap_cmd_DAP_LED(0x03);           /* Both LEDs on */
        if (retval != ERROR_OK)
 
        retval = cmsis_dap_cmd_DAP_LED(0x03);           /* Both LEDs on */
        if (retval != 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)