You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Windows ujprog compile error: 'EOPNOTSUPP' undeclared, 'usleep' is deprecated #8
I encountered a bunch of warnings that usleep is deprecated, and more importantly a critical error that 'EOPNOTSUPP' undeclared when compiling ujprog in MinGW32 for Windows:
cp Makefile.win Makefile
make
Output:
gcc.exe -c ujprog.c -o ujprog.o -I.
[... snip ...]
c:\mingw\include\unistd.h:100:29: note: declared here
int __cdecl __MINGW_NOTHROW usleep( useconds_t )__MINGW_ATTRIB_DEPRECATED;
^~~~~~
ujprog.c: In function 'shutdown_usb':
ujprog.c:621:2: warning: 'usleep' is deprecated [-Wdeprecated-declarations]
ms_sleep(10);
^~~~~~~~
In file included from ujprog.c:55:
c:\mingw\include\unistd.h:100:29: note: declared here
int __cdecl __MINGW_NOTHROW usleep( useconds_t )__MINGW_ATTRIB_DEPRECATED;
^~~~~~
ujprog.c: In function 'exec_svf_tokenized':
ujprog.c:1488:9: error: 'EOPNOTSUPP' undeclared (first use in this function); did you mean 'WSAEOPNOTSUPP'?
res = EOPNOTSUPP;
^~~~~~~~~~
WSAEOPNOTSUPP
ujprog.c:1488:9: note: each undeclared identifier is reported only once for each function it appears in
ujprog.c: In function 'async_read_block':
ujprog.c:2788:4: warning: 'usleep' is deprecated [-Wdeprecated-declarations]
ms_sleep(backoff * 4);
^~~~~~~~
In file included from ujprog.c:55:
[... snip ...]
gcc.exe ujprog.o -lftd2xx -o "ujprog.exe" -s -static -L. -lftd2xx
The solution that worked for me here for the error: 'EOPNOTSUPP' undeclared was the same as nmap/nmap#183 in adding these two lines to ujprog.c:
#undef EOPNOTSUPP
#define EOPNOTSUPP WSAEOPNOTSUPP /* Operation not supported */
After that change, I was able to create an exe for ujprog.
ujprog builds perfectly fine (no errors or warnings whatsoever) as-is from day 0 on M$ windows, using MSYS MINGW32. make -f Makefile.win is all it takes.
I'm not inclined to accept the proposed patch, as it more likely reflects some problem in the build system (probably including a wrong errno.h) rather than a problem in ujprog.c itself.
Note that we went to great lengths to make and keep ujprog portable across a broad range of platforms (Win32, Linux, FreeBSD, OSX), hence my reluctance to accept a windows-specific fix for a non-issue.
@gornjas - I appreciate the efforts to make it ujprog portable. Respectfully, this is what I see in mingw32 on Windows 10 1803 17134.556:
$ gcc --version
gcc.exe (MinGW.org GCC-8.2.0-3) 8.2.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Here's the entire output:
$ make -f Makefile.win
gcc.exe -c ujprog.c -o ujprog.o -I.
ujprog.c: In function 'set_port_mode':
ujprog.c:463:4: warning: 'usleep' is deprecated [-Wdeprecated-declarations]
ms_sleep(20);
^~~~~~~~
In file included from ujprog.c:54:
c:\mingw\include\unistd.h:100:29: note: declared here
int __cdecl __MINGW_NOTHROW usleep( useconds_t )__MINGW_ATTRIB_DEPRECATED;
^~~~~~
ujprog.c:479:5: warning: 'usleep' is deprecated [-Wdeprecated-declarations]
ms_sleep(10);
^~~~~~~~
In file included from ujprog.c:54:
c:\mingw\include\unistd.h:100:29: note: declared here
int __cdecl __MINGW_NOTHROW usleep( useconds_t )__MINGW_ATTRIB_DEPRECATED;
^~~~~~
ujprog.c:483:4: warning: 'usleep' is deprecated [-Wdeprecated-declarations]
ms_sleep(10);
^~~~~~~~
In file included from ujprog.c:54:
c:\mingw\include\unistd.h:100:29: note: declared here
int __cdecl __MINGW_NOTHROW usleep( useconds_t )__MINGW_ATTRIB_DEPRECATED;
^~~~~~
ujprog.c: In function 'shutdown_usb':
ujprog.c:620:2: warning: 'usleep' is deprecated [-Wdeprecated-declarations]
ms_sleep(10);
^~~~~~~~
In file included from ujprog.c:54:
c:\mingw\include\unistd.h:100:29: note: declared here
int __cdecl __MINGW_NOTHROW usleep( useconds_t )__MINGW_ATTRIB_DEPRECATED;
^~~~~~
ujprog.c: In function 'exec_svf_tokenized':
ujprog.c:1487:9: error: 'EOPNOTSUPP' undeclared (first use in this function); did you mean 'WSAEOPNOTSUPP'?
res = EOPNOTSUPP;
^~~~~~~~~~
WSAEOPNOTSUPP
ujprog.c:1487:9: note: each undeclared identifier is reported only once for each function it appears in
ujprog.c: In function 'async_read_block':
ujprog.c:2787:4: warning: 'usleep' is deprecated [-Wdeprecated-declarations]
ms_sleep(backoff * 4);
^~~~~~~~
In file included from ujprog.c:54:
c:\mingw\include\unistd.h:100:29: note: declared here
int __cdecl __MINGW_NOTHROW usleep( useconds_t )__MINGW_ATTRIB_DEPRECATED;
^~~~~~
ujprog.c: In function 'txfile':
ujprog.c:2978:3: warning: 'usleep' is deprecated [-Wdeprecated-declarations]
ms_sleep(50);
^~~~~~~~
In file included from ujprog.c:54:
c:\mingw\include\unistd.h:100:29: note: declared here
int __cdecl __MINGW_NOTHROW usleep( useconds_t )__MINGW_ATTRIB_DEPRECATED;
^~~~~~
ujprog.c:2994:3: warning: 'usleep' is deprecated [-Wdeprecated-declarations]
ms_sleep(200);
^~~~~~~~
In file included from ujprog.c:54:
c:\mingw\include\unistd.h:100:29: note: declared here
int __cdecl __MINGW_NOTHROW usleep( useconds_t )__MINGW_ATTRIB_DEPRECATED;
^~~~~~
ujprog.c:2996:3: warning: 'usleep' is deprecated [-Wdeprecated-declarations]
ms_sleep(100);
^~~~~~~~
In file included from ujprog.c:54:
c:\mingw\include\unistd.h:100:29: note: declared here
int __cdecl __MINGW_NOTHROW usleep( useconds_t )__MINGW_ATTRIB_DEPRECATED;
^~~~~~
ujprog.c:3008:3: warning: 'usleep' is deprecated [-Wdeprecated-declarations]
ms_sleep(50);
^~~~~~~~
In file included from ujprog.c:54:
c:\mingw\include\unistd.h:100:29: note: declared here
int __cdecl __MINGW_NOTHROW usleep( useconds_t )__MINGW_ATTRIB_DEPRECATED;
^~~~~~
ujprog.c:3028:4: warning: 'usleep' is deprecated [-Wdeprecated-declarations]
ms_sleep(txfu_ms);
^~~~~~~~
In file included from ujprog.c:54:
c:\mingw\include\unistd.h:100:29: note: declared here
int __cdecl __MINGW_NOTHROW usleep( useconds_t )__MINGW_ATTRIB_DEPRECATED;
^~~~~~
ujprog.c:3070:5: warning: 'usleep' is deprecated [-Wdeprecated-declarations]
ms_sleep(txfu_ms);
^~~~~~~~
In file included from ujprog.c:54:
c:\mingw\include\unistd.h:100:29: note: declared here
int __cdecl __MINGW_NOTHROW usleep( useconds_t )__MINGW_ATTRIB_DEPRECATED;
^~~~~~
ujprog.c:3073:4: warning: 'usleep' is deprecated [-Wdeprecated-declarations]
for(crc_retry = 4; crc_retry > 0 && res != 4; ms_sleep(10), crc_retry--)
^~~
In file included from ujprog.c:54:
c:\mingw\include\unistd.h:100:29: note: declared here
int __cdecl __MINGW_NOTHROW usleep( useconds_t )__MINGW_ATTRIB_DEPRECATED;
^~~~~~
ujprog.c:3131:3: warning: 'usleep' is deprecated [-Wdeprecated-declarations]
ms_sleep(50);
^~~~~~~~
In file included from ujprog.c:54:
c:\mingw\include\unistd.h:100:29: note: declared here
int __cdecl __MINGW_NOTHROW usleep( useconds_t )__MINGW_ATTRIB_DEPRECATED;
^~~~~~
ujprog.c: In function 'genbrk':
ujprog.c:3148:3: warning: 'usleep' is deprecated [-Wdeprecated-declarations]
ms_sleep(BREAK_MS);
^~~~~~~~
In file included from ujprog.c:54:
c:\mingw\include\unistd.h:100:29: note: declared here
int __cdecl __MINGW_NOTHROW usleep( useconds_t )__MINGW_ATTRIB_DEPRECATED;
^~~~~~
ujprog.c:3160:3: warning: 'usleep' is deprecated [-Wdeprecated-declarations]
ms_sleep(BREAK_MS);
^~~~~~~~
In file included from ujprog.c:54:
c:\mingw\include\unistd.h:100:29: note: declared here
int __cdecl __MINGW_NOTHROW usleep( useconds_t )__MINGW_ATTRIB_DEPRECATED;
^~~~~~
ujprog.c:3168:2: warning: 'usleep' is deprecated [-Wdeprecated-declarations]
ms_sleep(20);
^~~~~~~~
In file included from ujprog.c:54:
c:\mingw\include\unistd.h:100:29: note: declared here
int __cdecl __MINGW_NOTHROW usleep( useconds_t )__MINGW_ATTRIB_DEPRECATED;
^~~~~~
ujprog.c: In function 'debug_cmd':
ujprog.c:3439:4: warning: 'usleep' is deprecated [-Wdeprecated-declarations]
ms_sleep(c / 50000);
^~~~~~~~
In file included from ujprog.c:54:
c:\mingw\include\unistd.h:100:29: note: declared here
int __cdecl __MINGW_NOTHROW usleep( useconds_t )__MINGW_ATTRIB_DEPRECATED;
^~~~~~
ujprog.c: In function 'term_emul':
ujprog.c:3562:4: warning: 'usleep' is deprecated [-Wdeprecated-declarations]
ms_sleep(50);
^~~~~~~~
In file included from ujprog.c:54:
c:\mingw\include\unistd.h:100:29: note: declared here
int __cdecl __MINGW_NOTHROW usleep( useconds_t )__MINGW_ATTRIB_DEPRECATED;
^~~~~~
ujprog.c:3930:4: warning: 'usleep' is deprecated [-Wdeprecated-declarations]
ms_sleep(sleep_t);
^~~~~~~~
In file included from ujprog.c:54:
c:\mingw\include\unistd.h:100:29: note: declared here
int __cdecl __MINGW_NOTHROW usleep( useconds_t )__MINGW_ATTRIB_DEPRECATED;
^~~~~~
ujprog.c: In function 'main':
ujprog.c:4215:3: warning: 'usleep' is deprecated [-Wdeprecated-declarations]
ms_sleep(1); // small delay for f32c to start
^~~~~~~~
In file included from ujprog.c:54:
c:\mingw\include\unistd.h:100:29: note: declared here
int __cdecl __MINGW_NOTHROW usleep( useconds_t )__MINGW_ATTRIB_DEPRECATED;
^~~~~~
make: *** [ujprog.o] Error 1
with these versions, fresh clone: git clone https://github.com/f32c/tools.git f32c_tools
$ git log -1 -- Makefile.win
commit 9b9fc13c59f179c4a71ab6314181984f516754bd
Author: Marko Zec <[email protected]>
Date: Sun Dec 17 00:59:08 2017 +0100
Unbreak build with MSYS2 MinGW 32-bit. Dev-C++ build will no longer work.
ujprog xp2.svf works out of the box.
ujprog ecp5.svf still doesn't, investigating why...
$ git log -1 -- ujprog.c
commit c02dc41b925729f7edf0030e5c94eee9735b6824
Author: gornjas <[email protected]>
Date: Sat Dec 29 14:24:34 2018 +0100
Add -f addr specifies a base address for SPI writes using -j flash.
Perhaps I'm still doing something wrong? I do agree that if there's a better solution such as using the proper errno.h - that's probably a better change.
heads up that I appended some other minor, non-code changes to this PR (recent FTDI lib file, add README, etc). Perhaps I should have created a separate PR, but you are welcome to cherry-pick if you find any of this useful.
HI
actually I'm not great git expert with cherrypicking; I'm planning
first to start from
your readme updates, and copy paste them to mainstream. Better docs
are always welcome.
I can't decide what to do with ujprog code and win32 changes,
I must leave up to "gornjas" the author of ujprog
Have you succeeded in staticaly compiled windows executable?
(so all dll's compiled in, no external files needed)
That's a great achievement and would improve compatibility
On 2/15/19, gojimmypi ***@***.***> wrote:
heads up that I appended some other minor, non-code changes to this PR
(recent FTDI lib file, add README, etc). Perhaps I should have created a
separate PR, but you are welcome to cherry-pick if you find any of this
useful.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
#8 (comment)
@emard if you let me know the destination, I can create a specific PR for you.
regarding your comment on statically compiled windows executable - well, I am able to compile ujprog in WSL Ubuntu for the Windows target (64 bit) using mingw-w64 (see my blog here), copying the latest FTDI ftd2xx.h and ftd2xx.lib files from the FTDI zip download into the ujprog directory.
specifically:
sudo apt-get install mingw-w64
# Get a make file if PR not yet merged
wget https://raw.githubusercontent.com/gojimmypi/f32c_tools/master/ujprog/Makefile.ming32_64
# My c:\download\ftdi\ directory...
cp "/mnt/c/download/ftdi/CDM v2.12.28 WHQL Certified/amd64/ftd2xx.lib" ./ftd2xx.lib
cp "/mnt/c/download/ftdi/CDM v2.12.28 WHQL Certified/ftd2xx.h" ./ftd2xx.h
make clean -f Makefile.ming32_64
make -f Makefile.ming32_64
Note my Makefile.ming32_64 (also included in the PR) specifies the MinGW cross compiler:
CPP = x86_64-w64-mingw32-gcc
CC = x86_64-w64-mingw32-gcc
However you specifically noted statically compiled. Well, there is a ftd2xx.lib file in the "static" download directory; this is not the one I used (I tried, it did not compile):
Otherwise the executable created is portable, in that I can move it to any directory and there are no DLL's or other files needed... however Windows of course still has the DLL's installed in the system for the device (otherwise it would not work anyhow)
C:\test>ujprog ulx3s.bit
ULX2S / ULX3S JTAG programmer v 3.0.92 (built Feb 15 2019 14:18:16)
Using USB cable: ULX3S FPGA 12K v3.0.3
Programming: 100%
Completed in 16.63 seconds.
Pardon my lack of knowledge here; Sorry if I've not answered your question clearly.
One thing I'd like to add is that the @tinyfpga can be programmed without any special drivers, using only the /dev/ttySn serial devices. (see my blog here) This would be a highly desirable feature for the ULX3S - particularly in that OpenOCD (libusbK) and ujprog (FTDI) cannot be used concurrently in Windows - and in my case, libusbK cannot be used at all in WSL,
HI
I cleaned up your makefile and improved it to automatically download
and unzip the required file.
Makefile.ming32_64
can you check this makefile and and output does it really work on your windows?
It compiles ujprog.exe on my debian without any modification of ujprog.c
On 2/15/19, gojimmypi ***@***.***> wrote:
@emard if you let me know the destination, I can create a specific PR for
you.
regarding your comment on _**statically** compiled windows executable_ -
well, I am able to compile `ujprog` in WSL Ubuntu for the Windows target (64
bit) using `mingw-w64` (see my blog
[here](https://gojimmypi.blogspot.com/2019/02/ulx3s-ujprog-on-windows-wsl-or-minggw.html)),
copying the latest FTDI `ftd2xx.h` and `ftd2xx.lib` files from the FTDI zip
download into the ujprog directory.
specifically:
```
sudo apt-get install mingw-w64
# Get a make file if PR not yet merged
wget
https://raw.githubusercontent.com/gojimmypi/f32c_tools/master/ujprog/Makefile.ming32_64
# My c:\download\ftdi\ directory...
cp "/mnt/c/download/ftdi/CDM v2.12.28 WHQL Certified/amd64/ftd2xx.lib"
./ftd2xx.lib
cp "/mnt/c/download/ftdi/CDM v2.12.28 WHQL Certified/ftd2xx.h" ./ftd2xx.h
make clean -f Makefile.ming32_64
make -f Makefile.ming32_64
```
Note my `Makefile.ming32_64` (also included in the PR) specifies the MinGW
cross compiler:
```
CPP = x86_64-w64-mingw32-gcc
CC = x86_64-w64-mingw32-gcc
```
However you specifically noted _statically_ compiled. Well, there _is_ a
`ftd2xx.lib` file in the "static" download directory; this is _not_ the one
I used (I tried, it did not compile):
```
CDM v2.12.28 WHQL Certified\Static\amd64\ftd2xx.lib
```
Otherwise the executable created is portable, in that I can move it to any
directory and there are no DLL's or other files needed... however Windows of
course still has the DLL's installed in the system for the device (otherwise
it would not work anyhow)
```
C:\test>ujprog ulx3s.bit
ULX2S / ULX3S JTAG programmer v 3.0.92 (built Feb 15 2019 14:18:16)
Using USB cable: ULX3S FPGA 12K v3.0.3
Programming: 100%
Completed in 16.63 seconds.
```
Pardon my lack of knowledge here; Sorry if I've not answered your question
clearly.
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#8 (comment)
You can take my tinyfpgasp yes ulx3s can be flash over us2 port
similar like tinyfpga.
tinyfpga USB protocol is not 100% compatible, something is wrong when USB errors
need to be retried and it will drop packets.
It's better off to use different usb-serial core but I tried to make a
cleaner one
but it still drops packets but in different way :)
On 2/16/19, D EMARD ***@***.***> wrote:
HI
I cleaned up your makefile and improved it to automatically download
and unzip the required file.
Makefile.ming32_64
can you check this makefile and and output does it really work on your
windows?
It compiles ujprog.exe on my debian without any modification of ujprog.c
On 2/15/19, gojimmypi ***@***.***> wrote:
> @emard if you let me know the destination, I can create a specific PR for
> you.
>
> regarding your comment on _**statically** compiled windows executable_ -
> well, I am able to compile `ujprog` in WSL Ubuntu for the Windows target
> (64
> bit) using `mingw-w64` (see my blog
> [here](https://gojimmypi.blogspot.com/2019/02/ulx3s-ujprog-on-windows-wsl-or-minggw.html)),
> copying the latest FTDI `ftd2xx.h` and `ftd2xx.lib` files from the FTDI
> zip
> download into the ujprog directory.
>
> specifically:
>
> ```
> sudo apt-get install mingw-w64
>
> # Get a make file if PR not yet merged
> wget
> https://raw.githubusercontent.com/gojimmypi/f32c_tools/master/ujprog/Makefile.ming32_64
>
> # My c:\download\ftdi\ directory...
> cp "/mnt/c/download/ftdi/CDM v2.12.28 WHQL Certified/amd64/ftd2xx.lib"
> ./ftd2xx.lib
> cp "/mnt/c/download/ftdi/CDM v2.12.28 WHQL Certified/ftd2xx.h" ./ftd2xx.h
>
> make clean -f Makefile.ming32_64
> make -f Makefile.ming32_64
> ```
>
> Note my `Makefile.ming32_64` (also included in the PR) specifies the
> MinGW
> cross compiler:
>
> ```
> CPP = x86_64-w64-mingw32-gcc
> CC = x86_64-w64-mingw32-gcc
> ```
> However you specifically noted _statically_ compiled. Well, there _is_ a
> `ftd2xx.lib` file in the "static" download directory; this is _not_ the
> one
> I used (I tried, it did not compile):
> ```
> CDM v2.12.28 WHQL Certified\Static\amd64\ftd2xx.lib
> ```
> Otherwise the executable created is portable, in that I can move it to
> any
> directory and there are no DLL's or other files needed... however Windows
> of
> course still has the DLL's installed in the system for the device
> (otherwise
> it would not work anyhow)
>
> ```
> C:\test>ujprog ulx3s.bit
> ULX2S / ULX3S JTAG programmer v 3.0.92 (built Feb 15 2019 14:18:16)
> Using USB cable: ULX3S FPGA 12K v3.0.3
> Programming: 100%
> Completed in 16.63 seconds.
> ```
>
> Pardon my lack of knowledge here; Sorry if I've not answered your
> question
> clearly.
>
>
>
> --
> You are receiving this because you were mentioned.
> Reply to this email directly or view it on GitHub:
> #8 (comment)
@emard regarding Makefile.ming32_64; ah yes, that is graceful and efficient, and not dependent on a mystery lib file from someone's repo (although when the FTDI web site gets updated, the Makefile breaks).
yes, it works in WSL Ubuntu (the only thing missing for me was unzip):
sudo apt-get install unzip
mkdir temp2
cd temp2
git clone https://github.com/f32c/tools.git
cd tools/ujprog
make -f Makefile.ming32_64
and the build was succcessful!
0 $ make -f Makefile.ming32_64
x86_64-w64-mingw32-gcc -c ujprog.c -o ujprog.o -I.
wget -c "https://www.ftdichip.com/Drivers/CDM/CDM%20v2.12.28%20WHQL%20Certified.zip" -O ftdi.zip
Will not apply HSTS. The HSTS database must be a regular and non-world-writable file.
ERROR: could not open HSTS store at '/home/gojimmypi/.wget-hsts'. HSTS will be disabled.
--2019-02-15 15:42:38-- https://www.ftdichip.com/Drivers/CDM/CDM%20v2.12.28%20WHQL%20Certified.zip
Resolving www.ftdichip.com (www.ftdichip.com)... 217.160.0.65
Connecting to www.ftdichip.com (www.ftdichip.com)|217.160.0.65|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1682976 (1.6M) [application/zip]
Saving to: ‘ftdi.zip’
ftdi.zip 100%[=====================================================================>] 1.60M 1.12MB/s in 1.4s
2019-02-15 15:42:40 (1.12 MB/s) - ‘ftdi.zip’ saved [1682976/1682976]
unzip ftdi.zip amd64/ftd2xx.lib
Archive: ftdi.zip
inflating: amd64/ftd2xx.lib
touch amd64/ftd2xx.lib
x86_64-w64-mingw32-gcc ujprog.o -o "ujprog.exe" -s -static -L. -lamd64/ftd2xx
then copy to C:\test2 for Windows
cp ujprog.exe /mnt/c/test2
tada!
C:\test2>ujprog ulx3s.bit
ULX2S / ULX3S JTAG programmer v 3.0.92 (built Feb 15 2019 15:42:37)
Using USB cable: ULX3S FPGA 12K v3.0.3
Programming: 100%
Completed in 16.59 seconds.
edit: even more interesting is that yes, it compiles... specifically these lines are not in the ujprog.c - yet I also did not encounter the EOPNOTSUPP errors originally described in this issue (above):
#undef EOPNOTSUPP
#define EOPNOTSUPP WSAEOPNOTSUPP /* Operation not supported */
@emard regarding tinyfpga USB protocol - I recall reading something about "ValentyUSB" enhancements for the tomu board. I think some progress was made, but I cannot immediately seem to find it. Are you on twitter? perhaps ask there.
Eheheee great
when ftdi removes this file let me know I will fix it easy
I slightly fixed Makefile.ming32 now it compiles for win32 version of
ftdi library.
I don't know if win32 binary can also work on win64 machine, maybe you can
try and test it too :)?
I also included your readme and images
On 2/16/19, gojimmypi ***@***.***> wrote:
@emard regarding `Makefile.ming32_64`; ah yes, that is graceful and
efficient, and not dependent on a mystery lib file from someone's repo
(although when the FTDI web site gets updated, the Makefile breaks).
yes, it works in WSL Ubuntu (the only thing missing for me was `unzip`):
```
sudo apt-get install unzip
mkdir temp2
cd temp2
git clone https://github.com/f32c/tools.git
cd tools/ujprog
make -f Makefile.ming32_64
```
and the build was succcessful!
```
0 $ make -f Makefile.ming32_64
x86_64-w64-mingw32-gcc -c ujprog.c -o ujprog.o -I.
wget -c
"https://www.ftdichip.com/Drivers/CDM/CDM%20v2.12.28%20WHQL%20Certified.zip"
-O ftdi.zip
Will not apply HSTS. The HSTS database must be a regular and
non-world-writable file.
ERROR: could not open HSTS store at '/home/gojimmypi/.wget-hsts'. HSTS will
be disabled.
--2019-02-15 15:42:38--
https://www.ftdichip.com/Drivers/CDM/CDM%20v2.12.28%20WHQL%20Certified.zip
Resolving www.ftdichip.com (www.ftdichip.com)... 217.160.0.65
Connecting to www.ftdichip.com (www.ftdichip.com)|217.160.0.65|:443...
connected.
HTTP request sent, awaiting response... 200 OK
Length: 1682976 (1.6M) [application/zip]
Saving to: ‘ftdi.zip’
ftdi.zip
100%[=====================================================================>]
1.60M 1.12MB/s in 1.4s
2019-02-15 15:42:40 (1.12 MB/s) - ‘ftdi.zip’ saved [1682976/1682976]
unzip ftdi.zip amd64/ftd2xx.lib
Archive: ftdi.zip
inflating: amd64/ftd2xx.lib
touch amd64/ftd2xx.lib
x86_64-w64-mingw32-gcc ujprog.o -o "ujprog.exe" -s -static -L.
-lamd64/ftd2xx
```
then copy to C:\test2 for Windows
```
cp ujprog.exe /mnt/c/test2
```
tada!
```
C:\test2>ujprog ulx3s.bit
ULX2S / ULX3S JTAG programmer v 3.0.92 (built Feb 15 2019 15:42:37)
Using USB cable: ULX3S FPGA 12K v3.0.3
Programming: 100%
Completed in 16.59 seconds.
```
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#8 (comment)
the root cause of the 'EOPNOTSUPP' undeclared error message appears to be using the old header and lib file (the ones from 4 years ago in this repo) to compile.
Using the most recent ftd2xx.h and ftd2xx.lib from the FTDI zip file resolves the error (and all the warnings) without having to make the code change suggested above.
Activity
gojimmypi commentedon Feb 11, 2019
I created this PR to fix: #9
gornjas commentedon Feb 13, 2019
ujprog builds perfectly fine (no errors or warnings whatsoever) as-is from day 0 on M$ windows, using MSYS MINGW32. make -f Makefile.win is all it takes.
I'm not inclined to accept the proposed patch, as it more likely reflects some problem in the build system (probably including a wrong errno.h) rather than a problem in ujprog.c itself.
Note that we went to great lengths to make and keep ujprog portable across a broad range of platforms (Win32, Linux, FreeBSD, OSX), hence my reluctance to accept a windows-specific fix for a non-issue.
gojimmypi commentedon Feb 13, 2019
@gornjas - I appreciate the efforts to make it
ujprogportable. Respectfully, this is what I see in mingw32 on Windows 10 1803 17134.556:Here's the entire output:
with these versions, fresh clone:
git clone https://github.com/f32c/tools.git f32c_toolsPerhaps I'm still doing something wrong? I do agree that if there's a better solution such as using the proper
errno.h- that's probably a better change.gojimmypi commentedon Feb 15, 2019
heads up that I appended some other minor, non-code changes to this PR (recent FTDI lib file, add README, etc). Perhaps I should have created a separate PR, but you are welcome to cherry-pick if you find any of this useful.
emard commentedon Feb 15, 2019
gojimmypi commentedon Feb 15, 2019
@emard if you let me know the destination, I can create a specific PR for you.
regarding your comment on statically compiled windows executable - well, I am able to compile
ujprogin WSL Ubuntu for the Windows target (64 bit) usingmingw-w64(see my blog here), copying the latest FTDIftd2xx.handftd2xx.libfiles from the FTDI zip download into the ujprog directory.specifically:
Note my
Makefile.ming32_64(also included in the PR) specifies the MinGW cross compiler:However you specifically noted statically compiled. Well, there is a
ftd2xx.libfile in the "static" download directory; this is not the one I used (I tried, it did not compile):Otherwise the executable created is portable, in that I can move it to any directory and there are no DLL's or other files needed... however Windows of course still has the DLL's installed in the system for the device (otherwise it would not work anyhow)
Pardon my lack of knowledge here; Sorry if I've not answered your question clearly.
gojimmypi commentedon Feb 15, 2019
One thing I'd like to add is that the @tinyfpga can be programmed without any special drivers, using only the
/dev/ttySnserial devices. (see my blog here) This would be a highly desirable feature for the ULX3S - particularly in that OpenOCD (libusbK) and ujprog (FTDI) cannot be used concurrently in Windows - and in my case,libusbKcannot be used at all in WSL,emard commentedon Feb 15, 2019
emard commentedon Feb 15, 2019
gojimmypi commentedon Feb 15, 2019
@emard regarding
Makefile.ming32_64; ah yes, that is graceful and efficient, and not dependent on a mystery lib file from someone's repo (although when the FTDI web site gets updated, the Makefile breaks).yes, it works in WSL Ubuntu (the only thing missing for me was
unzip):and the build was succcessful!
then copy to C:\test2 for Windows
tada!
edit: even more interesting is that yes, it compiles... specifically these lines are not in the
ujprog.c- yet I also did not encounter the EOPNOTSUPP errors originally described in this issue (above):gojimmypi commentedon Feb 16, 2019
@emard regarding tinyfpga USB protocol - I recall reading something about "ValentyUSB" enhancements for the tomu board. I think some progress was made, but I cannot immediately seem to find it. Are you on twitter? perhaps ask there.
emard commentedon Feb 16, 2019
gojimmypi commentedon Feb 16, 2019
the root cause of the
'EOPNOTSUPP' undeclarederror message appears to be using the old header and lib file (the ones from 4 years ago in this repo) to compile.Using the most recent
ftd2xx.handftd2xx.libfrom the FTDI zip file resolves the error (and all the warnings) without having to make the code change suggested above.emard commentedon Feb 16, 2019
Makefile.ming32 and Makefile.ming32_64 fix this