6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Apr 27, 2024 5:39 pm

All times are UTC




Post new topic Reply to topic  [ 14 posts ] 
Author Message
PostPosted: Fri Jun 23, 2023 11:37 am 
Offline

Joined: Sat Oct 09, 2021 11:21 am
Posts: 703
Location: Texas
*** This first topic has been edited to quickly present the final solution needed to program current production Xilinx CPLD's using modern Linux distributions, particularly Ubuntu/Mint. This post was created in June 2023. ***

Howdy everyone, this topic is just informative to whomever comes across it. It is currently June 2023, there IS a way to program current production CPLD's with a modern version of Linux. Below is my journey, and Ed helped push me to the final solution. Thank you again Ed!

After looking around the internet, I found that Xilinx software was made for Linux (primarily), not Windows (necessarily). So that has been my target the entire time. They have many CPLD's such as the XC9500 series that are both cheap and available on Mouser.com. They likewise come in a package that you can still SMD hand-solder. The way to program for them is using the Xilinx ISE 14.7 software. The JTAG programmer I bought was the Xilinx Platform Cable USB. It uses USB on the PC side of things, and a JTAG connector to link to the chips. I think I spent about $50 on it, I bought mine from Amazon and it shipped to my house after 3 weeks or so. Sometimes the programmer also has a "II" after it, but I haven't found that make a difference really. Mine is NOT the "IV" version though.

It was super easy to get the software from the Xilinx website. You have to register your email with them, and when you are installing I think you need to log in for license stuff(?). Every time I start the ISE program though it continues to pester me for licenses but doesn't do anything about it. I don't remember many problems when installing it on Linux, I am sure the typical Linux issues will come up from time to time. I remember changing a #!/bin/sh to #!/bin/bash once, but nothing drastic. I think I also have to continually "source settings64.sh", because I do that every time before running "ise". I made a script to do it all for me, you might have different results.

The cable driver installation will fail during the ISE installation. I was told that this would happen regardless, so I let it go, and started looking for ways to install the drivers manually. I found some solutions that seemed like they would work, but in the end it would not. The main problem is that newer Linux kernels do not include some basic things that these older cable drivers relied on. Likewise, there is need of "windrvr6" which is just impossible to install on a modern Linux computer. I tried MANY different ways, and have found nothing suitable through Xilinx themselves. Through all of my journey I might have found a way to 'install the drivers' just without "windrvr6", so the dedicated programming software, called Impact, would not program the CPLD's simply because of that one missing driver.

None the less, eventually I was indirectly pointed to the solution by Ed. What you need to do is:

Code:
sudo apt-get install xc3sprog


*** EDIT: Apparently it needs a bit more than just that. I followed the steps here: https://github.com/JohnDMcMaster/xilinx ... ree/master and then did 'service udev restart'. The gist of it is that you need to run the ISE's "setup_pcusb" and then copy all of the "xusb*" files into /usr/share, or something like that. You also need to copy the xusbdfwu.rules to /etc/udev/rules.d folder. That's why you need to restart udev. ***

I tried getting it to work on the Raspberry Pi to eliminate the need for the Xilinx JTAG programmer, but because WiringPi is not supported in the newer OS's, that flavor of xc3sprog is just not going to work. Instead, install it directly onto your Linux desktop, and use the official Xilinx JTAG programmer, and it works beautifully! All you need to do is:

Code:
xc3sprog -c xpc MyProgram.jed


In case you are new to CPLD's, the .jed file is what will program the CPLD when sent through the JTAG programmer. You get that file from running the ISE 14.7 software as usual. Instead of using the built in Impact programmer, simply pull up a terminal and command-line your programmer to make it work. You can also use xc3sprog to program "older" FPGA's using .bit files. I believe ISE 14.7 will create those for you as well when you are programming specifically for an FPGA.

Lastly, a bit of advice on the ISE 14.7 software. I started trying to use the 'schematics' side of things, but was quickly disappointed. It is *nothing* like KiCad. So instead I started learning Verilog. It is a C-based programming language that I found to be VERY helpful. I am still fairly new to it all, but I was able to adjust things very quickly. There is also a "Constraints" file you need have to create pin number assignments. Each pin needs a line like:

Code:
NET clock LOC = P2 ;


