aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-09-11 07:43:36 +0000
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-09-11 07:43:36 +0000
commit0dcfbec7fb5993cb73163b5e5c4d031727046fd9 (patch)
tree329d788f2df9ec386ce0dc99d71770bb74e52893 /src
parent58b78818e00b7518350c7a45474bb00d7584bf6d (diff)
do not use dynamically sized stack arrays, not compatible with embedded OS's
git-svn-id: svn://svn.berlios.de/openocd/trunk@2691 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src')
-rw-r--r--src/target/arm11_dbgtap.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/src/target/arm11_dbgtap.c b/src/target/arm11_dbgtap.c
index 7e5bd847..54e7ae65 100644
--- a/src/target/arm11_dbgtap.c
+++ b/src/target/arm11_dbgtap.c
@@ -576,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--)
@@ -603,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;
}