Just got my iCEBreaker board and wanted to test it, sadly for me my linux box got broken so i gave WSL a try, i have installed all the requirements (icestorm, yosys, nextpnr for ice40).
After adding the file /etc/udev/rules.d/53-lattice-ftdi.rules with the following content:
Considering how slow the radiant programmer can be, it would indeed be nice to have a iceprog version that uses winusb instead of libusb. That might be a way forward until WSL gets proper USB device support.
Thanks for the reply @esden, just upvoted the request for libusb support on WSL.
I will take a look at the radiant programmer setup, if i understand correctly i should be able to access the generated bitstreams from the WSL on the Windows file system and use radiant from there…, that should work since I am doing pretty basic stuff.
Having a winusb based iceprog would be a nice challenge to solve
Yes you are correct. You would run Radiant programmer on Windows and access the binaries created in WSL.
There is also another way of doing things. APIO comes with the full toolchain and contains iceprog as far as I know. So you can write your hdl in the apio-ide. That also means you would have to recreate the example projects that use gnu make in apio, as apio forces you to use scons as far as I know. Or you can call the iceprog binary directly. I bet there are multiple ways of solving the programming under windows situation.
I was able to get the FPGAwars Windows build of iceprog working. As a bonus WSL allows you to run a windows EXE from its bash prompt so with some minor modifications you can run it all from within bash.
The only catch is that you need to change the USB drivers to libusbK. Icestudio handles this pretty nicely, but really it has just bundled this tool called Zadig: https://zadig.akeo.ie/
If you haven’t already, plug in your iCEBreaker and let windows install the default drivers
Download and run Zadig
On the “Options” menu select “List All Devices”
Find your iCEBreaker Interface 0 and select it in the combo box (mine appears as “iCEBreaker V1.0e (Interface 0)”)
The left-hand side will list the current driver installed for the device. On the right-hand side change it to libusbK.
Click “Replace Driver” and wait
Repeat steps 4,5,6 for iCEBreaker Interface 1
Unplug the iCEBreaker and plug back in to load the new drivers
You can download the prebuilt toolchain for windows here which contains iceprog.exe: https://github.com/FPGAwars/toolchain-icestorm/releases
If you add the install folder to your bash path then you can just run iceprog.exe from your Makefile instead of iceprog. E.g. export PATH=/mnt/c/Users/Ed/Downloads/icestorm/bin/:$PATH. One caveat is that it will expect Windows paths rather than unix paths. It happens to work fine for WTFpga because that uploads the file relative to the current directory. For any other file paths you will probably need to translate them using them wslpath -w. Or you can just build in WSL and program your device in cmd.exe if it’s easier. I might work on a wrapper script that will transparently do the path translation but it’s not totally trivial.
Thanks for the help, just to be shure, i downloaded and extracted the custom iceprog in the Windows side of my file system. Then added on the WSL side i add it to the bash PATH, go to the wtfpga directory and run
$ iceprog.exe wtfpga.bin
No such file or directory
C:\Users\me\Downloads\icestorm\bin\iceprog.exe: can’t open ‘wtfpga.bin’ for reading
But i copied wtfpga.bin to a usb stick, moved the file to the Windows side (didn’t tested another way to transfer the file) and ran iceprog.exe from there, i was able to program and verify the bitstream download
I will try to search a way to solve the issue when trying to upload from WSL, it is a bit anoying to transfer the file to Windows.
The “No such file or directory” error is probably just due to working in a folder that doesn’t exist in the Windows filesystem. If you clone wtfpga under /mnt/c/<path> then WSL should run iceprog.exe with the working directory set to C:\<path> and it will be able to see your bin file.