With "clock" coming from the Verilog file, and "P2" being different for different devices. The XC9500 just happen to be fairly easy in that regard.

Overall, the experience has been difficult to reach, but so satisfying in the end!

Here is a bit of other things I have learned:

So what does Xilinx offer now-a-days? The Vivado Design Suite is currently being used, it's free, but it is only for very recent FPGA's, particularly Artix7, Zynq7, and Spartan7 (might be others). Anything older is NOT supported by Vivado at all, no matter if it's the 2014 version or the 2021 version. Mouser has some of these laying around, and I tried to attempt to program for the XC7S6-1CSGA225C which is relatively cheap.

Since I have the programmer now and infinite hard drive space I decided to give it whirl anyways. There's Youtube videos on how to install Vivado and get it running. I had no complications at all using Linux, because it seems built for Linux. I also installed the LabTools which I will get to later. Programming in Vivado wasn't too hard using Verilog, but the Constraints are just crazy! After much trial and error, I got only "critical warnings" instead of errors finally.

After creating the bitstream file (used for programming these modern FPGA chips), open up the Hardware Manager from LabTools. Now, I didn't have an XC7S6 on me, so I cannot actually program anything. BUT, I had LabTools open with my programmer attached to the XC9500 earlier, and it certainly detected it. I couldn't *program* it unfortunately, but I could tell that my programmer was actually detected by the software program.

Conclusions:

- Xilinx ISE 14.7 will indeed install and run on modern versions of Linux. It will NOT program the CPLD's or FPGA's, but it will generate the .jed or .bit files you need.

- Use 'xc3sprog' to program your devices. Using the official Xilinx Platform Cable USB JTAG programmer is still recommended.

- It seems that Xilinx is *really* only supporting "Series 7" FPGA's at this point. But, the are continuing to produce these 'older' CPLD's regardless, and that's good enough for me.

I hope this short guide was helpful to you. The reason I'm posting this in so much detail is because I really wanted to do this for a while, and I also had a lot of confusion and trouble along the way. I am not a Windows user, and I didn't want to rely on chips that were no longer supplied by mainline distributors like Mouser. I guess the time and effort eventually paid off. Hopefully it will be easier for you now :)

Thank you for reading!

Chad

Edit: Adding Pictures, with code. I'm currently testing it with the Arduino, sorry it's not directly 6502 right now. The Arduino is able to send a clock signal to the CPLD. The CPLD then flip-flops the value, blinking it's own light, and then sending the value back to the Arduino. The Arduino then turns it's own light according to what it receives from the CPLD. Conclusion: The CPLD can receive, compute, and send back data!


Attachments:
VerilogCode.png
VerilogCode.png [ 262.88 KiB | Viewed 6947 times ]
ArduinoCode.png
ArduinoCode.png [ 104.59 KiB | Viewed 6947 times ]
20230623_152509.jpg
20230623_152509.jpg [ 2.1 MiB | Viewed 6947 times ]
20230623_152511.jpg
20230623_152511.jpg [ 2.15 MiB | Viewed 6947 times ]


Last edited by sburrow on Sun Jan 14, 2024 1:21 am, edited 7 times in total.
Top
 Profile  
