Re: [Openocd-development] Outstanding patches = Fix: Correctly exit function: ft2232_init when an error occurred

2011-06-09 Thread Laurent Gauch
/ // I suggest to drop this patch and merge a simpler fix for the problem // adressed by this patch. Only a few lines of code would need to change. // // /Attached is such a patch. The benefit over Tomek's patch is that it frees not only the allocated buffer but also closes the ftdi handle (as

Re: [Openocd-development] [PATCH] ft2232: fix memory leak in ft2232_large_scan()

2011-06-09 Thread Laurent Gauch
Free the buffer before return. Also check the malloc return value. Perhaps it's not a good idea to exit() on error, but it's in line with the rest of the function. Strange thing with this function is that the allocated buffer doesn't seem to be used for anything. The data read into it doesn't

Re: [Openocd-development] [PATCH] ft2232: fix memory leak in ft2232_large_scan()

2011-06-09 Thread Peter Stuge
Andreas Fritiofson wrote: Strange thing with this function is that the allocated buffer doesn't seem to be used for anything. The data read into it doesn't go anywhere. Maybe the entire function is flawed, or is the data really supposed to be discarded? If noone can answer this then I would

Re: [Openocd-development] [PATCH] ft2232: fix memory leak in ft2232_large_scan()

2011-06-09 Thread Øyvind Harboe
On Thu, Jun 9, 2011 at 8:37 AM, Peter Stuge pe...@stuge.se wrote: Andreas Fritiofson wrote: Strange thing with this function is that the allocated buffer doesn't seem to be used for anything. The data read into it doesn't go anywhere. Maybe the entire function is flawed, or is the data really

Re: [Openocd-development] [PATCH] ft2232: fix memory leak in ft2232_large_scan()

2011-06-09 Thread Øyvind Harboe
Definitely! I'm holding off on this patch in favor of a patch that deletes cruft instead of decorating it :-) I have a soft spot for patches that delete code that nobody understands -- Øyvind Harboe Can Zylin Consulting help on your project? US toll free 1-866-980-3434 / International

Re: [Openocd-development] [PATCH] use one configuration for all JTAGkey devices.

2011-06-09 Thread Laurent Gauch
On 15:25 Tue 07 Jun , Laurent Gauch wrote: / // /If our ft2232.c patches are not merged quickly, Amontec Team will certainly // // come with a new specific jtagkey.c API driver instead of the ft2232.c JTAG // // driver. // // The advantage with a specific Amontec JTAGkey API driver in

Re: [Openocd-development] Outstanding patches = Fix: Correctly exit function: ft2232_init when an error occurred

2011-06-09 Thread Øyvind Harboe
On Thu, Jun 9, 2011 at 7:29 AM, Peter Stuge pe...@stuge.se wrote: Øyvind Harboe wrote: Nit, the construct below is a little bit fancy. I'd prefer splitting it over multiple lines to make it more accessible to the casual reader. Or just use goto, please, which is clear, simple, well

Re: [Openocd-development] Outstanding patches = Fix: Correctly exit function: ft2232_init when an error occurred

2011-06-09 Thread Peter Stuge
Øyvind Harboe wrote: Or just use goto, please, which is clear, simple, well understood, and elegant all at once. :) I think goto is OK sometimes. When it is used to unwind the stack frame and free up resources, in lieu of exceptions and resource tracking it can clean up the code

Re: [Openocd-development] General SWD Support in OpenOCD

2011-06-09 Thread simon qian
Great, I'll add SWD driver of versaloon when it's testable. 2011/6/8, Øyvind Harboe oyvind.har...@zylin.com: On Tue, Jun 7, 2011 at 7:05 PM, Tomek CEDRO tomek.ce...@gmail.com wrote: On Tue, Jun 7, 2011 at 5:02 PM, Øyvind Harboe oyvind.har...@zylin.com wrote: First thing I tried was to rebase

[Openocd-development] [PATCH 1/5] ft2232: Clean up infinite loop condition in ft2232_init()

