Here is a first cut of modifying arm7tdmi.c to reduce # of
roundtrips for reading registers.
I'm not going to commit any patches before the weekend
that addresses performance problems only. I'm also
experimenting a little bit with the form that these changes
should take.
The attached patch reduces # of flushes from from 62
to 47 for a step in telnet(using flush_count).
--
Øyvind Harboe
Embedded software and hardware consulting services
http://consulting.zylin.com
### Eclipse Workspace Patch 1.0
#P openocd
Index: src/target/arm7tdmi.c
===================================================================
--- src/target/arm7tdmi.c (revision 1674)
+++ src/target/arm7tdmi.c (working copy)
@@ -115,13 +115,13 @@
fields[0].num_bits = 1;
fields[0].out_value = NULL;
fields[0].in_value = &breakpoint;
-
+
fields[1].tap = arm7_9->jtag_info.tap;
fields[1].num_bits = 32;
fields[1].out_value = NULL;
fields[1].in_value = databus;
-
+
if((retval = arm_jtag_scann(&arm7_9->jtag_info, 0x1)) !=
ERROR_OK)
{
@@ -178,7 +178,7 @@
}
/* clock the target, reading the databus */
-int arm7tdmi_clock_data_in(arm_jtag_t *jtag_info, u32 *in)
+static int arm7tdmi_clock_data_in_queue(arm_jtag_t *jtag_info, u32 *in)
{
int retval = ERROR_OK;
scan_field_t fields[2];
@@ -194,24 +194,23 @@
fields[0].num_bits = 1;
fields[0].out_value = NULL;
fields[0].in_value = NULL;
-
-
fields[1].tap = jtag_info->tap;
fields[1].num_bits = 32;
fields[1].out_value = NULL;
- u8 tmp[4];
- fields[1].in_value = tmp;
-
+ fields[1].in_value = (u8 *)in;
+
+ jtag_add_dr_scan(2, fields, TAP_INVALID);
+
+ jtag_add_runtest(0, TAP_INVALID);
- jtag_add_dr_scan_now(2, fields, TAP_INVALID);
- if (jtag_error==ERROR_OK)
- {
- *in=flip_u32(le_to_h_u32(tmp), 32);
- }
+ return ERROR_OK;
+}
- jtag_add_runtest(0, TAP_INVALID);
+static void arm7tdmi_clock_data_in_post_process(u32 *in)
+{
+ *in=flip_u32(le_to_h_u32((u8 *)in), 32);
#ifdef _DEBUG_INSTRUCTION_EXECUTION_
{
@@ -230,8 +229,15 @@
}
}
#endif
+}
- return ERROR_OK;
+int arm7tdmi_clock_data_in(arm_jtag_t *jtag_info, u32 *in)
+{
+ int retval;
+ retval=arm7tdmi_clock_data_in_queue(jtag_info, in);
+ jtag_execute_queue_noclear();
+ arm7tdmi_clock_data_in_post_process(in);
+ return retval;
}
void arm_endianness(u8 *tmp, void *in, int size, int be, int flip)
@@ -286,14 +292,14 @@
fields[0].num_bits = 1;
fields[0].out_value = NULL;
fields[0].in_value = NULL;
-
+
fields[1].tap = jtag_info->tap;
fields[1].num_bits = 32;
fields[1].out_value = NULL;
u8 tmp[4];
fields[1].in_value = tmp;
-
+
jtag_add_dr_scan_now(2, fields, TAP_INVALID);
@@ -400,8 +406,19 @@
for (i = 0; i <= 15; i++)
{
if (mask & (1 << i))
+ {
+ /* nothing fetched, STM still in EXECUTE (1+i cycle) */
+ arm7tdmi_clock_data_in_queue(jtag_info, core_regs[i]);
+ }
+ }
+ jtag_execute_queue_noclear();
+ for (i = 0; i <= 15; i++)
+ {
+ if (mask & (1 << i))
+ {
/* nothing fetched, STM still in EXECUTE (1+i cycle) */
- arm7tdmi_clock_data_in(jtag_info, core_regs[i]);
+ arm7tdmi_clock_data_in_post_process(core_regs[i]);
+ }
}
}
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development