On Fri, Oct 12, 2012 at 10:32 PM, Jonathan Dumaresq
<jdumar...@cimeq.qc.ca> wrote:
> Xiaofan Chen wrote:
>
>> I use the mingw32 package from Ubuntu repo which is for MinGW.org
>> compiler.
>>
>> mingw.org does not provide cross compiler. It is more up to date than
>> the one in Ubuntu. This is part of the reasons I use native Windows
>> MinGW/Msys and not cross build for libftdi/openocd binaries I
>> distribute.
>
> Ok, I see. Normally you build openocd on Windows or Linux ?

I used to do it under Linux. Now I use Windows (MinGW.org
MinGW/MSys). It is relatively slower than Linux but it is not
that bad.

Building libusb-win32 library (not the driver and driver
installer) and libusbx binary under MinGW/MSys is quite
easy.

libusbx (as well as libusb-1.0) has good support for
different toolchain and cross build.

libusb-win32 building is not that friendly to MinGW.org, and even
less friendly to MinGW-w64. We actually only support WDK build
officially. But you can still at least build the dll and the import
library pretty easily with MinGW gcc.

But we anyway only support dynamic linking so it is
not really an issue. You may not really need the gcc import library
(even though it is named as libusb.a but it is actually not static
library, a legacy we inherited) and you will probably be find just
to link directly to the dll.

Also if you use MinGW-w64, take note it has its own usb.h
as well (actually a ddk file but they insist to say that it does
not belong to ddk). So we rename libusb-win32 header file
to lusb0_usb.h. But OpenOCD/libftdi still use usb.h so you
have to rename it.

Building libftdi under MinGW/MSys is bit challenging so I
provide libftdi binaries at my Google code site. I use CMake and
customize MinGW distro since it has boost built in. In that
case, I use no MSys and just cmd.exe prompt.
MinGW with boost: http://nuwen.net/mingw.html

For OpenOCD, you do not need the boost binding for
libftdi, so it is not that difficult to cross build under Linux.

>>>> (but I can cross build it under Ubuntu as well).
>>>
>>> To cross build libftdi on linux do you use the cmake or the
>>> configure way ?
>>
>> I use Cmake in general for libftdi since that is the preferred way by
>> libftdi developers.
>
> Ok. I take note of that !
>
> Again, Thanx for your precious time.

You are welcome.

  686  cd libftdi-0.20/
  688  mkdir build_win
  689  cd build_win/
  694  nano ../Toolchain-mingw32.cmake
  699  cmake -DCMAKE_TOOLCHAIN_FILE=../Toolchain-mingw32.cmake ..
  700  nano CMakeCache.txt (to change to Release and potentially
correct windres not found issue)
  701  camke ..
  703  make
  704  make -i (a bug in the serial_test.c file)

mcuee@Ubuntu1204VM:~/Desktop/build/libftdi/libftdi-0.20/build_win$ cat
../Toolchain-mingw32.cmake
# the name of the target operating system
SET(CMAKE_SYSTEM_NAME Windows)

# which compilers to use for C and C++
SET(CMAKE_C_COMPILER i586-mingw32msvc-gcc)
SET(CMAKE_CXX_COMPILER i586-mingw32msvc-g++)

# here is the target environment located
SET(CMAKE_FIND_ROOT_PATH  /usr/i586-mingw32msvc )

# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment, search
# programs in the host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)


-- 
Xiaofan

------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to