Xiaofan Chen wrote:
> Win32 build with MinGW.org 32bit compiler is okay.
> I got build error with MinGW-w64.
..

> ../../../../git/openocd/src/jtag/drivers/ft2232.c:138:22: error: 
> redeclaration of enumerator 'TYPE_2232H'
> /home/mcuee/mingw-w64/bin/../lib/gcc/x86_64-w64-mingw32/4.5.2/../../../../x86_64-w64-mingw32/include/ftdi.h:25:80:
>  note: previous definition of 'TYPE_2232H' was here

Your MinGW-w64 gcc is version 4.5.2, maybe your MinGW.org gcc version
is an older version which is less strict about overlapping enums?


> ft2232.c:
> 
> #define LIBFTDI_READ_RETRY_COUNT              2000
> 
> #ifndef BUILD_FT2232_HIGHSPEED
>  #if BUILD_FT2232_FTD2XX == 1
>       enum { FT_DEVICE_2232H = 6, FT_DEVICE_4232H };
>  #elif BUILD_FT2232_LIBFTDI == 1
>       enum { TYPE_2232H = 4, TYPE_4232H = 5 };
>  #endif
> #endif
> 
> ftdi.h from libftdi-0.18
> /** FTDI chip type */
> enum ftdi_chip_type { TYPE_AM=0, TYPE_BM=1, TYPE_2232C=2, TYPE_R=3,
> TYPE_2232H=4, TYPE_4232H=5 };
> 
> Commenting out the following two lines seems to solve the issues.
> But I am not so sure if this is the proper fix and why these two
> lines are there (an older version of libftdi?)
>  #elif BUILD_FT2232_LIBFTDI == 1
>       enum { TYPE_2232H = 4, TYPE_4232H = 5 };

The enums seem to be actually refering to the same thing; ie. OpenOCD
has only copied them from ftdi.h. They were added to OpenOCD by:

commit ef30f22fd3355f668b23905f50bab4671f803ab1
Author: ntfreak <ntfr...@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Date:   Thu Aug 20 07:54:49 2009 +0000

    - remove enable-ft2232-highspeed configure option, high speed ftdi support 
is now detected during the configure stage
    - warning now issued if high speed ftdi device found and openocd was built 
using an old driver
    
    git-svn-id: svn://svn.berlios.de/openocd/tr...@2599 
b42882b7-edfa-0310-969c-e2dbd0fdcd60

and it seems that they were simply copypaste. The enums were used in
OpenOCD also before this commit; so they aren't really required
within OpenOCD.

FT_DEVICE_* were added to upstream ftd2xx.h on 2007-07-11.

TYPE_* were added to libftdi ftdi.h by commit 0beb968 on 2009-04-07,
which is included since version 0.16 according to git tag --contains.

If the respective headers do not have the enums, then I think OpenOCD
can not expect to use them, so they should never be defined locally
in OpenOCD anyway. I suggest the attached patch.


//Peter
>From 1725c727253d10e87e2b01333ca8023a59bf1522 Mon Sep 17 00:00:00 2001
From: Peter Stuge <[email protected]>
Date: Sat, 18 Sep 2010 18:35:15 +0200
Subject: [PATCH] Remove enums copypasted from ftdi.h and ftd2xx.h

FT_DEVICE_* were added to upstream ftd2xx.h on 2007-07-11.

TYPE_* were added to libftdi ftdi.h by commit 0beb968 on 2009-04-07,
first released in libftdi-0.16.

Reported-by: Xiaofan Chen <[email protected]>
Signed-off-by: Peter Stuge <[email protected]>
---
 src/jtag/drivers/ft2232.c |    8 --------
 1 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/src/jtag/drivers/ft2232.c b/src/jtag/drivers/ft2232.c
index 7440f0c..a2b3e20 100644
--- a/src/jtag/drivers/ft2232.c
+++ b/src/jtag/drivers/ft2232.c
@@ -131,14 +131,6 @@ enum ftdi_interface
  */
 #define LIBFTDI_READ_RETRY_COUNT               2000
 
-#ifndef BUILD_FT2232_HIGHSPEED
- #if BUILD_FT2232_FTD2XX == 1
-       enum { FT_DEVICE_2232H = 6, FT_DEVICE_4232H };
- #elif BUILD_FT2232_LIBFTDI == 1
-       enum { TYPE_2232H = 4, TYPE_4232H = 5 };
- #endif
-#endif
-
 /**
  * Send out \a num_cycles on the TCK line while the TAP(s) are in a
  * stable state.  Calling code must ensure that current state is stable,
-- 
1.7.2

_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to