2011-06-09 Thread Peter Stuge
--- src/jtag/drivers/ft2232.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/jtag/drivers/ft2232.c b/src/jtag/drivers/ft2232.c index 8c2382a..1f0269a 100644 --- a/src/jtag/drivers/ft2232.c +++ b/src/jtag/drivers/ft2232.c @@ -2438,7 +2438,7 @@ static int

Re: [Openocd-development] [PATCH 1/5] ft2232: Clean up infinite loop condition in ft2232_init()

2011-06-09 Thread Øyvind Harboe
Can I commit? Surely this one is straightforward!!!??? :-) -- Øyvind Harboe Can Zylin Consulting help on your project? US toll free 1-866-980-3434 / International +47 51 87 40 27 http://www.zylin.com/zy1000.html ARM7 ARM9 ARM11 XScale Cortex JTAG debugger and flash programmer

[Openocd-development] [PATCH 1/5] ft2232: Clean up infinite loop condition in ft2232_init()

2011-06-09 Thread Peter Stuge
--- src/jtag/drivers/ft2232.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/jtag/drivers/ft2232.c b/src/jtag/drivers/ft2232.c index 8c2382a..1f0269a 100644 --- a/src/jtag/drivers/ft2232.c +++ b/src/jtag/drivers/ft2232.c @@ -2438,7 +2438,7 @@ static int

[Openocd-development] [PATCH 2/5] ft2232: Refactor ft2232_init_*() into ft2232_initone()

2011-06-09 Thread Peter Stuge
ft2232.c is compiled either for ftd2xx or for libftdi. The two init functions had slightly different prototypes, making it neccessary to distinguish between them not only at declaration, but also when they were being called. Since the code is only compiled for one library type we can homogenize

[Openocd-development] [PATCH 5/5] ft2232: Handle command buffer malloc() error in ft2232_init()

2011-06-09 Thread Peter Stuge
ft2232_init() fails if the command buffer can not be allocated, but ft2232_quit() will be called to clean up, so the command buffer must be free():d only if it has been successfully allocated. --- src/jtag/drivers/ft2232.c |5 - 1 files changed, 4 insertions(+), 1 deletions(-) diff --git

[Openocd-development] [PATCH 3/5] ft2232: Clean up on ft2232_init() errors after a device has been opened

2011-06-09 Thread Peter Stuge
ft2232_quit() is called on errors and should clean up after any device initialization that has been done by ft2232_init(). --- src/jtag/drivers/ft2232.c | 17 - 1 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/jtag/drivers/ft2232.c b/src/jtag/drivers/ft2232.c

[Openocd-development] [PATCH 4/5] ft2232: Refactor ft2232_purge_*() into ft2232_purge()

2011-06-09 Thread Peter Stuge
Like with ft2232_init_ftd2xx() and ft2232_init_libftdi() it helps to keep abstraction between ftd2xx and libftdi in only one place in the source code; this time in a ft2232_purge() function. --- src/jtag/drivers/ft2232.c | 50 ++-- 1 files changed, 21

Re: [Openocd-development] [PATCH 1/5] ft2232: Clean up infinite loop condition in ft2232_init()

2011-06-09 Thread Peter Stuge
Øyvind Harboe wrote: Can I commit? Sorry - I messed up the sending a little, I'm resending the full series right now. The patch is the same though. Surely this one is straightforward!!!??? :-) Yes. Let's see what people think of the other ones. (There be goto.) //Peter

Re: [Openocd-development] [PATCH] ft2232: fix memory leak in ft2232_large_scan()

2011-06-09 Thread Andreas Fritiofson
On Thu, Jun 9, 2011 at 8:40 AM, Øyvind Harboe oyvind.har...@zylin.comwrote: Definitely! I'm holding off on this patch in favor of a patch that deletes cruft instead of decorating it :-) I have a soft spot for patches that delete code that nobody understands IF the function is

Re: [Openocd-development] Outstanding patches = Fix: Correctly exit function: ft2232_init when an error occurred

