libftdi Archives

Subject: Re: Issues porting libftdi-based application to MIPS platform

From: Victor Cionca <victor.cionca@xxxxxxxxxx>
To: "libftdi@xxxxxxxxxxxxxxxxxxxxxxx" <libftdi@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 6 Aug 2013 14:54:28 +0000
Hi Xiaofan,

Thanks for the suggestion.

I cross-compiled libFTDI with -Wcast-align and indeed I got an error as 
indicated in the libusbx discussion.

However, after looking through the libusbx and libftdi code to see where 
these sensitive functions are called I found:
- libftdi doesn't use them directly,
- only two of them are used in libusbx and they are not dangerous.

I guess there would be problems if an incoming buffer is cast to struct 
libusb_control_setup directly. However, I didn't find anything like this 
in the code.

I will keep digging.

Best regards,
Victor


On 01/08/13 09:55, Xiaofan Chen wrote:
> On Thu, Aug 1, 2013 at 4:20 PM, Victor Cionca <victor.cionca@xxxxxxxxxx> 
> wrote:
>> I ran into some problems running an FTDI application on a MIPS platform.
>>
>> I have an embedded device using an Atmel microcontroller. The uC is
>> programmed over SPI via an FTDI chip, using bit-banging.
>>
>> I have an application that does the programming and it works well on my
>> Linux machine (Kernel 3.2.0-0.bpo.4-686-pae, libftdi 1-1.0, libusb-1.0.16).
> There is no libusb-1.0.16, do you mean libusbx-1.0.16?
>
>> I cross-compiled the application (and the libftdi, confuse and libusb
>> libraries) for a MIPS CPU, Atheros AR9330 (it's the TPLink MR3020
>> router, running OpenWrt). Used the same libraries and the kernel is 3.3.8.
>>
>> While the application runs fine (so it cross compiled well), it seems
>> unable to communicate properly with the board. I send data and either
>> get all zeroes or all FFs. I enabled usb debugging but the output is
>> identical between the two machines - the only difference being in the
>> usbi_handle_transfer_completion, with different addresses, but I guess
>> that's normal.
>>
> I do not know if this has anything to do with a potential libusb bug
> which may happen under some embedded Linux application.
>
> https://github.com/libusbx/libusbx/issues/120
> http://libusbx.1081486.n5.nabble.com/Libusbx-devel-Possible-alignment-issues-with-struct-libusb-transfer-buffer-pointer-td1458.html
>
>

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx

Current Thread