Reply with quote  
PostPosted: Fri Jun 23, 2023 12:01 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10793
Location: England
Sorry to hear your story of woe, but I feel it's likely that there's a way. If nothing else, I expect one can program over JTAG from a Raspberry Pi. (It's important to distinguish the synthesis, which converts your design into a bitstream, from the programming, which puts that bitstream into the target device.)

(I've heard that Vivado is huge and annoying. I've only used ISE myself.)


Top
 Profile  
Reply with quote  
PostPosted: Fri Jun 23, 2023 2:55 pm 
Offline

Joined: Sat Oct 09, 2021 11:21 am
Posts: 703
Location: Texas
BigEd wrote:
Sorry to hear your story of woe, but I feel it's likely that there's a way. If nothing else, I expect one can program over JTAG from a Raspberry Pi. (It's important to distinguish the synthesis, which converts your design into a bitstream, from the programming, which puts that bitstream into the target device.)

(I've heard that Vivado is huge and annoying. I've only used ISE myself.)


Ed, thank you. Sometimes I get in a rut. Sometimes I think only one way! But you forced me to look elsewhere, and by golly, it worked! Official Xilinx methods are NOT the answer. Instead "xc3sprog" is the answer.

Code:
sudo apt-get install xc3sprog
./xc3sprog -c xpc MyProgram.jed


And it works! It finally works with the XC9500! Wow that is SO cool!

Thank you Ed, thank you for that little bit of encouragement that I needed. I'll be editing the top post now. Thank you thank you!

Chad


Top
 Profile  
Reply with quote  
PostPosted: Fri Jun 23, 2023 3:29 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10793
Location: England
Oh, nice result!


Top
 Profile  
Reply with quote  
PostPosted: Fri Jun 23, 2023 5:55 pm 
Offline

Joined: Fri Oct 04, 2019 4:26 am
Posts: 19
Location: Rancho Cordova, CA
It appears that you want to use Xilinx ISE on Linux and say it won't work on Windows but Xilinx ISE 14.7 does run on Windows because I use it on Windows and program CPLDs just fine with the USB Platform Cable. ISE launches "Imact" to to talk to the programmer. "Impact" can be ran ran stand alone if need be.

Maybe the issue is they don't provide the Windows version on their website anymore. Last I looked they did.


Greg


Top
 Profile  
Reply with quote  
PostPosted: Fri Jun 23, 2023 7:01 pm 
Offline

Joined: Sat Oct 09, 2021 11:21 am
Posts: 703
Location: Texas
greghol wrote:
It appears that you want to use Xilinx ISE on Linux and say it won't work on Windows but Xilinx ISE 14.7 does run on Windows because I use it on Windows and program CPLDs just fine with the USB Platform Cable. ISE launches "Imact" to to talk to the programmer. "Impact" can be ran ran stand alone if need be.

Maybe the issue is they don't provide the Windows version on their website anymore. Last I looked they did.

Greg


They have a Windows 10 version of 14.7, but I hear it runs inside of a Linux emulator. Either way, I am not a Windows user, so Linux-only was the goal of this project.

Chad


Top
 Profile  
Reply with quote  
PostPosted: Fri Jun 23, 2023 9:25 pm 
Online
User avatar

Joined: Fri Aug 03, 2018 8:52 am
Posts: 745
Location: Germany
i tried the "Win10" version of ISE once... it basically just installed Virtualbox, setup up a Win7 VM (or rather made me do it) and ran the installer in that.
it's ridiculously stupid.


Top
 Profile  
Reply with quote  
PostPosted: Sat Jun 24, 2023 1:42 am 
Offline
User avatar

Joined: Sat Dec 01, 2018 1:53 pm
Posts: 727
Location: Tokyo, Japan
For what it's worth, I have some notes on programming the XC9572XL from Linux in this Xilinx Development Tools document. This uses the Xilinx ISE software and a userland replacement for Windriver6 mentioned here. The replacement driver talks to the programmer directly via libusb; this avoids having to install kernel modules that break with every new Linux release.

In my repo there are also some hardware notes. I use this clone of the Xilinx "Platform Cable USB II" (model DLC10) programmer, also called the HW-USB-II-G; it goes for about US$30 including shipping.

_________________
Curt J. Sampson - github.com/0cjs


Top
 Profile  
Reply with quote  
PostPosted: Sat Jun 24, 2023 2:09 am 
Offline

Joined: Sat Oct 09, 2021 11:21 am
Posts: 703
Location: Texas
Excellent links, cjs! Thank you for those.

I had tried that "userland replacement for WinDriver6", but it didn't work for me. Can't tell you why exactly. Your programmer also looks oddly familiar to me ;) Well, it seems you went down the same road that I did, or at least a parallel one.

Thanks!

Chad


Top
 Profile  
Reply with quote  
PostPosted: Sat Jun 24, 2023 2:55 am 
Offline
User avatar

Joined: Sat Dec 01, 2018 1:53 pm
Posts: 727
Location: Tokyo, Japan
sburrow wrote:
I had tried that "userland replacement for WinDriver6", but it didn't work for me. Can't tell you why exactly.

It may be worth trying again, carefully following the instructions in my document and posting whatever error messages you get here. You can't build it without libusb installed, so that missing library wouldn't be an issue. My first thought would be that it didn't work for you because you didn't use the LD_PRELOAD setting when running impact; that one is easy to forget.

Quote:
Your programmer also looks oddly familiar to me ;)