2011-06-09 Thread Andreas Fritiofson
On Thu, Jun 9, 2011 at 9:06 AM, Øyvind Harboe oyvind.har...@zylin.comwrote: On Thu, Jun 9, 2011 at 7:29 AM, Peter Stuge pe...@stuge.se wrote: Øyvind Harboe wrote: Nit, the construct below is a little bit fancy. I'd prefer splitting it over multiple lines to make it more accessible to the

[Openocd-development] xsvf works in Linux but not Windows?

2011-06-09 Thread Shane Volpe
I have openOCD v0.40 working great in Linux and I can program both my processor flash (PXA270+P30 flash) and my PLD (Cool runner 2). However when I try to do the same in windows I can only program the processor successfully. I quick verify of the PLD using the Xilinx programmer shows the PLD is

Re: [Openocd-development] xsvf works in Linux but not Windows?

2011-06-09 Thread Shane Volpe
If I do a simple compare of the before and after images in the PLD it seems as if the windows openocd xsvf writer only wrote part of the xsvf file. I just turned on debug_level 3 on both systems. Windows Log file: The output log shows that on Windows xsvf just quits processing the xsvf

Re: [Openocd-development] [PATCH 5/5] ft2232: Handle command buffer malloc() error in ft2232_init()

2011-06-09 Thread Sébastien Farquet
Is it possible to have the git patches so to test it and compare it with what I did ? (For all parts) On Thu, 9 Jun 2011 12:25:36 +0200, Peter Stuge wrote: ft2232_init() fails if the command buffer can not be allocated, but ft2232_quit() will be called to clean up, so the command buffer must

Re: [Openocd-development] [PATCH 5/5] ft2232: Handle command buffer malloc() error in ft2232_init()

2011-06-09 Thread Peter Stuge
Sébastien Farquet wrote: Is it possible to have the git patches so to test it and compare it with what I did ? You can pipe each email to git am in order to apply the commits to a branch in your repo. For greater convenience I've also pushed the commits to the repo shown in gitweb here:

Re: [Openocd-development] Versaloon driver update

2011-06-09 Thread Peter Stuge
simon qian wrote: Is this patch acceptable? Sorry, still need to test and look closer. :\ Maybe tonight, maybe tomorrow night. //Peter ___ Openocd-development mailing list Openocd-development@lists.berlios.de

Re: [Openocd-development] [PATCH 5/5] ft2232: Handle command buffer malloc() error in ft2232_init()

2011-06-09 Thread Sébastien Farquet
On Thu, 9 Jun 2011 18:13:38 +0200, Peter Stuge wrote: For greater convenience I've also pushed the commits to the repo shown in gitweb here: http://git.stuge.se/?p=openocd.git Thanks -- Regards, Sébastien Farquet http://www.amontec.com/ Amontec JTAGkey-2 : High speed USB JTAG interface

[Openocd-development] Adding M0 support

2011-06-09 Thread Kevin Kiningham
Hi, I've been working on adding cortex-M0 support and I was wondering if there was any interest in adding it to the official repo? Especially with SWD support coming soon, it seems like this would be a good time to add it. My code right now is very similar to the M3 stuff, except for a couple of

Re: [Openocd-development] Adding M0 support

2011-06-09 Thread Øyvind Harboe
Hi Kevin, from the maintainers I can say that we're very much interested in such contributions. By posting it to the list, we hopefully also can get others to pitch in! -- Øyvind Harboe Can Zylin Consulting help on your project? US toll free 1-866-980-3434 / International +47 51 87 40 27

Re: [Openocd-development] Versaloon driver update

2011-06-09 Thread Tomek CEDRO
On Thu, Jun 9, 2011 at 2:58 PM, simon qian simonqian.open...@gmail.com wrote: Is this patch acceptable? Or should I put all codes in vsllink.c file? My proposition is to put everything in vslink.c for better organization in upcoming update..? Then we pick the best of all and put yet in another

Re: [Openocd-development] [PATCH 1/5] ft2232: Clean up infinite loop condition in ft2232_init()

2011-06-09 Thread Andreas Fritiofson
On Thu, Jun 9, 2011 at 12:12 PM, Peter Stuge pe...@stuge.se wrote: - for (int i = 0; 1; i++) + for (int i = 0; ft2232_vid[i] || ft2232_pid[i]; i++) What's the point? This condition can never become false, or the function would have returned in the previous iteration. /Andreas

