Dear Jean-Christophe,
>> I'm going to create the 0.5.0 release
>>
>> If any patch are still pending ping the patch or send a e-mail with a
>> link to it
>>
>> as announce before I've delay the release a little as we have the linux
>> kerne
>> merge windows this days
>>
>> if nothing new I'll relase it tomorrow morning China time
>
> Only yesterday I was able to fix the issues with my Olimex ARM-JTAG-EW
> as described in tickets #34 and #35.
>
> I will clean up my (non-intrusive) patches, and send them to you within
> the next hours. I would really appreciate to get them into 0.5.0 since
> we are using this interface in a production environment.
As announced before, here are two patches that address the above tickets:
#34: 0001-JTAG-speed.patch
There where two distinct problems: The message length for "set speed"
messages is 5, not 4. This part of the patch fixes the usb_bulk_read
failures reported in the ticket.
Additionally, the device expects the speed in Hz, not kHz. I figured
this out be sniffing the USB traffic generated by IAR EWARM (using
Olimex' JLINK emulation driver). Since the default speed in the target
configuration file is 1000 kHz, this resulted in an effective speed of
1 kHz. This was probably the reason for the additional errors (JTAG
chain timeout (?), as in private email from Dimitar Dimitrov, the
original author of the driver and a former Olimex employee).
The patch also contains further minor improvements (see commit log).
#35: 0002-gdb.patch
As it turned out, this bug was only triggered when OpenOCD was compiled
with verbose logging (including USB and JTAG communcation). This can be
addressed by adding a keep_alive() call in the most expensive logging
function. Please note that this code is not compiled in release mode, so
this does not degrade the default performance.
Speaking of performance: Flashing now works with ~10 kBytes / s @ 1MHz
JTAG speed. I am not sure if this is great, but it is much better than
before (when the "set speed" command) was a NO-OP).
I also have some more findings from my analysis the USB traffic of the
IAR EWARM traffic, but I will discuss this at later point in with
Dimitar before since I am not sure what those commands are acutually doing.
Please let me know if you need more feedback. I would really appreciate
to get these fixes into 0.5.0.
Btw. If the are some testers who also own this interface, just let me
know and I can provide you with a build that includes my patches.
Best regards,
Simon
>From 87b05f377b94c3ad5773a5909f92708fbf0d1c62 Mon Sep 17 00:00:00 2001
From: Simon Barner <[email protected]>
Date: Wed, 3 Aug 2011 08:22:35 +0200
Subject: [PATCH 1/2] [email protected]
---
src/jtag/drivers/arm-jtag-ew.c | 28 +++++++++++++++++++++++-----
1 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/src/jtag/drivers/arm-jtag-ew.c b/src/jtag/drivers/arm-jtag-ew.c
index 44eaeff..20f7c99 100644
--- a/src/jtag/drivers/arm-jtag-ew.c
+++ b/src/jtag/drivers/arm-jtag-ew.c
@@ -184,9 +184,9 @@ static int armjtagew_speed(int speed)
usb_out_buffer[0] = CMD_SET_TCK_FREQUENCY;
- buf_set_u32(usb_out_buffer + 1, 0, 32, speed);
+ buf_set_u32(usb_out_buffer + 1, 0, 32, speed*1000);
- result = armjtagew_usb_message(armjtagew_handle, 4, 4);
+ result = armjtagew_usb_message(armjtagew_handle, 5, 4);
if (result < 0)
{
@@ -196,7 +196,7 @@ static int armjtagew_speed(int speed)
usb_out_buffer[0] = CMD_GET_TCK_FREQUENCY;
result = armjtagew_usb_message(armjtagew_handle, 1, 4);
- speed_real = (int)buf_get_u32(usb_in_buffer,0,32);
+ speed_real = (int)buf_get_u32(usb_in_buffer,0,32) / 1000;
if (result < 0)
{
LOG_ERROR("ARM-JTAG-EW getting speed failed (%d)", result);
@@ -204,7 +204,7 @@ static int armjtagew_speed(int speed)
}
else
{
- LOG_INFO("Requested speed %dkHz, emulator reported %dkHz.", speed,
speed_real);
+ LOG_INFO("Requested speed %dkHz, emulator reported %dkHz.",
speed, speed_real);
}
return ERROR_OK;
@@ -218,6 +218,14 @@ static int armjtagew_khz(int khz, int *jtag_speed)
return ERROR_OK;
}
+static int armjtagew_speed_div(int speed, int* khz)
+{
+ *khz = speed;
+
+ return ERROR_OK;
+}
+
+
static int armjtagew_init(void)
{
int check_cnt;
@@ -248,6 +256,9 @@ static int armjtagew_init(void)
LOG_INFO("ARM-JTAG-EW initial read failed, don't worry");
}
+ // Initial JTAG speed (for reset and initialization): 32 kHz
+ armjtagew_speed(32);
+
LOG_INFO("ARM-JTAG-EW JTAG Interface ready");
armjtagew_reset(0, 0);
@@ -488,6 +499,11 @@ static int armjtagew_get_version_info(void)
usb_in_buffer[1], usb_in_buffer[0], \
isgraph(usb_in_buffer[2]) ? usb_in_buffer[2] : 'X', \
sn, auxinfo);
+
+ if (1 != usb_in_buffer[1] || 6 != usb_in_buffer[0])
+ {
+ LOG_WARNING("ARM-JTAG-EW firmware version %d.%d is untested
with this version of OpenOCD. You might experience unexpected behavior.",
usb_in_buffer[1], usb_in_buffer[0]);
+ }
return ERROR_OK;
}
@@ -515,9 +531,11 @@ static const struct command_registration
armjtagew_command_handlers[] = {
struct jtag_interface armjtagew_interface = {
.name = "arm-jtag-ew",
.commands = armjtagew_command_handlers,
-
+ .transports = jtag_only,
+
.execute_queue = armjtagew_execute_queue,
.speed = armjtagew_speed,
+ .speed_div = armjtagew_speed_div,
.khz = armjtagew_khz,
.init = armjtagew_init,
.quit = armjtagew_quit,
--
1.7.5.1
>From d04862bd04bcb0cb2b007194f47dd33cd7761479 Mon Sep 17 00:00:00 2001
From: Simon Barner <[email protected]>
Date: Wed, 3 Aug 2011 08:36:19 +0200
Subject: [PATCH 2/2] - Send GDB keep_alive() messages when logging USB
communication
---
src/jtag/drivers/arm-jtag-ew.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/jtag/drivers/arm-jtag-ew.c b/src/jtag/drivers/arm-jtag-ew.c
index 20f7c99..e511d71 100644
--- a/src/jtag/drivers/arm-jtag-ew.c
+++ b/src/jtag/drivers/arm-jtag-ew.c
@@ -847,6 +847,9 @@ static void armjtagew_debug_buffer(uint8_t *buffer, int
length)
strcat(line, s);
}
LOG_DEBUG("%s", line);
+
+ // Prevent GDB timeout (writing to log might take some time)
+ keep_alive();
}
}
#endif
--
1.7.5.1
- Fix setting interface speed:
- CMD_SET_TCK_FREQUENCY message length is 5, not 4
- Interface expects speed in Hz, not kHz
- Provide armjtagew_speed_div() in order to fix interactive use of `adapter_khz'
- Declare interface as `jtag_only'
- Emit a warning if interface firmware version != 1.6
- In armjtagew_init(), set initial JTAG speed to 32 kHz (before TAP
initialization).
This prevents rare communication errors during startup.
- Send GDB keep_alive() messages when logging USB communication
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development