Yes, yours is no doubt the same. It's just cheaper if you order it directly from China.

_________________
Curt J. Sampson - github.com/0cjs


Top
 Profile  
Reply with quote  
PostPosted: Sat Jun 24, 2023 6:35 am 
Offline

Joined: Tue Jul 05, 2005 7:08 pm
Posts: 990
Location: near Heidelberg, Germany
I am running ISE for quite some time now on Linux.

I use the platform USB cable ii and I am using iirc the userspace libusb driver.

Works well programming my designs with xc95...xl and even now a spartan 3e

_________________
Author of the GeckOS multitasking operating system, the usb65 stack, designer of the Micro-PET and many more 6502 content: http://6502.org/users/andre/


Top
 Profile  
Reply with quote  
PostPosted: Sat Jun 24, 2023 9:44 am 
Offline

Joined: Sat Oct 09, 2021 11:21 am
Posts: 703
Location: Texas
cjs wrote:
It may be worth trying again,


I spent so many hours trying to get it to work, that I'm not willing to try again :) I did do the 'preload' and all that. I don't know about you, but I find that there are always numerous "Linux issues" when trying to install things. If I am told to "make" anything, kiss it goodbye, that probably won't work! Maybe I'm still a Linux-newbie even after 20 years of nothing besides Linux, but I just prefer simple "double click" answers to things. AppImage's are the best thing ever, and .deb files have never done me wrong.

I'm glad both of y'all got it working somehow. I'm also glad that I got mine working, even through an alternative method!

Chad


Top
 Profile  
Reply with quote  
PostPosted: Sat Jun 24, 2023 2:19 pm 
Offline
User avatar

Joined: Tue Mar 05, 2013 4:31 am
Posts: 1373
sburrow wrote:
cjs wrote:
It may be worth trying again,


I spent so many hours trying to get it to work, that I'm not willing to try again :) I did do the 'preload' and all that. I don't know about you, but I find that there are always numerous "Linux issues" when trying to install things. If I am told to "make" anything, kiss it goodbye, that probably won't work! Maybe I'm still a Linux-newbie even after 20 years of nothing besides Linux, but I just prefer simple "double click" answers to things. AppImage's are the best thing ever, and .deb files have never done me wrong.

I'm glad both of y'all got it working somehow. I'm also glad that I got mine working, even through an alternative method!

Chad


Yes, I hear you on having to do a "make" for getting something installed and working on Linux. I started playing around with Linux over 20 years ago... have dozens of packaged distros sitting here and hundreds of CD/DVD images and such. In my humble view, Linux certainly has it's place and there's a very large arena it does very well in. For me however, a workstation is not one of them.... and I've certainly tried numerous times, but it simply doesn't work for what I typically do.

As many of the 6502 users are implementing PLDs and CPLDs into our projects, the tooling for these specific devices can be quite large and complex. Like it or not, so much of the tooling is released for Windows and in many cases, ONLY Windows. When I opted to get back into the 6502 10+ years ago, I decided I had no interest in making programming tools or adapters and writing code to program EEPROMs, etc. This does tend to put you into a Windows environment for many tools. As I only run OSX as a core OS, I opted to use VMware Fusion and run everything else (Windows, Linux, BSD, etc.) in a virtual machine. All of the data for all of the apps reside on the OSX side and those directories are simply shared to the VM as needed. Granted, it's not the most cost-effective system setup, but it's certainly very stable, easily maintained, backed up and updated.

Also, for any Linux based dev stuff (like Fuzix) I generally use Ubuntu. I've also used the nVidia Jetson Nano for some fun bits... and it's OS release is based on Ubuntu as well. It's usually quite solid. Appliance stuff (firewalls, routers, media servers) I use FreeBSD. So many choices... so little time.

_________________
Regards, KM
https://github.com/floobydust


Top
 Profile  
Reply with quote  
PostPosted: Sat Jun 24, 2023 5:14 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10793
Location: England
There are some nice trends towards open source tools for programmable logic - Xilinx Spartan FPGAs are quite well-supported already, and Dave (hoglet) recently put together a CPLD flow too (for atf15xx, not for xilinx).


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: