jlink: Constantify string arrays
[openocd.git] / src / jtag / drivers / jlink.c
index 871bf24c613ef8be43d5b4bd3ff1053ad1562600..39be9412697c58ab30646bc7ccbc1831cbaa03dc 100644 (file)
@@ -150,7 +150,7 @@ static uint8_t usb_out_buffer[JLINK_OUT_BUFFER_SIZE];
 #define EMU_CAP_RAWTRACE               30
 #define EMU_CAP_RESERVED_3             31
 
-static char *jlink_cap_str[] = {
+static const char * const jlink_cap_str[] = {
        "Always 1.",
        "Supports command EMU_CMD_GET_HARDWARE_VERSION",
        "Supports command EMU_CMD_WRITE_DCC",
@@ -189,17 +189,20 @@ static char *jlink_cap_str[] = {
 #define JLINK_MAX_SPEED 12000
 
 /* J-Link hardware versions */
-#define JLINK_HW_TYPE_JLINK    0
-#define JLINK_HW_TYPE_JTRACE   1
-#define JLINK_HW_TYPE_FLASHER  2
-#define JLINK_HW_TYPE_JLINK_PRO        3
-#define JLINK_HW_TYPE_MAX      4
-
-static char *jlink_hw_type_str[] = {
+#define JLINK_HW_TYPE_JLINK                            0
+#define JLINK_HW_TYPE_JTRACE                   1
+#define JLINK_HW_TYPE_FLASHER                  2
+#define JLINK_HW_TYPE_JLINK_PRO                        3
+#define JLINK_HW_TYPE_JLINK_LITE_ADI   5
+#define JLINK_HW_TYPE_MAX                              6
+
+static const char * const jlink_hw_type_str[] = {
        "J-Link",
        "J-Trace",
        "Flasher",
        "J-Link Pro",
+       "Unknown",
+       "J-Link Lite-ADI",
 };
 
 #define JLINK_TIF_JTAG         0
@@ -507,28 +510,6 @@ static int jlink_init(void)
                return ERROR_JTAG_INIT_FAILED;
        }
 
-       /*
-        * The next three instructions were added after discovering a problem
-        * while using an oscilloscope.
-        * For the V8 SAM-ICE dongle (and likely other j-link device variants),
-        * the reset line to the target microprocessor was found to cycle only
-        * intermittently during emulator startup (even after encountering the
-        * downstream reset instruction later in the code).
-        * This was found to create two issues:
-        * 1) In general it is a bad practice to not reset a CPU to a known
-        * state when starting an emulator and
-        * 2) something critical happens inside the dongle when it does the
-        * first read following a new USB session.
-        * Keeping the processor in reset during the first read collecting
-        * version information seems to prevent errant
-        * "J-Link command EMU_CMD_VERSION failed" issues.
-        */
-
-       LOG_INFO("J-Link initialization started / target CPU reset initiated");
-       jlink_simple_command(EMU_CMD_HW_TRST0);
-       jlink_simple_command(EMU_CMD_HW_RESET0);
-       usleep(1000);
-
        jlink_hw_jtag_version = 2;
 
        if (jlink_get_version_info() == ERROR_OK) {
@@ -559,6 +540,8 @@ static int jlink_init(void)
        jtag_sleep(3000);
        jlink_tap_init();
 
+       jlink_speed(jtag_get_speed_khz());
+
        if (!swd_mode) {
                /* v5/6 jlink seems to have an issue if the first tap move
                 * is not divisible by 8, so we send a TLR on first power up */
@@ -948,7 +931,7 @@ static int jlink_get_version_info(void)
                LOG_INFO("J-Link hw version %i", (int)jlink_hw_version);
 
                if (jlink_hw_type >= JLINK_HW_TYPE_MAX)
-                       LOG_INFO("J-Link hw type uknown 0x%" PRIx32, jlink_hw_type);
+                       LOG_INFO("J-Link hw type unknown 0x%" PRIx32, jlink_hw_type);
                else
                        LOG_INFO("J-Link hw type %s", jlink_hw_type_str[jlink_hw_type]);
        }
@@ -1343,7 +1326,7 @@ static void jlink_swd_read_reg(struct adiv5_dap *dap, uint8_t cmd, uint32_t *val
 static int_least32_t jlink_swd_frequency(struct adiv5_dap *dap, int_least32_t hz)
 {
        if (hz > 0)
-               jlink_speed(hz);
+               jlink_speed(hz / 1000);
 
        return hz;
 }

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)