Stop GDB when polling fails, srst assert or powerdropout is detected
[openocd.git] / src / target / arm11_dbgtap.c
index 82612598d29fef0f60c877a91ca2fd252d8dcf2d..54e7ae658168bc89e3da708fb7caf9e9c52208bb 100644 (file)
@@ -386,7 +386,8 @@ int arm11_run_instr_no_data(arm11_common_t * arm11, uint32_t * opcode, size_t co
                        if (flag)
                                break;
 
-                       long long then;
+                       long long then = 0;
+
                        if (i == 1000)
                        {
                                then = timeval_ms();
@@ -465,7 +466,8 @@ int arm11_run_instr_data_to_core(arm11_common_t * arm11, uint32_t opcode, uint32
 
                        JTAG_DEBUG("DTR  Ready %d  nRetry %d", Ready, nRetry);
 
-                       long long then;
+                       long long then = 0;
+
                        if (i == 1000)
                        {
                                then = timeval_ms();
@@ -499,7 +501,8 @@ int arm11_run_instr_data_to_core(arm11_common_t * arm11, uint32_t opcode, uint32
 
                JTAG_DEBUG("DTR  Data %08x  Ready %d  nRetry %d", Data, Ready, nRetry);
 
-               long long then;
+               long long then = 0;
+
                if (i == 1000)
                {
                        then = timeval_ms();
@@ -573,7 +576,15 @@ int arm11_run_instr_data_to_core_noack(arm11_common_t * arm11, uint32_t opcode,
        arm11_setup_field(arm11,  1,    NULL,                   NULL /*&Ready*/,        chain5_fields + 1);
        arm11_setup_field(arm11,  1,    NULL,                   NULL,                           chain5_fields + 2);
 
-       uint8_t                 Readies[count + 1];
+       uint8_t                 *Readies;
+       int bytes = sizeof(*Readies)*(count + 1);
+       Readies = (uint8_t *) malloc(bytes);
+       if (Readies == NULL)
+       {
+               LOG_ERROR("Out of memory allocating %d bytes", bytes);
+               return ERROR_FAIL;
+       }
+
        uint8_t *               ReadyPos                        = Readies;
 
        while (count--)
@@ -600,22 +611,28 @@ int arm11_run_instr_data_to_core_noack(arm11_common_t * arm11, uint32_t opcode,
 
        arm11_add_dr_scan_vc(asizeof(chain5_fields), chain5_fields, TAP_DRPAUSE);
 
-       CHECK_RETVAL(jtag_execute_queue());
+       int retval = jtag_execute_queue();
+       if (retval == ERROR_OK)
+       {
 
-       size_t error_count = 0;
+               size_t error_count = 0;
 
-       for (size_t i = 0; i < asizeof(Readies); i++)
-       {
-               if (Readies[i] != 1)
+               for (size_t i = 0; i < asizeof(Readies); i++)
                {
-                       error_count++;
+                       if (Readies[i] != 1)
+                       {
+                               error_count++;
+                       }
                }
+
+               if (error_count)
+                       LOG_ERROR("Transfer errors " ZU, error_count);
+
        }
 
-       if (error_count)
-               LOG_ERROR("Transfer errors " ZU, error_count);
+       free(Readies);
 
-       return ERROR_OK;
+       return retval;
 }
 
 
@@ -678,7 +695,8 @@ int arm11_run_instr_data_from_core(arm11_common_t * arm11, uint32_t opcode, uint
 
                        JTAG_DEBUG("DTR  Data %08x  Ready %d  nRetry %d", Data, Ready, nRetry);
 
-                       long long then;
+                       long long then = 0;
+
                        if (i == 1000)
                        {
                                then = timeval_ms();

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)