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

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Sat Jul 15, 2023 2:53 pm 
Offline
User avatar

Joined: Sat Jul 24, 2021 1:37 pm
Posts: 282
Hi everyone,

I've been experimenting with Atmel's programmable logic ICs and felt frustrated by the lack of a nice development workflow for them. Many people here have suggested using WinCupl's command-line tools, but a good example of how to do that was not easy to find.

So, I've created cupl.bat, which automatically compiles and fits a design (if necessary, depending on the "Device" tag in the pld file). The source code is available on my GitHub here https://github.com/adrienkohlbecker/cupl.bat and I'm also attaching it below.

My workflow, for now, is to connect to a Windows VM and edit my PLD with Notepad++. I have mapped this batch file to F6 in the editor, and it seems to work well enough for compilation and fitting. I'm more of a MacOS/Linux guy, so this is my first time writing a batch file and there may be obvious changes to make.

All feedback is welcome!


Attachments:
cupl.bat-revB.zip [3.47 KiB]
Downloaded 59 times

_________________
BB816 Computer YouTube series
Top
 Profile  
Reply with quote  
PostPosted: Mon Jul 17, 2023 8:16 pm 
Offline
User avatar

Joined: Sun Sep 08, 2013 10:24 am
Posts: 740
Location: A missile silo somewhere under southern England
Hi Akohbecker

Thanks for this. I'll give it a test 'n tune when I start working on my next ATF1504 or 8 design.


Top
 Profile  
Reply with quote  
PostPosted: Mon Jul 17, 2023 10:05 pm 
Offline

Joined: Fri Jul 09, 2021 10:12 pm
Posts: 741
Hi Adrien, it looks useful for Windows use, and you've used some pretty advanced features if it's your first batch file!

Did you try my Wine-based scripts at all? As I find they do everything I need in Linux, to the point that I don't need to run a VM or anything like that.

I also found that I had to work a bit harder on the output to get it to give nice results for various different error conditions, as the way different errors are reported by WinCupl was a bit haphazard. (There's also more to do there for sure, my script sometimes hides errors that would be interesting for the user to see.)


Top
 Profile  
Reply with quote  
PostPosted: Tue Jul 18, 2023 7:43 am 
Offline
User avatar

Joined: Sat Jul 24, 2021 1:37 pm
Posts: 282
banedon wrote:
Hi Akohbecker

Thanks for this. I'll give it a test 'n tune when I start working on my next ATF1504 or 8 design.


Let me know how that goes!

gfoot wrote:
Hi Adrien, it looks useful for Windows use, and you've used some pretty advanced features if it's your first batch file!


Thanks, let's call it Stack Overflow-driven programming :mrgreen:

gfoot wrote:
Did you try my Wine-based scripts at all? As I find they do everything I need in Linux, to the point that I don't need to run a VM or anything like that.

I also found that I had to work a bit harder on the output to get it to give nice results for various different error conditions, as the way different errors are reported by WinCupl was a bit haphazard. (There's also more to do there for sure, my script sometimes hides errors that would be interesting for the user to see.)


I did, however I had trouble getting cupl to run properly. I was trying to run it on a Linux VM, but my main machine is an ARM Mac, and between Intel emulation and the hypervisor, it crashed with an illegal instruction error. I did not try on a native Linux box, as by then the effort was similar to connecting to my native Windows machine. I also figured it will be easier to run ATMISP natively, as I'm working with ATF150x parts and I haven't found any reference to running it headless.

I'm going to try and automate ATMISP using AutoHotKey next, so it can generate the svf file on Windows and I can program the device using my Mac.

_________________
BB816 Computer YouTube series


Top
 Profile  
Reply with quote  
PostPosted: Thu Jul 27, 2023 2:14 pm 
Offline
User avatar

Joined: Sat Jul 24, 2021 1:37 pm
Posts: 282
Making progress on getting CUPL programming to a bearable state.

I was able to move my CUPL editing and device programming to my main Mac M2 machine. I'm using UTM (QEMU under the hood), to virtualize Windows 11 ARM edition. (Guide to follow here: https://docs.getutm.app/guides/windows/). Inside Windows 11 ARM, both WinCUPL and ATMISP work flawlessly so far through Microsoft's translation layer. Finally, using UTM's USB sharing feature, I'm able to plug my Atmel programmer directly into the VM, and to program a CPLD successfully.

I did have some trouble initially with FTDI drivers, but putting the FTD2XX.DLL file found in this archive (https://ftdichip.com/wp-content/uploads ... utable.zip) inside the ATMISP directory made it work. I did have to use the one from the "x86" folder.

I also switched my editor to Visual Studio Code, with the build actions below. To use ATMISP like this you need to run it once manually to configure your device, and use it to save a .chn file with the same name of your .pld next to it. The following extension has syntax highlighting for CUPL: https://marketplace.visualstudio.com/it ... ighlighter

Next goals are : automate ATMISP to generate the svf file, and move to VSCode Server so I can edit and program natively on Mac without using the VM's GUI.

Code:
{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "cupl",
            "type": "shell",
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "command": "C:\\Wincupl\\Projects\\cupl.bat ${fileDirname}\\${fileBasenameNoExtension}.pld"
        },
        {
            "label": "atmisp",
            "type": "shell",
            "group": "build",
            "command": "C:\\ATMISP7\\ATMISP.exe ${fileDirname}\\${fileBasenameNoExtension}.chn"
        }
    ]
}

_________________
BB816 Computer YouTube series


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 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: