Re: [Openocd-development] Change in openocd[master]: jlink libusb1 driver with libusb1 common driver interface.

2011-10-21 Thread Mauro Gamba
I think that Xiofan suggest the good direction of developement.
So I think to proceed in this way:

- Add to the configuration step the possibility to choose which usb
library to use.
- Create an abstraction layer to the usb library with all the
necessary functions for the drivers.
- Modify the drivers to use the abstraction layer instead directly the library.

Do you think it's reasonable?


Mauro Gamba

On 20 October 2011 07:02, Xiaofan Chen xiaof...@gmail.com wrote:
 On Wed, Oct 19, 2011 at 11:55 PM, Spencer Oliver s...@spen-soft.co.uk wrote:
 On 19 October 2011 16:38, Mauro Gamba maurill...@gmail.com wrote:
 Sorry for patch errors.
 I started to patch the jlink driver to use libusb-1 because libusb-0
 is not developed further.
 I haven't done speed tests until now.


 http://openocd.zylin.com/33 adds libusb-1.0 support to the jlink.

 Just wondering if anyone had any input on this ?


 I believe the approach to only uss libusb-1.0 for J-Link is not a good
 approach. My idea is to have both options, just like urjtag. When
 libusb-1.0 is available and specified by the user, it should use
 libusb-1.0, other wise, it will fall back to libusb-0.1.

 Benefits of providing both:
 1) Make the regression testing easier.
 2) Make J-Link to work on platforms where libusb-1.0 is not
 available, like Solaris/NetBSD/OpenBSD, and older version
 of FreeBSD, and maybe some embedded Linux platform, and
 Windows 2000.
 3) Make users who prefer to use libusb-0.1 can use libusb-0.1,
 say Windows users who prefer to keep both Segger driver
 (to use IAR/Keil/etc) and OpenOCD -- they can use libusb-win32
 filter driver. Take note libusb-1.0 Windows does not support
 libusb0.sys backend now and that makes it not working with
 the filter driver.


 --
 Xiaofan

___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


Re: [Openocd-development] Change in openocd[master]: jlink libusb1 driver with libusb1 common driver interface.

2011-10-21 Thread Peter Stuge
Mauro Gamba wrote:
 I think to proceed in this way:
 
 - Add to the configuration step the possibility to choose which usb
   library to use.

Use pkg-config to check for all libraries that can work, and use
with the first one that is found. Check for libusb-1.0 first. You
will need to study more autoconf than you needed before. You can of
course also ask on the list if you are uncertain about something.


 - Create an abstraction layer to the usb library with all the
   necessary functions for the drivers.

Yes and no. all the neccessary functions should not be created at
once. Start with an abstraction layer that works for one driver but
still allows upward compatibility with the other drivers. This may be
more difficult than you think. You will have to analyze each driver
more in depth, and I guess it will take a bit of time.

The above two items shall be in the first commit. Please do not wait
for the complete driver analysis before you make the commit, please
start with creating an abstraction layer that is sufficient for only
one driver, push that to Gerrit, and see what the feedback is. This
is OK to do even if you want to do more work on the commit, but it is
important to get review feedback early, so that you do not have to do
double work.

Of course, remember to pay close attention to simple details like
checking all possible errors and code style.


 - Modify the drivers to use the abstraction layer instead directly
   the library.
 
 Do you think it's reasonable?

Yes, but it is more work and more complicated, so it is even more
important than before to only start small and then gather feedback.


Thanks again for working on this! I'm really looking forward to your
commits!


//Peter
___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


Re: [Openocd-development] Change in openocd[master]: jlink libusb1 driver with libusb1 common driver interface.

2011-10-19 Thread Peter Stuge
Spencer Oliver wrote:
 http://openocd.zylin.com/33 adds libusb-1.0 support to the jlink.
 
 Just wondering if anyone had any input on this ?

Yes, plenty.


//Peter
___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


Re: [Openocd-development] Change in openocd[master]: jlink libusb1 driver with libusb1 common driver interface.

2011-10-19 Thread Xiaofan Chen
On Wed, Oct 19, 2011 at 11:55 PM, Spencer Oliver s...@spen-soft.co.uk wrote:
 On 19 October 2011 16:38, Mauro Gamba maurill...@gmail.com wrote:
 Sorry for patch errors.
 I started to patch the jlink driver to use libusb-1 because libusb-0
 is not developed further.
 I haven't done speed tests until now.


 http://openocd.zylin.com/33 adds libusb-1.0 support to the jlink.

 Just wondering if anyone had any input on this ?


I believe the approach to only uss libusb-1.0 for J-Link is not a good
approach. My idea is to have both options, just like urjtag. When
libusb-1.0 is available and specified by the user, it should use
libusb-1.0, other wise, it will fall back to libusb-0.1.

Benefits of providing both:
1) Make the regression testing easier.
2) Make J-Link to work on platforms where libusb-1.0 is not
available, like Solaris/NetBSD/OpenBSD, and older version
of FreeBSD, and maybe some embedded Linux platform, and
Windows 2000.
3) Make users who prefer to use libusb-0.1 can use libusb-0.1,
say Windows users who prefer to keep both Segger driver
(to use IAR/Keil/etc) and OpenOCD -- they can use libusb-win32
filter driver. Take note libusb-1.0 Windows does not support
libusb0.sys backend now and that makes it not working with
the filter driver.


-- 
Xiaofan
___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


Re: [Openocd-development] Change in openocd[master]: jlink libusb1 driver with libusb1 common driver interface.

2011-10-19 Thread Xiaofan Chen
On Thu, Oct 20, 2011 at 1:02 PM, Xiaofan Chen xiaof...@gmail.com wrote:
 On Wed, Oct 19, 2011 at 11:55 PM, Spencer Oliver s...@spen-soft.co.uk wrote:
 http://openocd.zylin.com/33 adds libusb-1.0 support to the jlink.

 Just wondering if anyone had any input on this ?


 I believe the approach to only uss libusb-1.0 for J-Link is not a good
 approach. My idea is to have both options, just like urjtag. When
 libusb-1.0 is available and specified by the user, it should use
 libusb-1.0, other wise, it will fall back to libusb-0.1.

 Benefits of providing both:
 1) Make the regression testing easier.
 2) Make J-Link to work on platforms where libusb-1.0 is not
 available, like Solaris/NetBSD/OpenBSD, and older version
 of FreeBSD, and maybe some embedded Linux platform, and
 Windows 2000.
 3) Make users who prefer to use libusb-0.1 can use libusb-0.1,
 say Windows users who prefer to keep both Segger driver
 (to use IAR/Keil/etc) and OpenOCD -- they can use libusb-win32
 filter driver. Take note libusb-1.0 Windows does not support
 libusb0.sys backend now and that makes it not working with
 the filter driver.


Again, I will point the link to urjtag.
http://urjtag.git.sourceforge.net/git/gitweb.cgi?p=urjtag/urjtag;a=tree;f=urjtag/src/tap/usbconn;hb=HEAD

In terms of the simple wrapper of libusb-1.0, I think this is a good
first try. On the other hand, the function jtag_libusb_match()
can probably take one more parameter serial_number so that
some debuggers can benefits from the support of multiple units.

-- 
Xiaofan
___
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development