Re: [Openocd-development] [PATCH 2/5] ft2232: Refactor ft2232_init_*() into ft2232_initone()

2011-06-09 Thread Andreas Fritiofson
On Thu, Jun 9, 2011 at 12:25 PM, Peter Stuge pe...@stuge.se wrote: + retval = ft2232_initone(ft2232_vid[i], ft2232_pid[i], more, try_more); This is a good start, but what's with the function name?? How about ft2232_init_{device,interface,ftdilib,hardware,handle,whatever}

Re: [Openocd-development] [PATCH 2/5] ft2232: Refactor ft2232_init_*() into ft2232_initone()

2011-06-09 Thread Peter Stuge
Andreas Fritiofson wrote: + retval = ft2232_initone(ft2232_vid[i], ft2232_pid[i], more, try_more); This is a good start, but what's with the function name?? Short. And one from one device. As opposed to try to init *all* supported devices, which is what ft2232_init does.

Re: [Openocd-development] [PATCH 3/5] ft2232: Clean up on ft2232_init() errors after a device has been opened

2011-06-09 Thread Andreas Fritiofson
This together with patch 5/5 is equivalent to my patch, only with gotos. Both patches are perfectly fine with me, although I prefer getting rid of the forward declaration as well. /Andreas ___ Openocd-development mailing list

Re: [Openocd-development] [PATCH 2/5] ft2232: Refactor ft2232_init_*() into ft2232_initone()

2011-06-09 Thread Andreas Fritiofson
On Fri, Jun 10, 2011 at 12:26 AM, Peter Stuge pe...@stuge.se wrote: Andreas Fritiofson wrote: + retval = ft2232_initone(ft2232_vid[i], ft2232_pid[i], more, try_more); This is a good start, but what's with the function name?? Short. And one from one device. As

Re: [Openocd-development] [PATCH 2/5] ft2232: Refactor ft2232_init_*() into ft2232_initone()

2011-06-09 Thread Tomek CEDRO
On Thu, Jun 9, 2011 at 10:57 PM, Andreas Fritiofson andreas.fritiof...@gmail.com wrote: ft2232_init really refers to init of the openocd driver, while ft2232_init_{libftdi,ftd2xx} refers to init of the ftdi subsystem including hardware (using either of the libraries). Different inits, hence one

Re: [Openocd-development] Outstanding patches = Fix: Correctly exit function: ft2232_init when an error occurred

2011-06-09 Thread Andreas Fritiofson
On Thu, Jun 9, 2011 at 10:17 PM, Tomek CEDRO tomek.ce...@gmail.com wrote: Hello Laurent! :-) On Thu, Jun 9, 2011 at 6:21 AM, Laurent Gauch laurent.ga...@amontec.com wrote: But before to close the handle we should still be able : -1- to tristate signal High-Z via all the out enable signals

Re: [Openocd-development] Outstanding patches = Fix: Correctly exit function: ft2232_init when an error occurred

2011-06-09 Thread Tomek CEDRO
Hello Andreas :-) On Thu, Jun 9, 2011 at 11:30 PM, Andreas Fritiofson andreas.fritiof...@gmail.com wrote: I have created simple quit() that sets all port pins high and as input (mpsse command 0x80 0x82) but that did not shut down the yellow led :-( Since the suitable setting depends on the

Re: [Openocd-development] Outstanding patches = Fix: Correctly exit function: ft2232_init when an error occurred

2011-06-09 Thread Andreas Fritiofson
On Fri, Jun 10, 2011 at 1:40 AM, Tomek CEDRO tomek.ce...@gmail.com wrote: Hello Andreas :-) On Thu, Jun 9, 2011 at 11:30 PM, Andreas Fritiofson andreas.fritiof...@gmail.com wrote: I have created simple quit() that sets all port pins high and as input (mpsse command 0x80 0x82) but that did

[Openocd-development] ft2232 layout refactoring plans

