Monday, April 2, 2018

MEGA65 Computer Build with Vivado

Setup of HARDWARE bench

This is the easy part

Setup of the Build Environment

I assume this being simple as well, as there was Vivado tcl script to recreate the Vivado project.

Try #1

I am trying to start the tcl script from Vivado console. And yes I had forgotten that the src/vhdl directory does not contain all source code files at all. Yes, yes many of the files needed are generated files and not original VHDL files.

Try #2

Oh, the main toplevel Makefile - it really does not look like fun trying to build it on Windows/cygwin so I start linux in VM.
Ok, the main reason I assumed that the original Makefile is hard target for Windows was the presence of tool called Ophis.
But well Ophis is a cross assembler that is written in Python and has built in support for Windows. So probably Ophis would have run on my Windows box without problems as I do have Python 3.6 installed and available from console prompt. The lack of proper make is another problem, the only make that is on Windows path is the one from Delphi :) that one is no good for building gnu Makefiles. I did set up a batch file to set path to C:\Xilinx\SDK\2017\gnuwin\bin to execute some reasonable make but after removing the "prg" targets, well the Makefile choked on missing rule for ".git" target. After some more trials I did proceed on linux VM.
Now the PRG targets are build, but what, CA65 is missing? Why and where should I pull-in this? OK lets see what else can we build.

make tools

After installing libpng-devel tools target is building without errors.

Try #3

Pulling in CC65 source code, running make. Build succeeds now lets copy the ca65 and ld65 where the mega makefile can find them! After adding ./ into the Makefile ca65/ld65 are found and executed. Now we are stuck on cbmconvert :(

Try 4

OK cbmconvert build also completed, this time I install it too so I do not need to add ./ into the Makefile. Now we are stuck on .git target missing. Well this I had on initial trial on Windows too.

Try 5

Searching for problem why .git is not found. Ah so stupid, I did copy the files into the Linux VM and did not fetch them directly from git, so the ".git" directory was missing. A dirty trick

git init

and we are in game again. Well now we are stuck on the next missing part - convert is missing.

Try 6

sudo yum ImageMagick

and we are stuck again on? Seems something is wrong in /core/src/mega65-fdisk folder. Well but at least some VHDL files needed from Vivado have been already created, lets see if something is still mssing. I am copying the VHDL files back from Linux VM to the main workstation hard disk. There are 5 new VHDL files generated, but the colourram.vhdl is still missing. I could try excluding it, but let see if we can force the Linux build one step further.
Ok, the issue with fdisk is very simple, I did not download the git submodules so I do that manually now and copy the files again into the linux box.
Unfortunately I am stuck again, this time the error comes from c code, complaining that -std=c99 option should be used. This is well known issue with lots of linux projects. For some reason adding the switch into the Makefile does not help so I fix the source code that is faster and easier. And now we are ready for Vivado!

Yeah!

Try 7




Now the fun can begin.
A mega65 fun!

Links

Pointers to resources

Ophis 

Cross compiler in Python under MIT license. Web pages from the original author are no longer online, his github account seems still be active with some commits in early 2017 but Ophis should be fetched from forked repo.

CA65/LD65

Those utilities are needed to build MEGA65 Vivado files, they can be fetched from github and there is also Windows snapshot available here.

cbmconvert

From github here. Assumed somewhere is windows build available also.