Re: [Openocd-development] OpenOCD and different versions of J-Link
Hello Xiaofan, Saturday, May 23, 2009, 2:17:33 PM, you wrote: XC On Tue, May 19, 2009 at 8:26 AM, Igor Skochinsky skochin...@mail.ru wrote: What I mean is I could write up a list of missing/underdocumented commands and describe their input/output parameters. I don't have a J-Link so I don't really need the code myself. XC Are you using reverse engineering from the J-Link Windows DLL? libjlinkarm.so from the recently released Linux version. -- WBR, Igormailto:skochin...@mail.ru ___ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development
Re: [Openocd-development] OpenOCD and different versions of J-Link
On Tue, May 19, 2009 at 8:26 AM, Igor Skochinsky skochin...@mail.ru wrote: What I mean is I could write up a list of missing/underdocumented commands and describe their input/output parameters. I don't have a J-Link so I don't really need the code myself. Are you using reverse engineering from the J-Link Windows DLL? -- Xiaofan http://mcuee.blogspot.com ___ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development
Re: [Openocd-development] OpenOCD and different versions of J-Link
On Sat, 2009-05-23 at 09:54 +0200, Magnus Lundin wrote: Comment - In jlink_execute_reset(jtag_command_t *cmd) jlink_tap_execute(); Should be removed and be superflous, actually both of them should be removed. After seeing your latest post, I now think I understand this to mean that the patch reduces to the one-liner of set_tap_state. Correct? If so, I would be happy to commit the other line shortly. Cheers, Zach ___ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development
Re: [Openocd-development] OpenOCD and different versions of J-Link
On Sat, 2009-05-23 at 13:42 -0700, Zach Welch wrote: On Sat, 2009-05-23 at 09:54 +0200, Magnus Lundin wrote: Comment - In jlink_execute_reset(jtag_command_t *cmd) jlink_tap_execute(); Should be removed and be superflous, actually both of them should be removed. After seeing your latest post, I now think I understand this to mean that the patch reduces to the one-liner of set_tap_state. Correct? I'm a moron. jlink != jtag. Sorry. I'll commit the full patch shortly. Z ___ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development
Re: [Openocd-development] OpenOCD and different versions of J-Link
On Sat, 2009-05-23 at 00:18 +0200, Magnus Lundin wrote: Zach Welch wrote: On Tue, 2009-05-19 at 16:53 +0200, Magnus Lundin wrote: Hi Info : J-Link compiled Feb 20 2006 18:20:20 -- Update -- Info : JLink caps 0x3 Error: J-Link command EMU_CMD_GET_MAX_MEM_BLOCK failed (-110) Open OCD seems to get reasonable ansvers from first two JLink commands. The /* query hardware maximum memory block */ should not be run for this version, I had removed it in my patch. Next patch will use results from JLink caps to select what info to query. I am waiting for more info from Segger about version diffrences and endpoints. How are we doing with this patch? It looks like we have made some good progress this week, so I don't want the effort to stall. What are the thoughts about committing your latest version? Even if more changes may be pending, it seems that your work has improved things for folks with some devices, so I think we have made constructive progress from where we were before now. If nothing else, we should get some more testing feedback. ;) Cheers, Zach There is a set of new patches that has been tested by Michael Fischer, as far as i know there were no problems. There are still things that should be fixed in the resethandling in jtag_add_reset and minimizing the differences between ft2232 and jlink behaviour. But still would suggest that the following patcches are commited. They are not untested. I will apply them here and see if they magically cure my own woes. Regardless, I think these changes should be committed in some for, though I can see various ways that I would like to clean your code. Would you mind my taking a pass over them before I commit them? Incidentally, do you think this might also solve the problem that was just reported by Dylan Reid? I have cc'd him in the hope that he will try your patches and report the latest results. Cheers, Zach ___ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development
Re: [Openocd-development] OpenOCD and different versions of J-Link
Zach Welch wrote: On Sat, 2009-05-23 at 00:18 +0200, Magnus Lundin wrote: Zach Welch wrote: On Tue, 2009-05-19 at 16:53 +0200, Magnus Lundin wrote: Hi Info : J-Link compiled Feb 20 2006 18:20:20 -- Update -- Info : JLink caps 0x3 Error: J-Link command EMU_CMD_GET_MAX_MEM_BLOCK failed (-110) Open OCD seems to get reasonable ansvers from first two JLink commands. The /* query hardware maximum memory block */ should not be run for this version, I had removed it in my patch. Next patch will use results from JLink caps to select what info to query. I am waiting for more info from Segger about version diffrences and endpoints. How are we doing with this patch? It looks like we have made some good progress this week, so I don't want the effort to stall. What are the thoughts about committing your latest version? Even if more changes may be pending, it seems that your work has improved things for folks with some devices, so I think we have made constructive progress from where we were before now. If nothing else, we should get some more testing feedback. ;) Cheers, Zach There is a set of new patches that has been tested by Michael Fischer, as far as i know there were no problems. There are still things that should be fixed in the resethandling in jtag_add_reset and minimizing the differences between ft2232 and jlink behaviour. But still would suggest that the following patcches are commited. They are not untested. I will apply them here and see if they magically cure my own woes. Regardless, I think these changes should be committed in some for, though I can see various ways that I would like to clean your code. Would you mind my taking a pass over them before I commit them? Sure, I am out of style discussions on this list. Incidentally, do you think this might also solve the problem that was just reported by Dylan Reid? I have cc'd him in the hope that he will try your patches and report the latest results. It should help, but from the info given it is hard to tell what actually broke. ___ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development
Re: [Openocd-development] OpenOCD and different versions of J-Link
On Sat, May 23, 2009 at 6:18 AM, Magnus Lundin lun...@mlu.mine.nu wrote: There is a set of new patches that has been tested by Michael Fischer, as far as i know there were no problems. There are still things that should be fixed in the resethandling in jtag_add_reset and minimizing the differences between ft2232 and jlink behaviour. But still would suggest that the following patcches are commited. They are not untested. I'd like to test as well for my V3 black J-link. It works well with your previous patch. But the latest trunk does not build under Arch Linux. It is also pointed out by Simon Qian. How should I modify that file? xsvf.c: In function ‘handle_xsvf_command’: xsvf.c:1025: error: format ‘%jd’ expects type ‘intmax_t’, but argument 4 has type ‘long int’ make[3]: *** [xsvf.lo] Error 1 -- Xiaofan http://mcuee.blogspot.com ___ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development
Re: [Openocd-development] OpenOCD and different versions of J-Link
On Sat, May 23, 2009 at 9:12 AM, Xiaofan Chen xiaof...@gmail.com wrote: I'd like to test as well for my V3 black J-link. It works well with your previous patch. But the latest trunk does not build under Arch Linux. It is also pointed out by Simon Qian. How should I modify that file? xsvf.c: In function ‘handle_xsvf_command’: xsvf.c:1025: error: format ‘%jd’ expects type ‘intmax_t’, but argument 4 has type ‘long int’ make[3]: *** [xsvf.lo] Error 1 Change it to %ld as previous version helps. -- Xiaofan http://mcuee.blogspot.com ___ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development
Re: [Openocd-development] OpenOCD and different versions of J-Link
On Sat, 2009-05-23 at 09:12 +0800, Xiaofan Chen wrote: On Sat, May 23, 2009 at 6:18 AM, Magnus Lundin lun...@mlu.mine.nu wrote: There is a set of new patches that has been tested by Michael Fischer, as far as i know there were no problems. There are still things that should be fixed in the resethandling in jtag_add_reset and minimizing the differences between ft2232 and jlink behaviour. But still would suggest that the following patcches are commited. They are not untested. I'd like to test as well for my V3 black J-link. It works well with your previous patch. But the latest trunk does not build under Arch Linux. It is also pointed out by Simon Qian. How should I modify that file? xsvf.c: In function ‘handle_xsvf_command’: xsvf.c:1025: error: format ‘%jd’ expects type ‘intmax_t’, but argument 4 has type ‘long int’ make[3]: *** [xsvf.lo] Error 1 Broken in r1882, and fixed in r1888. --Z ___ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development
Re: [Openocd-development] OpenOCD and different versions of J-Link
2009/5/23 Zach Welch z...@superlucidity.net: I'd like to test as well for my V3 black J-link. It works well with your previous patch. But the latest trunk does not build under Arch Linux. It is also pointed out by Simon Qian. How should I modify that file? xsvf.c: In function ‘handle_xsvf_command’: xsvf.c:1025: error: format ‘%jd’ expects type ‘intmax_t’, but argument 4 has type ‘long int’ make[3]: *** [xsvf.lo] Error 1 Broken in r1882, and fixed in r1888. --Z Thanks for the fast response. Now it is fine. I've applied the three patches (but I do not use ft2232) and my black J-link V3 seems to work fine with Olimex LPC-P2148 board. Tested under Ubuntu 9.04 (I was thinking the Arch GCC compiler may be too harsh so I rebooted to Ubuntu). -- Xiaofan http://mcuee.blogspot.com ___ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development
Re: [Openocd-development] OpenOCD and different versions of J-Link
On Sat, 2009-05-23 at 09:35 +0800, Xiaofan Chen wrote: 2009/5/23 Zach Welch z...@superlucidity.net: I'd like to test as well for my V3 black J-link. It works well with your previous patch. But the latest trunk does not build under Arch Linux. It is also pointed out by Simon Qian. How should I modify that file? xsvf.c: In function ‘handle_xsvf_command’: xsvf.c:1025: error: format ‘%jd’ expects type ‘intmax_t’, but argument 4 has type ‘long int’ make[3]: *** [xsvf.lo] Error 1 Broken in r1882, and fixed in r1888. --Z Thanks for the fast response. Now it is fine. I've applied the three patches (but I do not use ft2232) and my black J-link V3 seems to work fine with Olimex LPC-P2148 board. Tested under Ubuntu 9.04 (I was thinking the Arch GCC compiler may be too harsh so I rebooted to Ubuntu). Great to hear. I am working on these now and should have them committed within an hour or two. (I have several things distracting me, or it would be much sooner.) Cheers, Zach ___ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development
Re: [Openocd-development] OpenOCD and different versions of J-Link
On Sat, 2009-05-23 at 00:46 +0200, Magnus Lundin wrote: Zach Welch wrote: On Sat, 2009-05-23 at 00:18 +0200, Magnus Lundin wrote: Zach Welch wrote: On Tue, 2009-05-19 at 16:53 +0200, Magnus Lundin wrote: [snip] There is a set of new patches that has been tested by Michael Fischer, as far as i know there were no problems. There are still things that should be fixed in the resethandling in jtag_add_reset and minimizing the differences between ft2232 and jlink behaviour. But still would suggest that the following patcches are commited. They are not untested. I will apply them here and see if they magically cure my own woes. Regardless, I think these changes should be committed in some for, though I can see various ways that I would like to clean your code. Would you mind my taking a pass over them before I commit them? Sure, I am out of style discussions on this list. Committed the jlink.c changes as r1889. While the JTAG and FTDI changes look fine too, I cannot judge their relative risk/reward at this time, so I feel that I must defer to others on those. I'll follow up though. I kept track of every change that I made in cleaning and included the list with my commit message. My changes were only on (or very near) those lines that you added or changed in your patch. The results were frustrating for me (to say the least), but I hope my efforts will help motivate everyone to avoid similar mistakes in the future. In total, my cleaning removed 1.9K of superfluous changes, which was over 25% of the original patch. The changes are now easier to review, and the code is much easier to understand as a bonus. Here is a short list of things that this patch did wrong: -- Hard-coded constants in code. -- Inefficient flow-control statements (stylistically speaking) -- Insufficient use of temporary variables. -- Superfluous whitespace/comment-style changes. While these are superficial to the compiler, they have a profound affect on the substance of the code for those developing with it. Regardless, the J-Link now works _much_ better for me in my own tests, so I and the entire community of J-Link users owe you a Big Thanks. :) Cheers, Zach ___ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development
Re: [Openocd-development] OpenOCD and different versions of J-Link
Xiaofan, After telnet connect, which monitor command produces this: Info : accepting 'telnet' connection from 0 TapName| Enabled | IdCode ExpectedIrLen IrCap IrMask Instr ---||-|||--|--|--|- 0 | lpc2148.cpu|Y| 0x4f1f0f0f | 0x4f1f0f0f | 0x04 | 0x01 | 0x0f | 0x0c I don't see this with my setup (using str71x board). Possibly unique to your lpc2148 cpu? I haven't yet tried Magnus merged patch. Will report shortly on if it works for me. Thanks, -gene ___ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development
Re: [Openocd-development] OpenOCD and different versions of J-Link
Magnus Lundin wrote: The following patch combines my previous patch with most of Ben's patch. It can use both EMU_CMD_HW_JTAG2 and EMU_CMD_HW_JTAG3 It defaults to EMU_CMD_HW_JTAG2 so it should work with all interfaces but EMU_CMD_HW_JTAG3 is recommended by SEgger, you can change the behaviour with jlink_hw_jtag 3 or jlink_hw_jtag 2 Autodetection can be done when we know which versions JLink can use what setting, (-d3 logs of setup messages ) Have a nice day Magnus Seems to work OK for me too (hw version yellow/V4 OEM IAR). If I do jlink_hw_jtag 2 it loses USB comm (LED on jlink goes off) and I see messages: jlink hw jtag 3 Error: usb_bulk_read failed (requested=12, result=-110) Error: jlink_tap_execute, wrong result -107 (expected 12) Error: usb_bulk_read failed (requested=12, result=-110) Error: jlink_tap_execute, wrong result -107 (expected 12) Error: usb_bulk_read failed (requested=12, result=-110) : :Must restart openocd to recover. Note: see similar string of messages if USB is unplugged from Jlink while running and must restart it. Does not recover when USB replugged. So I guess I must use 2. Still see occasional segfault on startup (still running r1833 except for jlink.c patch). -gene ___ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development
Re: [Openocd-development] OpenOCD and different versions of J-Link
On Wed, May 20, 2009 at 9:25 PM, Gene Smith g...@chartertn.net wrote: Xiaofan, After telnet connect, which monitor command produces this: Info : accepting 'telnet' connection from 0 TapName | Enabled | IdCode Expected IrLen IrCap IrMask Instr ---||-|||--|--|--|- 0 | lpc2148.cpu | Y | 0x4f1f0f0f | 0x4f1f0f0f | 0x04 | 0x01 | 0x0f | 0x0c I don't see this with my setup (using str71x board). Possibly unique to your lpc2148 cpu? I haven't yet tried Magnus merged patch. Will report shortly on if it works for me. Use scan_chain. -- Xiaofan http://mcuee.blogspot.com ___ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development
Re: [Openocd-development] OpenOCD and different versions of J-Link
On Wed, May 20, 2009 at 10:06 PM, Gene Smith g...@chartertn.net wrote: So I guess I must use 2. Yes that is right. For v1/2/3/4, you have to use 2. Still see occasional segfault on startup (still running r1833 except for jlink.c patch). The latest version (1857) seems to be ok, no more segfault. I have segfault with V1836 as well. -- Xiaofan http://mcuee.blogspot.com ___ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development
Re: [Openocd-development] OpenOCD and different versions of J-Link
Xiaofan Chen wrote: On Wed, May 20, 2009 at 10:06 PM, Gene Smith g...@chartertn.net wrote: So I guess I must use 2. Yes that is right. For v1/2/3/4, you have to use 2. Still see occasional segfault on startup (still running r1833 except for jlink.c patch). The latest version (1857) seems to be ok, no more segfault. I have segfault with V1836 as well. Jlink very snappy with Insight/gdb now after setting jtag_hz to 0 (adaptive). Before at 10 Khz (openocd default for str71x) it was pretty sluggish (but worked OK). With RCLK adaptive it also is stable, so far. Seems to program flash on STR712/IAR eval board much faster too (but just a small program, but seems about the same as programming/debugging at the IAR IDE now). ___ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development
Re: [Openocd-development] OpenOCD and different versions of J-Link
Following patch reads the endpoint numbers from the usb lib device structure, and it removes some of the extra testing that breaks older versions of JLink. This should improve the situation. Hopefully the same trick works under win and mac os. Have a nice day Magnus Index: src/jtag/jlink.c === --- src/jtag/jlink.c (revision 1834) +++ src/jtag/jlink.c (working copy) @@ -36,9 +36,12 @@ #define JLINK_WRITE_ENDPOINT 0x02 #define JLINK_READ_ENDPOINT 0x81 +unsigned int jlink_write_ep = JLINK_WRITE_ENDPOINT; +unsigned int jlink_read_ep = JLINK_READ_ENDPOINT; + #define JLINK_USB_TIMEOUT 1000 -// See Section 1.3.2 of the Segger JLink USB protocol manual +/* See Section 1.3.2 of the Segger JLink USB protocol manual */ /* 2048 is the max value we can use here */ //#define JLINK_TAP_BUFFER_SIZE 2048 #define JLINK_TAP_BUFFER_SIZE 256 @@ -543,7 +546,7 @@ { int result; int len; - u32 jlink_caps, jlink_max_size; + u32 jlink_caps; /* query hardware version */ jlink_simple_command(EMU_CMD_VERSION); @@ -579,21 +582,6 @@ jlink_caps = buf_get_u32(usb_in_buffer, 0, 32); LOG_INFO(JLink caps 0x%x, jlink_caps); - - /* query hardware maximum memory block */ - jlink_simple_command(EMU_CMD_GET_MAX_MEM_BLOCK); - - result = jlink_usb_read(jlink_jtag_handle, 4); - if (4 != result) - { - LOG_ERROR(J-Link command EMU_CMD_GET_MAX_MEM_BLOCK failed (%d)\n, result); - return ERROR_JTAG_DEVICE_ERROR; - } - - jlink_max_size = buf_get_u32(usb_in_buffer, 0, 32); - LOG_INFO(JLink max mem block %i, jlink_max_size); - - return ERROR_OK; } @@ -661,7 +649,7 @@ int bit_index = tap_length % 8; u8 bit = 1 bit_index; - // we do not pad TMS, so be sure to initialize all bits + /* we do not pad TMS, so be sure to initialize all bits */ if (0 == bit_index) { tms_buffer[index] = tdi_buffer[index] = 0; @@ -814,6 +802,24 @@ */ usb_set_altinterface(result-usb_handle, 0); #endif +int i; +for (i =0 ; idev-config[0].interface[0].altsetting[0].bNumEndpoints; i++) +{ + u8 epnum = dev-config[0].interface[0].altsetting[0].endpoint[i].bEndpointAddress; + { + if (epnum0x80) + { + LOG_DEBUG(usb ep in %02x,epnum); + jlink_read_ep = epnum; + } + else + { + LOG_DEBUG(usb ep out %02x,epnum); + jlink_write_ep = epnum; + } + } +} + return result; } } @@ -937,7 +943,7 @@ return -1; } - result = usb_bulk_write_ex(jlink_jtag-usb_handle, JLINK_WRITE_ENDPOINT, + result = usb_bulk_write_ex(jlink_jtag-usb_handle, jlink_write_ep, (char *)usb_out_buffer, out_length, JLINK_USB_TIMEOUT); DEBUG_JTAG_IO(jlink_usb_write, out_length = %d, result = %d, out_length, result); @@ -951,7 +957,7 @@ /* Read data from USB into in_buffer. */ static int jlink_usb_read(jlink_jtag_t *jlink_jtag, int expected_size) { - int result = usb_bulk_read_ex(jlink_jtag-usb_handle, JLINK_READ_ENDPOINT, + int result = usb_bulk_read_ex(jlink_jtag-usb_handle, jlink_read_ep, (char *)usb_in_buffer, expected_size, JLINK_USB_TIMEOUT); DEBUG_JTAG_IO(jlink_usb_read, result = %d, result); @@ -965,7 +971,7 @@ /* Read the result from the previous EMU cmd into result_buffer. */ static int jlink_usb_read_emu_result(jlink_jtag_t *jlink_jtag) { - int result = usb_bulk_read_ex(jlink_jtag-usb_handle, JLINK_READ_ENDPOINT, + int result = usb_bulk_read_ex(jlink_jtag-usb_handle, jlink_read_ep, (char *)usb_emu_result_buffer, 1 /* JLINK_EMU_RESULT_BUFFER_SIZE */, JLINK_USB_TIMEOUT); ___ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development
Re: [Openocd-development] OpenOCD and different versions of J-Link
On Tue, 2009-05-19 at 10:53 +0200, Magnus Lundin wrote: Following patch reads the endpoint numbers from the usb lib device structure, and it removes some of the extra testing that breaks older versions of JLink. Let's not remove the test, even if it only works with newer versions. For now, I would prefer it to be '#if 0'd out or moved to a function. Once we have version detection, we can put it back into the flow. This should improve the situation. Despite the above, I am following this thread and curious about the success with older versions, so please continue testing this. I like to see this progress and hope to make some time of my own to contribute this week. Cheers, Zach ___ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development
Re: [Openocd-development] OpenOCD and different versions of J-Link
Hello Magnus, thanks for your patch... that is half the way needed to make my V3 JLink work. The other thing is that at least mine doesn't support the EMU_CMD_HW_JTAG3 command. This is not documented in the USB protocol description as far as I know. My JLink doesn't answer at all to this command. So I switched to EMU_CMD_HW_JTAG2 I'ts all the same with the exception of the 0-Read for success. With that my JLink works with at least with AT91SAM7S and STM32 Benjamin On Tuesday 19 May 2009 10:53:28 am Magnus Lundin wrote: Following patch reads the endpoint numbers from the usb lib device structure, and it removes some of the extra testing that breaks older versions of JLink. This should improve the situation. Hopefully the same trick works under win and mac os. Have a nice day Magnus ___ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development
Re: [Openocd-development] OpenOCD and different versions of J-Link
Xiaofan Chen wrote: On Mon, May 18, 2009 at 11:09 PM, Gene Smith g...@chartertn.net wrote: Mine says: Updating firmware: J-Link compiled Feb 20 2006 18:20:20 -- Update -- Mine says: Replacing firmware J-Link compiled Dec 2 2004 09:13:33 Mine says: S/N : -3 Kind of strange. Could you try the segger utilities under Windows? Will give it a try. C:\Program Files\SEGGER\JLinkARM_V337ajlink SEGGER J-Link Commander V3.37a ('?' for help) Compiled Aug 8 2006 19:16:44 DLL version V3.37a, compiled Aug 8 2006 19:16:40 Firmware: J-Link ARM V6 compiled Dec 03 2007 17:34:18 Hardware: V6.00 S/N : xx OEM : IAR ... WARNING: No matching core found. Selecting default core (ARM7) *** Error: could not read hardware status! JTAG speed: 5 Hhz J-Link Green LED goes off then *don't* see exactly what you see: What does dmesg says when this happens? Something is wrong with your kernel or this particular version of J-Link. The only thing I see with dmesg or tail -f /var/log/messages is this series of messages when I plug the usb into the yellow jlink. The LED blinks fast for about 30-45 seconds then goes solid when the last message appears: May 19 09:20:20 localhost kernel: usb 5-1: USB disconnect, address 61 May 19 09:20:24 localhost kernel: usb 5-1: new full speed USB device using uhci_hcd and address 62 May 19 09:20:34 localhost kernel: usb 5-1: string descriptor 0 read error: -110 May 19 09:20:54 localhost kernel:last message repeated 2 times May 19 09:20:54 localhost kernel: usb 5-1: configuration #1 chosen from 1 choice May 19 09:20:54 localhost kernel: usb 5-1: New USB device found, idVendor=1366, idProduct=0101 May 19 09:20:54 localhost kernel: usb 5-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 Running openocd command or the segger utility commands does produces no new messages. (FYI: this is fedora 8 with last possible updates.) But openocd commands to the jlink cause the LED to go off but segger commands don't. My libusb on my fedora 8 is libusb-0.1.12-10.fc8. Do you think I might need a newer libusb? That is the last version it updated to. That should be fine. libusb 0.1 has not changed for a while. David Brownell is on this list and he is a prominent member of the Linux USB kernel team. So if there is a real USB/Kernel issue here, I think he can probably help you here. ;-) ___ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development
Re: [Openocd-development] OpenOCD and different versions of J-Link
On Tue, May 19, 2009 at 4:53 PM, Magnus Lundin lun...@mlu.mine.nu wrote: Following patch reads the endpoint numbers from the usb lib device structure, and it removes some of the extra testing that breaks older versions of JLink. This should improve the situation. Hopefully the same trick works under win and mac os. Yes you are right that the output endpoint used is different for my V3 and V6 J-Link. And your patch for detecting the endpoint seems to be right. But I am not a programmer. My black J-Link V3 (IAR OEM version) information from lsusb -vvv. Bus 002 Device 010: ID 1366:0101 Device Descriptor: bLength18 bDescriptorType 1 bcdUSB 1.10 bDeviceClass0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 8 idVendor 0x1366 idProduct 0x0101 bcdDevice0.01 iManufacturer 1 SEGGER iProduct2 J-Link iSerial 3 123456 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 39 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 0 bmAttributes 0xc0 Self Powered MaxPower 100mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber0 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 255 Vendor Specific Class bInterfaceSubClass255 Vendor Specific Subclass bInterfaceProtocol255 Vendor Specific Protocol iInterface 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes2 Transfer TypeBulk Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x01 EP 1 OUT bmAttributes2 Transfer TypeBulk Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 0 Device Status: 0x0001 Self Powered From my yellow J-LINK V6 (IAR OEM version) Bus 002 Device 008: ID 1366:0101 Device Descriptor: bLength18 bDescriptorType 1 bcdUSB 1.10 bDeviceClass0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 8 idVendor 0x1366 idProduct 0x0101 bcdDevice0.01 iManufacturer 1 SEGGER iProduct2 J-Link iSerial 3 123456 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 32 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 0 bmAttributes 0xc0 Self Powered MaxPower 100mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber0 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 255 Vendor Specific Class bInterfaceSubClass255 Vendor Specific Subclass bInterfaceProtocol255 Vendor Specific Protocol iInterface 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes2 Transfer TypeBulk Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x02 EP 2 OUT bmAttributes2 Transfer TypeBulk Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 0 Device Status: 0x0001 Self Powered -- Xiaofan http://mcuee.blogspot.com ___ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development
Re: [Openocd-development] OpenOCD and different versions of J-Link
On Tuesday 19 May 2009 03:19:06 pm Gene Smith wrote: Info : J-Link compiled Dec 2 2004 09:13:33 That seems like a very very old firmware version. And I just remembered something... When I got my JLink, it was on a somewhat old firmware version as well... Linux segger tool did nothing at all... But when I hooked it up to the windows version of these segger tools, it asked me whether to update the device or not. (Wine did not do the job, had to use a native win xp setup for that) After that I could use the linux tool as well Maybe you could try that first Benjamin ___ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development
Re: [Openocd-development] OpenOCD and different versions of J-Link
Magnus Lundin wrote: Following patch reads the endpoint numbers from the usb lib device structure, and it removes some of the extra testing that breaks older versions of JLink. This should improve the situation. Hopefully the same trick works under win and mac os. Have a nice day Magnus See the same messages startup with this as with Benjamin's patch. Also, still see this after connecting with telnet: jlink_info J-Link command EMU_CMD_VERSION failed (-110) Also, don't see segger or j-link mentioned when I do lsusb -vvv ___ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development
Re: [Openocd-development] OpenOCD and different versions of J-Link
On Tue, May 19, 2009 at 9:30 PM, Gene Smith g...@chartertn.net wrote: Running openocd command or the segger utility commands does produces no new messages. (FYI: this is fedora 8 with last possible updates.) But openocd commands to the jlink cause the LED to go off but segger commands don't. Now I see the same behavior of my black J-Link. This is even after adding part of the patch from Magnus to correct the endpoint. Once the LED goes off after running openocd, run Segger's utility and you will know that it is out of sync. So there are still some problems. The only way to recover seems to disconnect everything and restart again. mc...@ubuntu904:~/Desktop/build/openocd/jlink$ ./start SEGGER J-Link Commander V4.03a ('?' for help) Compiled Feb 2 2009 11:34:21 WARNING: Out of sync , resynchronising... WARNING: Out of sync , resynchronising... WARNING: Out of sync , resynchronising... Can not connect to J-Link via USB. J-Linkexit mc...@ubuntu904:~/Desktop/build/openocd/jlinkold$ openocd -f myopenocd.cfg Open On-Chip Debugger 0.2.0-in-development modified J-LINK by Magnus Lundin (2009-05-19-22:19) svn:1836M BUGS? Read http://svn.berlios.de/svnroot/repos/openocd/trunk/BUGS $URL: svn://svn.berlios.de/openocd/trunk/src/openocd.c $ RCLK - adaptive Info : J-Link compiled Feb 20 2006 18:20:20 -- Update -- Info : JLink caps 0x3 Error: J-Link command EMU_CMD_GET_MAX_MEM_BLOCK failed (-110) Info : J-Link compiled Feb 20 2006 18:20:20 -- Update -- Info : JLink caps 0x3 Error: J-Link command EMU_CMD_GET_MAX_MEM_BLOCK failed (-110) Info : J-Link compiled Feb 20 2006 18:20:20 -- Update -- Info : JLink caps 0x3 Error: J-Link command EMU_CMD_GET_MAX_MEM_BLOCK failed (-110) Info : J-Link initial read failed, don't worry Info : J-Link JTAG Interface ready Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (9128). Workaround: increase set remotetimeout in GDB Error: usb_bulk_read failed (requested=1, result=-110) Error: jlink_tap_execute, wrong result -107 (expected 1) Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (3011). Workaround: increase set remotetimeout in GDB Error: usb_bulk_read failed (requested=1, result=-110) Error: jlink_tap_execute, wrong result -107 (expected 1) Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (3238). Workaround: increase set remotetimeout in GDB Error: usb_bulk_read failed (requested=1, result=-110) Error: jlink_tap_execute, wrong result -107 (expected 1) Warn : no tcl port specified, using default port Info : accepting 'telnet' connection from 0 TapName| Enabled | IdCode ExpectedIrLen IrCap IrMask Instr ---||-|||--|--|--|- 0 | lpc2148.cpu|Y| 0x | 0x4f1f0f0f | 0x04 | 0x01 | 0x0f | 0x0f Error: Target not examined yet Runtime error, file command.c, line 453: mc...@ubuntu904:~/Desktop/build/openocd/jlink$ ./start SEGGER J-Link Commander V4.03a ('?' for help) Compiled Feb 2 2009 11:34:21 DLL version V4.03a, compiled Feb 2 2009 11:34:13 Firmware: J-Link compiled Feb 20 2006 18:20:20 -- Update -- Hardware: V3.00 S/N : 3330 OEM : IAR VTarget = 3.290V Info: TotalIRLen = 4, IRPrint = 0x01 WARNING: Identified core does not match configuration. (Found: ARM7, Configured: None) Found 1 JTAG device, Total IRLen = 4: Id of device #0: 0x4F1F0F0F Found ARM with core Id 0x4F1F0F0F (ARM7) ETM V1.2: 1 pairs addr.comp, 0 data comp, 4 MM decs, 1 counters JTAG speed: 5 kHz -- Xiaofan http://mcuee.blogspot.com ___ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development
Re: [Openocd-development] OpenOCD and different versions of J-Link
On Tue, May 19, 2009 at 10:36 PM, Xiaofan Chen xiaof...@gmail.com wrote: Now I see the same behavior of my black J-Link. This is even after adding part of the patch from Magnus to correct the endpoint. Once the LED goes off after running openocd, run Segger's utility and you will know that it is out of sync. So there are still some problems. The only way to recover seems to disconnect everything and restart again. Now if I compare V6 to V3 based on some simple test, it seems my V6 works (no problem with halt target and single step) and my V3 does not (can not halt target and step). I believe your version is similar to my V3 and with even older firmware. -- Xiaofan http://mcuee.blogspot.com ___ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development
Re: [Openocd-development] OpenOCD and different versions of J-Link
On Tue, May 19, 2009 at 10:43 PM, Xiaofan Chen xiaof...@gmail.com wrote: Now if I compare V6 to V3 based on some simple test, it seems my V6 works (no problem with halt target and single step) and my V3 does not (can not halt target and step). But between yesterday (V1809) and today (V1836), something happens to J-Link. Sometimes it segfaults. The next run will be ok. mc...@ubuntu904:~/Desktop/build/openocd/jlinknew$ openocd -f myopenocd.cfg Open On-Chip Debugger 0.2.0-in-development (2009-05-19-21:59) svn:1836 BUGS? Read http://svn.berlios.de/svnroot/repos/openocd/trunk/BUGS $URL: svn://svn.berlios.de/openocd/trunk/src/openocd.c $ RCLK - adaptive Error: J-Link command EMU_CMD_VERSION failed (-110) Segmentation fault mc...@ubuntu904:~/Desktop/build/openocd/jlinknew$ openocd -f myopenocd.cfg Open On-Chip Debugger 0.2.0-in-development (2009-05-19-21:59) svn:1836 BUGS? Read http://svn.berlios.de/svnroot/repos/openocd/trunk/BUGS $URL: svn://svn.berlios.de/openocd/trunk/src/openocd.c $ RCLK - adaptive Error: J-Link command EMU_CMD_VERSION failed (-110) Info : J-Link ARM V6 compiled Dec 03 2007 17:34:18 Info : JLink caps 0xf7fbf Info : JLink max mem block 9992 Info : Vref = 3.248 TCK = 1 TDI = 0 TDO = 0 TMS = 0 SRST = 1 TRST = 1 Info : J-Link JTAG Interface ready Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (3101). Workaround: increase set remotetimeout in GDB Info : JTAG tap: lpc2148.cpu tap/device found: 0x4f1f0f0f (Manufacturer: 0x787, Part: 0xf1f0, Version: 0x4) Info : JTAG Tap/device matched Warn : no tcl port specified, using default port Warn : DBGACK set while target was in unknown state. Reset or initialize target. target state: halted target halted in ARM state due to breakpoint, current mode: System cpsr: 0x805f pc: 0x0894 Info : accepting 'telnet' connection from 0 TapName| Enabled | IdCode ExpectedIrLen IrCap IrMask Instr ---||-|||--|--|--|- 0 | lpc2148.cpu|Y| 0x4f1f0f0f | 0x4f1f0f0f | 0x04 | 0x01 | 0x0f | 0x0c Runtime error, file command.c, line 453: Unknown command: go Runtime error, file command.c, line 453: Unknown command: run Info : JTAG tap: lpc2148.cpu tap/device found: 0x4f1f0f0f (Manufacturer: 0x787, Part: 0xf1f0, Version: 0x4) Info : JTAG Tap/device matched target state: halted target halted in ARM state due to debug-request, current mode: System cpsr: 0x805f pc: 0x085c target state: halted target halted in ARM state due to single-step, current mode: System cpsr: 0x805f pc: 0x0860 -- Xiaofan http://mcuee.blogspot.com ___ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development
Re: [Openocd-development] OpenOCD and different versions of J-Link
Benjamin Schmidt wrote: On Tuesday 19 May 2009 03:19:06 pm Gene Smith wrote: Info : J-Link compiled Dec 2 2004 09:13:33 That seems like a very very old firmware version. And I just remembered something... When I got my JLink, it was on a somewhat old firmware version as well... Linux segger tool did nothing at all... But when I hooked it up to the windows version of these segger tools, it asked me whether to update the device or not. (Wine did not do the job, had to use a native win xp setup for that) After that I could use the linux tool as well Maybe you could try that first Benjamin Just loaded the windows tools and ran J-Link Commander. Can't seem to copy/paste from its terminal so I will type in what it says: SEGGER J-Link Commander V4.05i ('?' for help) Compiled May 18 2009 19:21:08 DLL version V4.05i, compiled May 18 2009 19:20:52 Firmware: J-Link compiled Feb 20 2006 18:20:20 -- Update -- Hardware: V4.30 S/N : 10001576 OEM: IAR VTarget = 3.250V Info: TotalIRLen = 4, IRPrint = 0x01 Found 1 JTAG device, Total IRLen = 4: Id of device #0: 0x3f0f0f0f Found ARM with cord Id 0x3f0f0f0f (ARM7) JTAG speed: 5 kHz This did not ask me to update f/w. I think yesterday linux version may have actually updated it to what is says above, not sure. The info above looks right. The serial number is correct and matches what is printed on the bottom. I may not have mentioned that the Linux version of J-Link Commander always says after starting: Can not connect to J-Link via USB while windows version above issues no such complaint. Appears to probably be a USB comm problem. But I have no problem with other USB devices on same linux box (mem sticks, SD cards, eth adapters, etc.) ___ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development
Re: [Openocd-development] OpenOCD and different versions of J-Link
Hi Info : J-Link compiled Feb 20 2006 18:20:20 -- Update -- Info : JLink caps 0x3 Error: J-Link command EMU_CMD_GET_MAX_MEM_BLOCK failed (-110) Open OCD seems to get reasonable ansvers from first two JLink commands. The /* query hardware maximum memory block */ should not be run for this version, I had removed it in my patch. Next patch will use results from JLink caps to select what info to query. I am waiting for more info from Segger about version diffrences and endpoints. Have a nice day, Magnus ___ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development
Re: [Openocd-development] OpenOCD and different versions of J-Link
On Tue, May 19, 2009 at 9:39 PM, Xiaofan Chen xiaof...@gmail.com wrote: On Tue, May 19, 2009 at 4:53 PM, Magnus Lundin lun...@mlu.mine.nu wrote: Following patch reads the endpoint numbers from the usb lib device structure, and it removes some of the extra testing that breaks older versions of JLink. This should improve the situation. Hopefully the same trick works under win and mac os. Yes you are right that the output endpoint used is different for my V3 and V6 J-Link. And your patch for detecting the endpoint seems to be right. But I am not a programmer. I've tested your patch with V3 and V6 J-Link. I think it does not affect V6 and seem to help V3. Thanks. Maybe at least the endpoint detection part should be commited. -- Xiaofan http://mcuee.blogspot.com ___ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development
Re: [Openocd-development] OpenOCD and different versions of J-Link
Gene Smith wrote: Gene Smith wrote: Benjamin Schmidt wrote: On Tuesday 19 May 2009 03:19:06 pm Gene Smith wrote: Info : J-Link compiled Dec 2 2004 09:13:33 That seems like a very very old firmware version. And I just remembered something... When I got my JLink, it was on a somewhat old firmware version as well... Linux segger tool did nothing at all... But when I hooked it up to the windows version of these segger tools, it asked me whether to update the device or not. (Wine did not do the job, had to use a native win xp setup for that) After that I could use the linux tool as well Maybe you could try that first Benjamin Just loaded the windows tools and ran J-Link Commander. Can't seem to copy/paste from its terminal so I will type in what it says: SEGGER J-Link Commander V4.05i ('?' for help) Compiled May 18 2009 19:21:08 DLL version V4.05i, compiled May 18 2009 19:20:52 Firmware: J-Link compiled Feb 20 2006 18:20:20 -- Update -- Hardware: V4.30 S/N : 10001576 OEM: IAR VTarget = 3.250V Info: TotalIRLen = 4, IRPrint = 0x01 Found 1 JTAG device, Total IRLen = 4: Id of device #0: 0x3f0f0f0f Found ARM with cord Id 0x3f0f0f0f (ARM7) JTAG speed: 5 kHz This did not ask me to update f/w. I think yesterday linux version may have actually updated it to what is says above, not sure. The info above looks right. The serial number is correct and matches what is printed on the bottom. I may not have mentioned that the Linux version of J-Link Commander always says after starting: Can not connect to J-Link via USB while windows version above issues no such complaint. I forgot that I have to run ./start as root or sudo or you get this error. Appears to probably be a USB comm problem. But I have no problem with other USB devices on same linux box (mem sticks, SD cards, eth adapters, etc.) Well, I was wrong. Running this in Windows (XP) does seem to do something to the jlink device. When I put it back on linux version of J-Link Cmdr it now works better (have to run as root). [g...@localhost jlink-segger]$ sudo ./start Password: SEGGER J-Link Commander V4.03a ('?' for help) Compiled Feb 2 2009 11:34:21 DLL version V4.03a, compiled Feb 2 2009 11:34:13 Firmware: J-Link compiled Feb 20 2006 18:20:20 -- Update -- Hardware: V4.30 S/N : 10001576 OEM : IAR VTarget = 3.250V Info: TotalIRLen = 4, IRPrint = 0x01 WARNING: Identified core does not match configuration. (Found: ARM7, Configured: None) Found 1 JTAG device, Total IRLen = 4: Id of device #0: 0x3F0F0F0F Found ARM with core Id 0x3F0F0F0F (ARM7) JTAG speed: 5 kHz J-Linkf Firmware: J-Link compiled Feb 20 2006 18:20:20 -- Update -- Hardware: V4.30 Also, now when I run openocd it seem better now: [g...@localhost src]$ sudo ./openocd -f target/interface/jlink.cfg -f target/board/iar_str712_sk1.cfg Password: Open On-Chip Debugger 0.2.0-in-development (2009-05-19-10:03) svn:1833M BUGS? Read http://svn.berlios.de/svnroot/repos/openocd/trunk/BUGS $URL: svn://localhost:36903/openocd/trunk/src/openocd.c $ 10 kHz Info : J-Link compiled Feb 20 2006 18:20:20 -- Update -- Info : JLink caps 0x3 Info : Vref = 3.251 TCK = 1 TDI = 1 TDO = 0 TMS = 1 SRST = 1 TRST = 1 Info : J-Link JTAG Interface ready Error: usb_bulk_read failed (requested=1, result=-110) Error: jlink_tap_execute, wrong result -107 (expected 1) Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (3217). Workaround: increase set remotetimeout in GDB Error: usb_bulk_read failed (requested=1, result=-110) Error: jlink_tap_execute, wrong result -107 (expected 1) Error: usb_bulk_read failed (requested=1, result=-110) Error: jlink_tap_execute, wrong result -107 (expected 1) Warn : no telnet port specified, using default port Warn : no gdb port specified, using default port Warn : no tcl port specified, using default port However, when telnet'ing, I still get usb_bulk_read failed errors when I do anything such as jlink_info, halt or reg. A few more observations: When I plug the linux usb to the jlink the blinking time is now only about a second (before it was 30-45 seconds). Also, lsusb -vvv now shows the segger device like Xiaofan posted. So running the windows J-Link Cmdr did something to the jlink. I am using the jlink.c patch from Magnus he posted this morning. -gene OK, one more reply to self... Using the Magnus patch, I just noticed that after openocd starts the jlink LED goes off indicating further USB comm is not possible (it seems to be true) and telnet cmds fail. If I try to restart oocd, I again get the 3 failed retries on get caps and don't worry like before. If I revert to Benjamin's patch, it comes up clean with no errors. Now I can do telnet commands with no problem (such as jlink_info, mdb, reg, etc). Possibly the intention was to combine these patches, I am not sure. But anyhow, for what its
Re: [Openocd-development] OpenOCD and different versions of J-Link
On Wed, May 20, 2009 at 12:53 AM, Gene Smith g...@chartertn.net wrote: Using the Magnus patch, I just noticed that after openocd starts the jlink LED goes off indicating further USB comm is not possible (it seems to be true) and telnet cmds fail. If I try to restart oocd, I again get the 3 failed retries on get caps and don't worry like before. This is in line with my testing of V3. You have a V4. If I revert to Benjamin's patch, it comes up clean with no errors. Now I can do telnet commands with no problem (such as jlink_info, mdb, reg, etc). Glad to know that. I will try Ben's patch. Possibly the intention was to combine these patches, I am not sure. But anyhow, for what its worth, it is now seems to be working for me with Ben's patch. (I have not tried to do anything with gdb yet.) -- Xiaofan http://mcuee.blogspot.com ___ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development
Re: [Openocd-development] OpenOCD and different versions of J-Link
On Wed, May 20, 2009 at 12:04 AM, Gene Smith g...@chartertn.net wrote: I forgot that I have to run ./start as root or sudo or you get this error. It is not difficult to apply the correct udev rules to be able to run openocd or ./start as normal user. OpenOCD has an example in the distribution. You can get more examples here: http://piklab.wiki.sourceforge.net/USB+Port+Problems I think you should be fine with either the PolicyKit version or the Suse/Arch version since you are using Fedora 8. You just need to change the VID/PID to your J-Link. -- Xiaofan http://mcuee.blogspot.com ___ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development
Re: [Openocd-development] OpenOCD and different versions of J-Link
On Wed, May 20, 2009 at 12:53 AM, Gene Smith g...@chartertn.net wrote: OK, one more reply to self... Using the Magnus patch, I just noticed that after openocd starts the jlink LED goes off indicating further USB comm is not possible (it seems to be true) and telnet cmds fail. If I try to restart oocd, I again get the 3 failed retries on get caps and don't worry like before. If I revert to Benjamin's patch, it comes up clean with no errors. Now I can do telnet commands with no problem (such as jlink_info, mdb, reg, etc). Possibly the intention was to combine these patches, I am not sure. But anyhow, for what its worth, it is now seems to be working for me with Ben's patch. (I have not tried to do anything with gdb yet.) I can see two big differences between the patches. In Ben's patch, -#define EMU_CMD_HW_JTAG3 0xcf +#define EMU_CMD_HW_JTAG3 0xce (maybe this is EMU_CMD_HW_JTAG2 according to Ben's Mach 16 patch). /* max speed 12MHz v5.0 jlink */ -#define JLINK_MAX_SPEED 12000 (this is only for V5/6/7/Pro) +#define JLINK_MAX_SPEED 4000 (this is for V1/2/3/4 according to Segger) The common thing is to correct the endpoint and remove the EMU_CMD_GET_MAX_MEM_BLOCK command. Ben's patch remove more things. I will give it a try after work. -- Xiaofan http://mcuee.blogspot.com ___ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development
Re: [Openocd-development] OpenOCD and different versions of J-Link
The following patch combines my previous patch with most of Ben's patch. It can use both EMU_CMD_HW_JTAG2 and EMU_CMD_HW_JTAG3 It defaults to EMU_CMD_HW_JTAG2 so it should work with all interfaces but EMU_CMD_HW_JTAG3 is recommended by SEgger, you can change the behaviour with jlink_hw_jtag 3 or jlink_hw_jtag 2 Autodetection can be done when we know which versions JLink can use what setting, (-d3 logs of setup messages ) Have a nice day Magnus Xiaofan Chen wrote: On Wed, May 20, 2009 at 12:53 AM, Gene Smith g...@chartertn.net wrote: OK, one more reply to self... Using the Magnus patch, I just noticed that after openocd starts the jlink LED goes off indicating further USB comm is not possible (it seems to be true) and telnet cmds fail. If I try to restart oocd, I again get the 3 failed retries on get caps and don't worry like before. If I revert to Benjamin's patch, it comes up clean with no errors. Now I can do telnet commands with no problem (such as jlink_info, mdb, reg, etc). Possibly the intention was to combine these patches, I am not sure. But anyhow, for what its worth, it is now seems to be working for me with Ben's patch. (I have not tried to do anything with gdb yet.) I can see two big differences between the patches. In Ben's patch, -#define EMU_CMD_HW_JTAG3 0xcf +#define EMU_CMD_HW_JTAG3 0xce (maybe this is EMU_CMD_HW_JTAG2 according to Ben's Mach 16 patch). /* max speed 12MHz v5.0 jlink */ -#define JLINK_MAX_SPEED 12000 (this is only for V5/6/7/Pro) +#define JLINK_MAX_SPEED 4000 (this is for V1/2/3/4 according to Segger) The common thing is to correct the endpoint and remove the EMU_CMD_GET_MAX_MEM_BLOCK command. Ben's patch remove more things. I will give it a try after work. Index: src/jtag/jlink.c === --- src/jtag/jlink.c (revision 1834) +++ src/jtag/jlink.c (working copy) @@ -36,9 +36,13 @@ #define JLINK_WRITE_ENDPOINT 0x02 #define JLINK_READ_ENDPOINT 0x81 +unsigned int jlink_write_ep = JLINK_WRITE_ENDPOINT; +unsigned int jlink_read_ep = JLINK_READ_ENDPOINT; +unsigned int jlink_hw_jtag_version = 2; + #define JLINK_USB_TIMEOUT 1000 -// See Section 1.3.2 of the Segger JLink USB protocol manual +/* See Section 1.3.2 of the Segger JLink USB protocol manual */ /* 2048 is the max value we can use here */ //#define JLINK_TAP_BUFFER_SIZE 2048 #define JLINK_TAP_BUFFER_SIZE 256 @@ -60,6 +64,7 @@ #define EMU_CMD_HW_CLOCK 0xc8 #define EMU_CMD_HW_TMS0 0xc9 #define EMU_CMD_HW_TMS1 0xca +#define EMU_CMD_HW_JTAG2 0xce #define EMU_CMD_HW_JTAG3 0xcf #define EMU_CMD_GET_MAX_MEM_BLOCK 0xd4 #define EMU_CMD_HW_RESET0 0xdc @@ -67,6 +72,7 @@ #define EMU_CMD_HW_TRST0 0xde #define EMU_CMD_HW_TRST1 0xdf #define EMU_CMD_GET_CAPS 0xe8 +#define EMU_CMD_GET_HW_VERSION 0xf0 /* max speed 12MHz v5.0 jlink */ #define JLINK_MAX_SPEED 12000 @@ -82,6 +88,7 @@ /* CLI command handler functions */ static int jlink_handle_jlink_info_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); +static int jlink_handle_jlink_hw_jtag_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); /* Queue command functions */ static void jlink_end_state(tap_state_t state); @@ -301,8 +308,11 @@ static int jlink_register_commands(struct command_context_s *cmd_ctx) { + register_command(cmd_ctx, NULL, jlink_info, jlink_handle_jlink_info_command, COMMAND_EXEC, query jlink info); + register_command(cmd_ctx, NULL, jlink_hw_jtag, jlink_handle_jlink_hw_jtag_command, COMMAND_EXEC, + set/get jlink hw jtag command version [2|3]); return ERROR_OK; } @@ -318,6 +328,7 @@ return ERROR_JTAG_INIT_FAILED; } + jlink_hw_jtag_version = 2; check_cnt = 0; while (check_cnt 3) { @@ -543,7 +554,7 @@ { int result; int len; - u32 jlink_caps, jlink_max_size; + u32 jlink_caps, jlink_max_size, jlink_hw_version; /* query hardware version */ jlink_simple_command(EMU_CMD_VERSION); @@ -579,21 +590,38 @@ jlink_caps = buf_get_u32(usb_in_buffer, 0, 32); LOG_INFO(JLink caps 0x%x, jlink_caps); + if (jlink_caps (11)) /* EMU_CAP_GET_HW_VERSION */ + { + /* query hardware version */ + jlink_simple_command(EMU_CMD_GET_HW_VERSION); - /* query hardware maximum memory block */ - jlink_simple_command(EMU_CMD_GET_MAX_MEM_BLOCK); + result = jlink_usb_read(jlink_jtag_handle, 4); + if (4 != result) + { + LOG_ERROR(J-Link command EMU_CMD_GET_HW_VERSION failed (%d)\n, result); + return ERROR_JTAG_DEVICE_ERROR; + } - result = jlink_usb_read(jlink_jtag_handle, 4); - if (4 != result) - { - LOG_ERROR(J-Link command EMU_CMD_GET_MAX_MEM_BLOCK failed (%d)\n, result); - return ERROR_JTAG_DEVICE_ERROR; + jlink_hw_version = buf_get_u32(usb_in_buffer, 0, 32); + LOG_INFO(JLink hw version %i, jlink_hw_version); } - jlink_max_size = buf_get_u32(usb_in_buffer, 0, 32); - LOG_INFO(JLink max mem
Re: [Openocd-development] OpenOCD and different versions of J-Link
Xiaofan Chen wrote: 2008/12/25 Michel Catudal michelcatu...@gmail.com: I could not get my older black j-link devices to work while the newer yellow one works. I am curious as to what the basic difference would be between the two. I tested them at work and they were working just as good on windows as the yellow one with IAR 5.2. (I don't use windows at home) Sorry to rehash this thread as I am interested in this topic as well. I have both black J-link and yellow one at work. Yellow ones are mostly of V5/V6 (and V7?) firmware. The one I have is for V6. The black one I have is of the old V3 version. The MCU used is different as far as I know. It seems to me that the Black one is using a Renesas MCU (M16C?). The yellow one seems to use AT91SAM7S. I can't answer your questions but can only add another jlink question. I know very little about the jlink. I have a yellow jlink that says jlink ks, IAR Systems on the front (ks = kickstart?). On the back it says J-Link-ARM-KS Serial Number 10001576. No idea of the rev level or processor it contains (it is borrowed). The evaluation board I am connecting it to is IAR (made by Olimex) STR712 (ARM7TDMI). Should this work with openocd? If so, what is the correct linux/bash command line? It works OK with IAR Embedded Workbench Kickstart for ARM 4.30A on windows. Right now whether the board is powered on or off or even if the jtag cable is connected or not all I see is: sudo ./openocd -f target/interface/jlink -f target/target/str710.cfg Error: J-Link Command 0x01 failed (-2) Error: J-Link command EMU_CMD_VERSION failed (-110) repeated 3 times Info : J-Link initial read failed, don't worry -- actually, need to worry! Info : J-Link JTAG Interface ready Error: J-Link command 0xdd failed (-2) Error: J-Link command 0xdf failed (-2) Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (9190). Workaround: increase set remotetimeout in GDB Error: J-Link setting speed failed (-2) Error: There are no enabled taps? Error: J-Link command 0xdd failed (-2) Error: J-Link command 0xdf failed (-2) Error: usb_bulk_write failed (requested=6, result=-2) Error: jlink_tap_execute, wrong result -107 (expected 1) Error: usb_bulk_write failed (requested=6, result=-2) Error: jlink_tap_execute, wrong result -107 (expected 1) Error: J-Link command 0xdd failed (-2) Error: J-Link command 0xdf failed (-2) Error: usb_bulk_write failed (requested=6, result=-2) Error: jlink_tap_execute, wrong result -107 (expected 1) Error: There are no enabled taps? Warn : no telnet port specified, using default port Warn : no gdb ports allocated as no target has been specified Warn : no tcl port specified, using default port Info : accepting 'telnet' connection from 0 Error: J-Link command 0x01 failed (-2) (Then I can telnet but can do nothing useful.) -gene ___ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development
Re: [Openocd-development] OpenOCD and different versions of J-Link
On Mon, May 18, 2009 at 9:37 PM, Gene Smith g...@chartertn.net wrote: I can't answer your questions but can only add another jlink question. I know very little about the jlink. I have a yellow jlink that says jlink ks, IAR Systems on the front (ks = kickstart?). On the back it says J-Link-ARM-KS Serial Number 10001576. No idea of the rev level or processor it contains (it is borrowed). http://www.segger.com/download_jlink.html You can download the beta software for Linux. Here is what I get for the V6 Jlink. mc...@ubuntu904:~/Desktop/build/openocd/jlink$ ./start SEGGER J-Link Commander V4.03a ('?' for help) Compiled Feb 2 2009 11:34:21 Updating firmware: J-Link ARM V6 compiled Jan 15 2009 11:58:34 Replacing firmware: J-Link ARM V6 compiled Dec 03 2007 17:34:18 Waiting for new firmware to boot New firmware booted successfully ** Error: Communication timed out after firmware update DLL version V4.03a, compiled Feb 2 2009 11:34:13 Unable to retrieve firmware info ! S/N : 156007287 OEM : IAR VTarget = 3.248V Info: TotalIRLen = 4, IRPrint = 0x01 WARNING: Identified core does not match configuration. (Found: ARM7, Configured: None) Found 1 JTAG device, Total IRLen = 4: Id of device #0: 0x4F1F0F0F Found ARM with core Id 0x4F1F0F0F (ARM7) ETM V1.2: 1 pairs addr.comp, 0 data comp, 4 MM decs, 1 counters RTCK reaction time is approx. 126ns Using adaptive clocking instead of fixed JTAG speed. The evaluation board I am connecting it to is IAR (made by Olimex) STR712 (ARM7TDMI). Should this work with openocd? If so, what is the correct linux/bash command line? It works OK with IAR Embedded Workbench Kickstart for ARM 4.30A on windows. Right now whether the board is powered on or off or even if the jtag cable is connected or not all I see is: sudo ./openocd -f target/interface/jlink -f target/target/str710.cfg Error: J-Link Command 0x01 failed (-2) Error: J-Link command EMU_CMD_VERSION failed (-110) repeated 3 times Info : J-Link initial read failed, don't worry -- actually, need to worry! Info : J-Link JTAG Interface ready Error: J-Link command 0xdd failed (-2) Error: J-Link command 0xdf failed (-2) Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (9190). Workaround: increase set remotetimeout in GDB Error: J-Link setting speed failed (-2) Error: There are no enabled taps? Error: J-Link command 0xdd failed (-2) Error: J-Link command 0xdf failed (-2) Error: usb_bulk_write failed (requested=6, result=-2) Error: jlink_tap_execute, wrong result -107 (expected 1) Error: usb_bulk_write failed (requested=6, result=-2) Error: jlink_tap_execute, wrong result -107 (expected 1) Error: J-Link command 0xdd failed (-2) Error: J-Link command 0xdf failed (-2) Error: usb_bulk_write failed (requested=6, result=-2) Error: jlink_tap_execute, wrong result -107 (expected 1) Error: There are no enabled taps? Warn : no telnet port specified, using default port Warn : no gdb ports allocated as no target has been specified Warn : no tcl port specified, using default port Info : accepting 'telnet' connection from 0 Error: J-Link command 0x01 failed (-2) (Then I can telnet but can do nothing useful.) Similar error message here with latest svn version but it seems to work. mc...@ubuntu904:~/Desktop/build/openocd/jlinknew$ openocd -f openocd_lpc2148.cfg Open On-Chip Debugger 0.2.0-in-development (2009-05-18-19:51) svn:1809 BUGS? Read http://svn.berlios.de/svnroot/repos/openocd/trunk/BUGS $URL: svn://svn.berlios.de/openocd/trunk/src/openocd.c $ jtag_speed: 15 force hard breakpoints Error: J-Link command EMU_CMD_VERSION failed (-110) Info : J-Link ARM V6 compiled Dec 03 2007 17:34:18 Info : JLink caps 0xf7fbf Info : JLink max mem block 9992 Info : Vref = 3.248 TCK = 1 TDI = 0 TDO = 0 TMS = 0 SRST = 1 TRST = 1 Info : J-Link JTAG Interface ready Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (3104). Workaround: increase set remotetimeout in GDB Error: usb_bulk_read failed (requested=1, result=-110) Error: jlink_tap_execute, wrong result -107 (expected 1) Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (3012). Workaround: increase set remotetimeout in GDB Error: usb_bulk_read failed (requested=1, result=-110) Error: jlink_tap_execute, wrong result -107 (expected 1) Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (3237). Workaround: increase set remotetimeout in GDB Error: usb_bulk_read failed (requested=1, result=-110) Error: jlink_tap_execute, wrong result -107 (expected 1) Warn : no tcl port specified, using default port Info : accepting 'telnet' connection from 0 TapName| Enabled | IdCode ExpectedIrLen IrCap IrMask Instr ---||-|||--|--|--|- 0 | lpc2148.cpu|Y| 0x | 0x4f1f0f0f | 0x04 | 0x01
Re: [Openocd-development] OpenOCD and different versions of J-Link
On Mon, May 18, 2009 at 10:18 PM, Xiaofan Chen xiaof...@gmail.com wrote: mc...@ubuntu904:~/Desktop/build/openocd/jlinknew$ openocd -f openocd_lpc2148.cfg Open On-Chip Debugger 0.2.0-in-development (2009-05-18-19:51) svn:1809 BUGS? Read http://svn.berlios.de/svnroot/repos/openocd/trunk/BUGS $URL: svn://svn.berlios.de/openocd/trunk/src/openocd.c $ jtag_speed: 15 force hard breakpoints Error: J-Link command EMU_CMD_VERSION failed (-110) Info : J-Link ARM V6 compiled Dec 03 2007 17:34:18 Info : JLink caps 0xf7fbf Info : JLink max mem block 9992 Info : Vref = 3.248 TCK = 1 TDI = 0 TDO = 0 TMS = 0 SRST = 1 TRST = 1 Info : J-Link JTAG Interface ready Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (3104). Workaround: increase set remotetimeout in GDB Error: usb_bulk_read failed (requested=1, result=-110) Error: jlink_tap_execute, wrong result -107 (expected 1) Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (3012). Workaround: increase set remotetimeout in GDB Error: usb_bulk_read failed (requested=1, result=-110) Error: jlink_tap_execute, wrong result -107 (expected 1) Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (3237). Workaround: increase set remotetimeout in GDB Error: usb_bulk_read failed (requested=1, result=-110) Error: jlink_tap_execute, wrong result -107 (expected 1) Warn : no tcl port specified, using default port Info : accepting 'telnet' connection from 0 TapName | Enabled | IdCode Expected IrLen IrCap IrMask Instr ---||-|||--|--|--|- 0 | lpc2148.cpu | Y | 0x | 0x4f1f0f0f | 0x04 | 0x01 | 0x0f | 0x0f mc...@ubuntu904:~/Desktop/build/openocd/jlinknew$ telnet localhost Trying ::1... Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. Open On-Chip Debugger scan_chain TapName | Enabled | IdCode Expected IrLen IrCap IrMask Instr ---||-|||--|--|--|- 0 | lpc2148.cpu | Y | 0x | 0x4f1f0f0f | 0x04 | 0x01 | 0x0f | 0x0f Same test for the black V3 Jlink. mc...@ubuntu904:~/Desktop/build/openocd/jlinkold$ openocd -f openocd_lpc2148.cfg Open On-Chip Debugger 0.2.0-in-development (2009-05-18-19:51) svn:1809 BUGS? Read http://svn.berlios.de/svnroot/repos/openocd/trunk/BUGS $URL: svn://svn.berlios.de/openocd/trunk/src/openocd.c $ jtag_speed: 15 force hard breakpoints Error: J-Link command 0x01 failed (-2) Error: J-Link command EMU_CMD_VERSION failed (-110) Error: J-Link command 0x01 failed (-2) Error: J-Link command EMU_CMD_VERSION failed (-110) Error: J-Link command 0x01 failed (-2) Error: J-Link command EMU_CMD_VERSION failed (-110) Info : J-Link initial read failed, don't worry Info : J-Link JTAG Interface ready Error: J-Link command 0xdd failed (-2) Error: J-Link command 0xdf failed (-2) Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (9087). Workaround: increase set remotetimeout in GDB Error: J-Link setting speed failed (-2) Error: usb_bulk_write failed (requested=6, result=-2) Error: jlink_tap_execute, wrong result -107 (expected 1) Error: J-Link command 0xdd failed (-2) Error: J-Link command 0xde failed (-2) Error: J-Link command 0xdc failed (-2) Error: J-Link command 0xde failed (-2) Error: J-Link command 0xdd failed (-2) Error: J-Link command 0xdf failed (-2) Error: usb_bulk_write failed (requested=6, result=-2) Error: jlink_tap_execute, wrong result -107 (expected 1) Error: usb_bulk_write failed (requested=6, result=-2) Error: jlink_tap_execute, wrong result -107 (expected 1) Warn : no tcl port specified, using default port Info : accepting 'telnet' connection from 0 TapName| Enabled | IdCode ExpectedIrLen IrCap IrMask Instr ---||-|||--|--|--|- 0 | lpc2148.cpu|Y| 0x | 0x4f1f0f0f | 0x04 | 0x01 | 0x0f | 0x0f mc...@ubuntu904:~/Desktop/build/openocd/jlinknew$ telnet localhost Trying ::1... Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. Open On-Chip Debugger scan_chain TapName| Enabled | IdCode ExpectedIrLen IrCap IrMask Instr ---||-|||--|--|--|- 0 | lpc2148.cpu|Y| 0x | 0x4f1f0f0f | 0x04 | 0x01 | 0x0f | 0x0f More error messages. I need to learn more about openocd to carry out more tests. I have the Olimex LPC-P2148 board at home. It seemed to me that different Jlink version may need different codes to deal with. -- Xiaofan http://mcuee.blogspot.com ___ Openocd-development mailing list
Re: [Openocd-development] OpenOCD and different versions of J-Link
More tests on flash writing. I got the script from psas. Maybe it is too old (for V1257). I will try later with new scripts. http://www.linuxjournal.com/article/10421 With black J-link script oocd_flash_lpc2148.script J-Link command 0xdd failed (-2) J-Link command 0xde failed (-2) J-Link command 0xdc failed (-2) J-Link command 0xde failed (-2) J-Link command 0xdd failed (-2) J-Link command 0xdf failed (-2) usb_bulk_write failed (requested=6, result=-2) jlink_tap_execute, wrong result -107 (expected 1) usb_bulk_write failed (requested=6, result=-2) jlink_tap_execute, wrong result -107 (expected 1) Runtime error, file embedded:startup.tcl, line 172: error: -104 in procedure 'ocd_process_reset' Runtime error, file oocd_flash_lpc2148.script, line 10: in procedure 'script' called at file command.c, line 453 called at file embedded:startup.tcl, line 122 With Yellow Jlink script oocd_flash_lpc2148.script usb_bulk_read failed (requested=1, result=-110) jlink_tap_execute, wrong result -107 (expected 1) keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (3245). Workaround: increase set remotetimeout in GDB usb_bulk_read failed (requested=1, result=-110) jlink_tap_execute, wrong result -107 (expected 1) Runtime error, file embedded:startup.tcl, line 172: error: -104 in procedure 'ocd_process_reset' Runtime error, file oocd_flash_lpc2148.script, line 10: in procedure 'script' called at file command.c, line 453 called at file embedded:startup.tcl, line 122 -- Xiaofan http://mcuee.blogspot.com ___ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development
Re: [Openocd-development] OpenOCD and different versions of J-Link
Xiaofan Chen wrote: On Mon, May 18, 2009 at 9:37 PM, Gene Smith g...@chartertn.net wrote: I can't answer your questions but can only add another jlink question. I know very little about the jlink. I have a yellow jlink that says jlink ks, IAR Systems on the front (ks = kickstart?). On the back it says J-Link-ARM-KS Serial Number 10001576. No idea of the rev level or processor it contains (it is borrowed). http://www.segger.com/download_jlink.html You can download the beta software for Linux. Here is what I get for the V6 Jlink. Yes, found it too. mc...@ubuntu904:~/Desktop/build/openocd/jlink$ ./start SEGGER J-Link Commander V4.03a ('?' for help) Compiled Feb 2 2009 11:34:21 Updating firmware: J-Link ARM V6 compiled Jan 15 2009 11:58:34 Mine says: Updating firmware: J-Link compiled Feb 20 2006 18:20:20 -- Update -- Replacing firmware: J-Link ARM V6 compiled Dec 03 2007 17:34:18 Mine says: Replacing firmware J-Link compiled Dec 2 2004 09:13:33 Waiting for new firmware to boot New firmware booted successfully ** Error: Communication timed out after firmware update DLL version V4.03a, compiled Feb 2 2009 11:34:13 Unable to retrieve firmware info ! S/N : 156007287 Mine says: S/N : -3 WARNING: No matching core found. Selecting default core (ARM7) *** Error: could not read hardware status! JTAG speed: 5 Hhz J-Link Green LED goes off then *don't* see exactly what you see: OEM : IAR VTarget = 3.248V Info: TotalIRLen = 4, IRPrint = 0x01 WARNING: Identified core does not match configuration. (Found: ARM7, Configured: None) Found 1 JTAG device, Total IRLen = 4: Id of device #0: 0x4F1F0F0F Found ARM with core Id 0x4F1F0F0F (ARM7) ETM V1.2: 1 pairs addr.comp, 0 data comp, 4 MM decs, 1 counters RTCK reaction time is approx. 126ns Using adaptive clocking instead of fixed JTAG speed. The evaluation board I am connecting it to is IAR (made by Olimex) STR712 (ARM7TDMI). Should this work with openocd? If so, what is the correct linux/bash command line? It works OK with IAR Embedded Workbench Kickstart for ARM 4.30A on windows. Right now whether the board is powered on or off or even if the jtag cable is connected or not all I see is: sudo ./openocd -f target/interface/jlink -f target/target/str710.cfg Error: J-Link Command 0x01 failed (-2) Error: J-Link command EMU_CMD_VERSION failed (-110) repeated 3 times Info : J-Link initial read failed, don't worry -- actually, need to worry! Info : J-Link JTAG Interface ready Error: J-Link command 0xdd failed (-2) Error: J-Link command 0xdf failed (-2) Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (9190). Workaround: increase set remotetimeout in GDB Error: J-Link setting speed failed (-2) Error: There are no enabled taps? Error: J-Link command 0xdd failed (-2) Error: J-Link command 0xdf failed (-2) Error: usb_bulk_write failed (requested=6, result=-2) Error: jlink_tap_execute, wrong result -107 (expected 1) Error: usb_bulk_write failed (requested=6, result=-2) Error: jlink_tap_execute, wrong result -107 (expected 1) Error: J-Link command 0xdd failed (-2) Error: J-Link command 0xdf failed (-2) Error: usb_bulk_write failed (requested=6, result=-2) Error: jlink_tap_execute, wrong result -107 (expected 1) Error: There are no enabled taps? Warn : no telnet port specified, using default port Warn : no gdb ports allocated as no target has been specified Warn : no tcl port specified, using default port Info : accepting 'telnet' connection from 0 Error: J-Link command 0x01 failed (-2) (Then I can telnet but can do nothing useful.) Similar error message here with latest svn version but it seems to work. mc...@ubuntu904:~/Desktop/build/openocd/jlinknew$ openocd -f openocd_lpc2148.cfg Open On-Chip Debugger 0.2.0-in-development (2009-05-18-19:51) svn:1809 BUGS? Read http://svn.berlios.de/svnroot/repos/openocd/trunk/BUGS $URL: svn://svn.berlios.de/openocd/trunk/src/openocd.c $ jtag_speed: 15 force hard breakpoints Error: J-Link command EMU_CMD_VERSION failed (-110) But I see three re-tries on this at all fail. Yours seems to only fail once. Then yours seems to do useful stuff: Info : J-Link ARM V6 compiled Dec 03 2007 17:34:18 Info : JLink caps 0xf7fbf Info : JLink max mem block 9992 Info : Vref = 3.248 TCK = 1 TDI = 0 TDO = 0 TMS = 0 SRST = 1 TRST = 1 Info : J-Link JTAG Interface ready Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (3104). Workaround: increase set remotetimeout in GDB Error: usb_bulk_read failed (requested=1, result=-110) Error: jlink_tap_execute, wrong result -107 (expected 1) Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (3012). Workaround: increase set remotetimeout in GDB Error: usb_bulk_read failed (requested=1, result=-110) Error: jlink_tap_execute, wrong result -107 (expected 1) Warn : keep_alive() was
Re: [Openocd-development] OpenOCD and different versions of J-Link
Hello, I posted a similar patch several month ago. I have a JLink version v3.0 To get it to work you have to change several little things. This is just a very ugly hack that somewhat disables support for =V5 JLinks I'd just be interested if any of you can also get it to work this way... I would like to build a clean version of this patch that doesen't break the rest of the system, but I'd need some more help as I'm not experienced in any openocd/jtag code If you're interested I can explaine all the things that I needed to change... Benjamin Schmidt On Monday 18 May 2009 05:09:06 pm Gene Smith wrote: Xiaofan Chen wrote: On Mon, May 18, 2009 at 9:37 PM, Gene Smith g...@chartertn.net wrote: I can't answer your questions but can only add another jlink question. I know very little about the jlink. I have a yellow jlink that says jlink ks, IAR Systems on the front (ks = kickstart?). On the back it says J-Link-ARM-KS Serial Number 10001576. No idea of the rev level or processor it contains (it is borrowed). http://www.segger.com/download_jlink.html You can download the beta software for Linux. Here is what I get for the V6 Jlink. Yes, found it too. mc...@ubuntu904:~/Desktop/build/openocd/jlink$ ./start SEGGER J-Link Commander V4.03a ('?' for help) Compiled Feb 2 2009 11:34:21 Updating firmware: J-Link ARM V6 compiled Jan 15 2009 11:58:34 Mine says: Updating firmware: J-Link compiled Feb 20 2006 18:20:20 -- Update -- Replacing firmware: J-Link ARM V6 compiled Dec 03 2007 17:34:18 Mine says: Replacing firmware J-Link compiled Dec 2 2004 09:13:33 Waiting for new firmware to boot New firmware booted successfully ** Error: Communication timed out after firmware update DLL version V4.03a, compiled Feb 2 2009 11:34:13 Unable to retrieve firmware info ! S/N : 156007287 Mine says: S/N : -3 WARNING: No matching core found. Selecting default core (ARM7) *** Error: could not read hardware status! JTAG speed: 5 Hhz J-Link Green LED goes off then *don't* see exactly what you see: OEM : IAR VTarget = 3.248V Info: TotalIRLen = 4, IRPrint = 0x01 WARNING: Identified core does not match configuration. (Found: ARM7, Configured: None) Found 1 JTAG device, Total IRLen = 4: Id of device #0: 0x4F1F0F0F Found ARM with core Id 0x4F1F0F0F (ARM7) ETM V1.2: 1 pairs addr.comp, 0 data comp, 4 MM decs, 1 counters RTCK reaction time is approx. 126ns Using adaptive clocking instead of fixed JTAG speed. The evaluation board I am connecting it to is IAR (made by Olimex) STR712 (ARM7TDMI). Should this work with openocd? If so, what is the correct linux/bash command line? It works OK with IAR Embedded Workbench Kickstart for ARM 4.30A on windows. Right now whether the board is powered on or off or even if the jtag cable is connected or not all I see is: sudo ./openocd -f target/interface/jlink -f target/target/str710.cfg Error: J-Link Command 0x01 failed (-2) Error: J-Link command EMU_CMD_VERSION failed (-110) repeated 3 times Info : J-Link initial read failed, don't worry -- actually, need to worry! Info : J-Link JTAG Interface ready Error: J-Link command 0xdd failed (-2) Error: J-Link command 0xdf failed (-2) Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (9190). Workaround: increase set remotetimeout in GDB Error: J-Link setting speed failed (-2) Error: There are no enabled taps? Error: J-Link command 0xdd failed (-2) Error: J-Link command 0xdf failed (-2) Error: usb_bulk_write failed (requested=6, result=-2) Error: jlink_tap_execute, wrong result -107 (expected 1) Error: usb_bulk_write failed (requested=6, result=-2) Error: jlink_tap_execute, wrong result -107 (expected 1) Error: J-Link command 0xdd failed (-2) Error: J-Link command 0xdf failed (-2) Error: usb_bulk_write failed (requested=6, result=-2) Error: jlink_tap_execute, wrong result -107 (expected 1) Error: There are no enabled taps? Warn : no telnet port specified, using default port Warn : no gdb ports allocated as no target has been specified Warn : no tcl port specified, using default port Info : accepting 'telnet' connection from 0 Error: J-Link command 0x01 failed (-2) (Then I can telnet but can do nothing useful.) Similar error message here with latest svn version but it seems to work. mc...@ubuntu904:~/Desktop/build/openocd/jlinknew$ openocd -f openocd_lpc2148.cfg Open On-Chip Debugger 0.2.0-in-development (2009-05-18-19:51) svn:1809 BUGS? Read http://svn.berlios.de/svnroot/repos/openocd/trunk/BUGS $URL: svn://svn.berlios.de/openocd/trunk/src/openocd.c $ jtag_speed: 15 force hard breakpoints Error: J-Link command EMU_CMD_VERSION failed (-110) But I see three re-tries on this at all fail. Yours seems to only fail once. Then yours seems to do useful stuff: Info : J-Link ARM V6 compiled Dec 03 2007 17:34:18
Re: [Openocd-development] OpenOCD and different versions of J-Link
Benjamin Schmidt wrote: There's this segger closed source linux gdm server tool... http://www.segger.com/pub/jlink/JLink_Linux_090202.tar.gz It can show the hardware version. With patch still gets three EMU_CMD_GET_CAPS errors and don't worry. Then LED goes off on jlink. Should it go off? Not sure how I know that it is definitely working or not working. Reset halt command fails usb_bulk_read failed flash info 0 seems to work. Will try the link above in morning. What command line do you use to start openocd with jlink and str712 board? Thanks for any pointers you can provide! -gene On Monday 18 May 2009 11:24:51 pm Gene Smith wrote: Benjamin Schmidt wrote: Hello, I posted a similar patch several month ago. I have a JLink version v3.0 To get it to work you have to change several little things. This is just a very ugly hack that somewhat disables support for =V5 JLinks I'd just be interested if any of you can also get it to work this way... I would like to build a clean version of this patch that doesen't break the rest of the system, but I'd need some more help as I'm not experienced in any openocd/jtag code If you're interested I can explaine all the things that I needed to change... I will let you know if it works before you explain it. Benjamin Schmidt Thanks! I have no idea what version jlink I have (yellow, marked j-link ks/IAR systems on front, j-link-arm-ks on back. Where do you find the version? Inside? I see your patch is against 1833 (head) which I now have so will give it a try. Thanks again! ___ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development
Re: [Openocd-development] OpenOCD and different versions of J-Link
Does either rev 1833 or 1833 with my patch displaying something like this in the beginning? Info : J-Link compiled Feb 20 2006 18:20:20 -- Update -- Info : JLink caps 0x3 Info : JLink max mem block 32 Info : Vref = 3.283 TCK = 1 TDI = 0 TDO = 1 TMS = 0 SRST = 1 TRST = 255 The problem is that my old JLink uses a different USB endpoint, so if one version succedes this simple output message, the other WILL fail because it is sending to a channel where the jlink doesn't answer at all I only have access to a stm32 and an at91sam7s64 board ./src/openocd -f ./src/target/interface/jlink.cfg -f ./src/target/target/stm32.cfg That's how i call oocd atm... With my patch I only get one Error: J-Link command EMU_CMD_VERSION failed (-110) error in the beginning and every other 2 or 3 times it doesn't detect the jlink at all, but if the JLink info message appeares, there's no more errors... Benjamin On Tuesday 19 May 2009 12:36:24 am Gene Smith wrote: Benjamin Schmidt wrote: There's this segger closed source linux gdm server tool... http://www.segger.com/pub/jlink/JLink_Linux_090202.tar.gz It can show the hardware version. With patch still gets three EMU_CMD_GET_CAPS errors and don't worry. Then LED goes off on jlink. Should it go off? Not sure how I know that it is definitely working or not working. Reset halt command fails usb_bulk_read failed flash info 0 seems to work. Will try the link above in morning. What command line do you use to start openocd with jlink and str712 board? Thanks for any pointers you can provide! -gene On Monday 18 May 2009 11:24:51 pm Gene Smith wrote: Benjamin Schmidt wrote: Hello, I posted a similar patch several month ago. I have a JLink version v3.0 To get it to work you have to change several little things. This is just a very ugly hack that somewhat disables support for =V5 JLinks I'd just be interested if any of you can also get it to work this way... I would like to build a clean version of this patch that doesen't break the rest of the system, but I'd need some more help as I'm not experienced in any openocd/jtag code If you're interested I can explaine all the things that I needed to change... I will let you know if it works before you explain it. Benjamin Schmidt Thanks! I have no idea what version jlink I have (yellow, marked j-link ks/IAR systems on front, j-link-arm-ks on back. Where do you find the version? Inside? I see your patch is against 1833 (head) which I now have so will give it a try. Thanks again! ___ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development ___ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development
Re: [Openocd-development] OpenOCD and different versions of J-Link
Hello Benjamin, Tuesday, May 19, 2009, 12:39:26 AM, you wrote: BS There's this segger closed source linux gdm server tool... BS http://www.segger.com/pub/jlink/JLink_Linux_090202.tar.gz BS It can show the hardware version. Is there a necessity to map missing JLink commands? I could find them out, e.g.: ReadHardwareVersion input: 0xF0 (1 byte) output: version (4 bytes) ReadOTS (OTP Structure) input: 0xE6 (1 byte) output: OTS buffer (256 bytes) +0x00 4 serial no +0x10 16 OEM string +0x20 16 feature string 1 +0x30 16 feature string 2 ... +0x90 16 feature string 8 etc. -- WBR, Igormailto:skochin...@mail.ru ___ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development
Re: [Openocd-development] OpenOCD and different versions of J-Link
Hello Igor I think this wouldn't hurt anyone and could be very useful for debugging like this. But it should definately check via EMU_CMD_GET_CAPS first if command is available. At the moment the caps value is read from the device but for example the call to EMU_CMD_GET_MAX_MEM_BLOCK is done on my V3 JLink even though the caps value says the command is not available. This causes a segfault (not exactly sure, at least an error message), because the mem block size is set to 0. Benjamin On Tuesday 19 May 2009 01:39:06 am Igor Skochinsky wrote: Hello Benjamin, Tuesday, May 19, 2009, 12:39:26 AM, you wrote: BS There's this segger closed source linux gdm server tool... BS http://www.segger.com/pub/jlink/JLink_Linux_090202.tar.gz BS It can show the hardware version. Is there a necessity to map missing JLink commands? I could find them out, e.g.: ReadHardwareVersion input: 0xF0 (1 byte) output: version (4 bytes) ReadOTS (OTP Structure) input: 0xE6 (1 byte) output: OTS buffer (256 bytes) +0x00 4 serial no +0x10 16 OEM string +0x20 16 feature string 1 +0x30 16 feature string 2 ... +0x90 16 feature string 8 etc. ___ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development
Re: [Openocd-development] OpenOCD and different versions of J-Link
Hello Benjamin, Tuesday, May 19, 2009, 2:48:30 AM, you wrote: BS I think this wouldn't hurt anyone and could be very useful for debugging like BS this. BS But it should definately check via EMU_CMD_GET_CAPS first if command is BS available. At the moment the caps value is read from the device but for BS example the call to EMU_CMD_GET_MAX_MEM_BLOCK is done on my V3 JLink even BS though the caps value says the command is not available. BS This causes a segfault (not exactly sure, at least an error message), because BS the mem block size is set to 0. What I mean is I could write up a list of missing/underdocumented commands and describe their input/output parameters. I don't have a J-Link so I don't really need the code myself. -- WBR, Igormailto:skochin...@mail.ru ___ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development
[Openocd-development] OpenOCD and different versions of J-Link
2008/12/25 Michel Catudal michelcatu...@gmail.com: I could not get my older black j-link devices to work while the newer yellow one works. I am curious as to what the basic difference would be between the two. I tested them at work and they were working just as good on windows as the yellow one with IAR 5.2. (I don't use windows at home) Sorry to rehash this thread as I am interested in this topic as well. I have both black J-link and yellow one at work. Yellow ones are mostly of V5/V6 (and V7?) firmware. The one I have is for V6. The black one I have is of the old V3 version. The MCU used is different as far as I know. It seems to me that the Black one is using a Renesas MCU (M16C?). The yellow one seems to use AT91SAM7S. The speed difference is big. V1/2/3/4 supports 4MHz JTAG and V5/6/7 support 12MHz JTAG. http://www.segger.com/jlink.html Last time I tried both with LPC-2148 and LPC-2468. The yellow one seems to work with Openocd. The black one does not. Both works under Windows with IAR 4.42/5.20/5.30. Both also seem to work with the Segger Linux beta software. There is also a new J-Link Pro with Ethernet/USB interface. It is compatible with J-Link so I assume it will work with OpenOCD as well. It is said that it is using AT91SAM7X256 according to some websites. http://www.segger.com/jlinkpro.html -- Xiaofan http://mcuee.blogspot.com ___ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development