2011-06-09 Thread Andreas Fritiofson
Hi all! The recent activity surrounding the ft2232 driver makes it obvious that there are lots of bugfixes and structural improvements that need to be done. Unfortunately, trying to understand the code or even just browsing around in it is complicated by the fact that its cluttered with functions

Re: [Openocd-development] Outstanding patches = Fix: Correctly exit function: ft2232_init when an error occurred

2011-06-09 Thread Andreas Fritiofson
On Fri, Jun 10, 2011 at 2:18 AM, Tomek CEDRO tomek.ce...@gmail.com wrote: On Thu, Jun 9, 2011 at 11:46 PM, Andreas Fritiofson andreas.fritiof...@gmail.com wrote: Setting the FTDI pins to Hi-Z is not necessarily the same as setting the pins in the JTAG connector to Hi-Z. There is arbitrary

Re: [Openocd-development] ft2232 layout refactoring plans

2011-06-09 Thread Tomek CEDRO
Uhm, from what I understand LAYOUT is only used for initialization of specific device based on FT*232 device, maybe other minor stuff, all work is done in fact by queue_flush() and it is common for all devices as it simply translates queued JTAG commands into MPSSE that produces actions on the

Re: [Openocd-development] Outstanding patches = Fix: Correctly exit function: ft2232_init when an error occurred

2011-06-09 Thread Tomek CEDRO
On Fri, Jun 10, 2011 at 12:35 AM, Andreas Fritiofson andreas.fritiof...@gmail.com wrote: What are you talking about? Not all ftdi dongles are wired like this = there is no universal default setting suitable for all dongles. Uhm, I read bad at 3am :-) You told that not always setting Hi-Z on FT

Re: [Openocd-development] ft2232 layout refactoring plans

2011-06-09 Thread Andreas Fritiofson
On Fri, Jun 10, 2011 at 2:36 AM, Tomek CEDRO tomek.ce...@gmail.com wrote: Uhm, from what I understand LAYOUT is only used for initialization of specific device based on FT*232 device, maybe other minor stuff, all work is done in fact by queue_flush() and it is common for all devices as it

Re: [Openocd-development] General SWD Support in OpenOCD

2011-06-09 Thread Tomek CEDRO
On Tue, Jun 7, 2011 at 5:02 PM, Øyvind Harboe oyvind.har...@zylin.com wrote: First thing I tried was to rebase your master branch on top of origin/master and that didn't work... Could you rebase it on top of master branch and force a push? I also have problem with merge conflict in

[Openocd-development] New functionalities in Interface API: interface_signal, bitbang

2011-06-09 Thread Tomek CEDRO
Good news - the interface_signal and bitbang framework is now ready and verified on KT-LINK FT2232 based device. The example screenshots of new functionality are here: http://sourceforge.net/apps/mediawiki/stm32primer2swd/index.php?title=Main_Page#Screenshots_2 It took some more time to verify

[Openocd-development] Peter Stuge is now an OpenOCD maintainer

2011-06-09 Thread Øyvind Harboe
I'm very pleased to announce Peter Stuge as an OpenOCD maintainer. The community is very fortunate that he is able and willing to donate a little bit of time in commenting and committing some of the patches. His work so far, both in terms of actual code and patches and contributions in mentoring

Re: [Openocd-development] [PATCH] use one configuration for all JTAGkey devices.

2011-06-09 Thread Jean-Christophe PLAGNIOL-VILLARD
On 08:42 Thu 09 Jun , Laurent Gauch wrote: On 15:25 Tue 07 Jun , Laurent Gauch wrote: / // /If our ft2232.c patches are not merged quickly, Amontec Team will certainly // // come with a new specific jtagkey.c API driver instead of the ft2232.c JTAG // // driver. // // The

Re: [Openocd-development] New functionalities in Interface API: interface_signal, bitbang

2011-06-09 Thread Øyvind Harboe
Now I just have to learn how to rebase my fork with openocd git master to produce patches ;-) I am so pleased to hear that you are willing to make the effort to learn how to do these git operations. That you are willing and able to do this part of the maintenance reduces the burden on the