drivers/cmsis-dap: update for newest protocol version 73/6373/6
authorPoroCYon <porocyon@titandemo.org>
Wed, 21 Jul 2021 02:17:08 +0000 (04:17 +0200)
committerAntonio Borneo <borneo.antonio@gmail.com>
Sat, 31 Jul 2021 09:08:24 +0000 (10:08 +0100)
The capabilities INFO command can now return two bytes, without this
patch, the capabilities would simply not be read and left as 0 (i.e. no
capabilities).

cf. https://arm-software.github.io/CMSIS_5/DAP/html/group__DAP__Info.html ;
https://github.com/ARM-software/CMSIS_5/blob/116866fd74756c88096e37cbd0066fadad583cad/CMSIS/DAP/Firmware/Source/DAP.c#L100-L111

Change-Id: Ibd894971edf1c120cae08089e5515ce5e9972323
Signed-off-by: PoroCYon <porocyon@titandemo.org>
Reviewed-on: http://openocd.zylin.com/6373
Tested-by: jenkins
Reviewed-by: Andrzej Sierżęga <asier70@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
src/jtag/drivers/cmsis_dap.c
src/jtag/drivers/cmsis_dap.h

index be8881d9b8a75ac6fd7fb29d95f42e344e9b9909..06d5c69623032c40e7f811902ced62e706e1ff88 100644 (file)
@@ -102,10 +102,16 @@ static bool swd_mode;
 #define INFO_ID_PKT_SZ            0xff      /* short */
 #define INFO_ID_SWO_BUF_SZ        0xfd      /* word */
 
-#define INFO_CAPS_SWD             BIT(0)
-#define INFO_CAPS_JTAG            BIT(1)
-#define INFO_CAPS_SWO_UART        BIT(2)
-#define INFO_CAPS_SWO_MANCHESTER  BIT(3)
+#define INFO_CAPS_SWD                 BIT(0)
+#define INFO_CAPS_JTAG                BIT(1)
+#define INFO_CAPS_SWO_UART            BIT(2)
+#define INFO_CAPS_SWO_MANCHESTER      BIT(3)
+#define INFO_CAPS_ATOMIC_CMDS         BIT(4)
+#define INFO_CAPS_TEST_DOMAIN_TIMER   BIT(5)
+#define INFO_CAPS_SWO_STREAMING_TRACE BIT(6)
+#define INFO_CAPS_UART_PORT           BIT(7)
+#define INFO_CAPS_USB_COM_PORT        BIT(8)
+#define INFO_CAPS__NUM_CAPS               9
 
 /* CMD_LED */
 #define LED_ID_CONNECT            0x00
@@ -203,11 +209,16 @@ static bool swd_mode;
 /* CMSIS-DAP Vendor Commands
  * None as yet... */
 
-static const char * const info_caps_str[] = {
-       "SWD  Supported",
-       "JTAG Supported",
-       "SWO-UART Supported",
-       "SWO-MANCHESTER Supported"
+static const char * const info_caps_str[INFO_CAPS__NUM_CAPS] = {
+       "SWD  supported",
+       "JTAG supported",
+       "SWO-UART supported",
+       "SWO-MANCHESTER supported",
+       "Atomic commands supported",
+       "Test domain timer supported",
+       "SWO streaming trace supported",
+       "UART communication port supported",
+       "UART via USB COM port supported",
 };
 
 struct pending_transfer_result {
@@ -1016,19 +1027,17 @@ static int cmsis_dap_get_caps_info(void)
        if (retval != ERROR_OK)
                return retval;
 
-       if (data[0] == 1) {
-               uint8_t caps = data[1];
+       if (data[0] == 1 || data[0] == 2) {
+               uint16_t caps = data[1];
+               if (data[0] == 2)
+                       caps |= (uint16_t)data[2] << 8;
 
                cmsis_dap_handle->caps = caps;
 
-               if (caps & INFO_CAPS_SWD)
-                       LOG_INFO("CMSIS-DAP: %s", info_caps_str[0]);
-               if (caps & INFO_CAPS_JTAG)
-                       LOG_INFO("CMSIS-DAP: %s", info_caps_str[1]);
-               if (caps & INFO_CAPS_SWO_UART)
-                       LOG_INFO("CMSIS-DAP: %s", info_caps_str[2]);
-               if (caps & INFO_CAPS_SWO_MANCHESTER)
-                       LOG_INFO("CMSIS-DAP: %s", info_caps_str[3]);
+               for (int i = 0; i < INFO_CAPS__NUM_CAPS; ++i) {
+                       if (caps & BIT(i))
+                               LOG_INFO("CMSIS-DAP: %s", info_caps_str[i]);
+               }
        }
 
        return ERROR_OK;
index 634a62c8f1e246b19b3a99074f8b7a294997e690..f6d9df21b377f7a7ed0e6baeb3c923fda93d727a 100644 (file)
@@ -16,7 +16,7 @@ struct cmsis_dap {
        uint16_t packet_buffer_size;
        uint8_t *command;
        uint8_t *response;
-       uint8_t caps;
+       uint16_t caps;
        uint8_t mode;
        uint32_t swo_buf_sz;
        bool trace_enabled;

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)