Adding logic to ZPUino for Pro


rfunderburk

Recommended Posts

Hi -

 

I have a need to add additional logic to the ZPUino-HDL project.  To start I just try to compile the existing system and load it.  This fails miserably.

 

Here are my findings thus far:

 

1) The Makefile in the papilio-pro directory of the boards does not work with the 'standard' installation from Xilinx.  It appears to rely on having mingw, or some other installation available.  If I change the Makefile to use 'mkdir.exe' and 'rm.exe' then I am at least able to issue 'make' and 'make clean' (though 'clean' doesn't actually do anything due to differences in the specification of the file expansion).

 

2) The compilation completes, but the .map file does not match that in the repository (other than expected differences, like times, etc).  There are some differences in the number of slices used and flip-flop counts.

 

3) Even though the compilation completes it will not execute when the .bit file is renamed and moved into the 'bitstreams' directory of the aruino-1.5.  I believe that this is due to a bad .bmm file.  I have tried to recreate a .bmm file, but there are many more BRAM16 (and one BRAM8) placements in the resultant output than are called out for in the .bmm file.

 

So, how can I recompile the ZPUino-HDL to generate the .bit file for use in the arduino environment?  Perhaps there are files that are not checked into the repository, as .gitignore is pretty extensive?

 

Thanks,

Richard

 

Link to comment
Share on other sites

Hi,

 

1) Indeed I have only prepared the automated build for linux hosts. The easiest way for importing into ISE is to import sources manually. The list of source files is inside the ".prj" file.

2) It will depend on the optimization settings you use, and version of ISE. I would not worry much about that if design meets timing.

3) You should use papilio loader application to load the FPGA bitstream. And ZPUino does not use BMM for memory setup - the ROM contents are already in a file named  'prom-generic-dp-32.vhd'.

 

So after you have the .bit file, use the papilio-loader (or papilioprog) to program the FPGA. Then you can use the ZPUino IDE (not 1.5 version, that one does not have support for it yet):

 

http://alvie.com/zpuino/downloads/arduino-0102-windows.zip

 

Alvie

Link to comment
Share on other sites

The test I am running is to just modify papilio_pro_top.vhd and remove the serial port from slot 1 (it is now an empty device) and put it on slot 11.  The expected result is that the 'Serial' device should no longer be operational because it is mapped to slot 1.  My sketch works fine writing to Serial.  That would mean that my FPGA configuration is being replaced, correct?

 

Maybe I am going about this incorrectly?  Should I be placing a .hex file into the ZPUino-HDL source before compiling and then running from there?  That doesn't make code development very easy so that doesn't seem like the best solution.

 

Thanks,

Richard

Link to comment
Share on other sites

Richard,

 

Try these two things:

 

1) Make sure you are writing the synthesized bit file to SPI Flash, ZPUino wants to run from SPI Flash, not just a JTAG load.

2) Be sure that you set the Serial Port in the Arduino IDE to the second serial port "Serial Port B" of the Papilio.

 

The IDE appears to hang when it cannot communicate with the ZPUino and those are the two most common reasons.

 

Jack.

Link to comment
Share on other sites

Hello Jack/Alvie,

 

Still no joy on this side.  I am just compiling the files as checked out from as-is, uploading using papilio-loader to program SPI flash, and then using a simple blink program to try to blink the LED on the board.  It does nothing.  Perhaps I can't flash the LED on the board (though it looks like it is connected to P112 through GPIO(49)).  Is there a default .bit file that I can load into the system to try (now that I have overwritten the image in the flash).

 

I am compiling the HDL source from:

git@github.com:GadgetFactory/ZPUino-HDL.git

 

Using the papilio-loader from:

http://forum.gadgetfactory.net/index.php?/files/getdownload/449-papilio-loader-gui/

 

I have tried the ZPUino environments from:

http://alvie.com/zpu...102-windows.zip

http://forum.gadgetfactory.net/index.php?/files/getdownload/436-papilio-arduino-ide/

http://forum.gadgetfactory.net/index.php?/files/getdownload/434-papilio-arduino-ide/

 

These correspond to ZPUino V 1.02, V1.5a and V0018

 

Thanks,

Richard

Link to comment
Share on other sites

I just read this with more attention, and you did something that you definitely cannot:

 

You removed the serial port programmer.

 

The bootloader relies on a UART port in slot 1. If you remove it, there's no way to perform sketch programming.

 

May I ask you why you removed it ? Perhaps you thought you could, since your design does not requires it. But indeed, the programming does.

 

We cannot use the FPGA programming port easily to perform programming of sketches. The on-board FTDI has 2 virtual ports, we use one as a JTAG port for FPGA itself, then the second one for sketch and general purpose "conversation", as arduino does.

 

Putting the UART back in place should fix things. You can however remove the 2nd instance (in slot 11, if I recall) if you don't need it.

 

Alvie

Link to comment
Share on other sites

Hi Alvie,


Yes, I have put the port back.  I was just going to move it for testing but I am now just trying to use the HDL source, unmodified, and am unable to get it to work.  I am able to load the sketches into the system, they just are not operational.  If there is a default .bit file that can be loaded I can restore the system to make sure that my sketch operates properly (it is just the 'blink' example with the LED pin set to 49).

 

Thanks,
Richard

Link to comment
Share on other sites

Yes, the timing constraints are met.  There is something wrong in my process as I loaded the .bit file for the Pro from the hardware test routines and I am unable to flash the LED with my simple program.

 

Let me do more digging.  Right now I am fighting the 'your serial port is a mouse' problem so I have lost all communication to the system.  Sigh.

Link to comment
Share on other sites

Yes, the timing constraints are met.  There is something wrong in my process as I loaded the .bit file for the Pro from the hardware test routines and I am unable to flash the LED with my simple program.

 

Let me do more digging.  Right now I am fighting the 'your serial port is a mouse' problem so I have lost all communication to the system.  Sigh.

Have worked through the 'serial port is a mouse' problem (I installed the FTDI drivers, the Papilio drivers insisted on making the port a mouse).

 

I have now compiled the source from the GadgetFactory git repository with one change; I forced the LED on in the VHDL.  When I load the binary into the SPI flash it comes up with the LED lit.  When I load a sketch from the Arduino environment the LED extinguishes - even though the sketch is running.

 

As far as the 3 different Arduino environments:

 

V102 - I can't use because on one of my systems (WinXP in a VM) it complains that 'registers.h' doesn't exist.  On my other system (Win 7 pro) it errors out with a bunch of bytes not matching on the verification phase after uploading.

 

V1.5a from GadgetFactory site: No changes to the source are ever uploaded.  If I quit the environment and start it up again and then load the file it will build. I notice that out.mem is never changing in the build directory.

 

V0018g - this one seems to compile and load; but the bit file appears to be overwritten.

 

I notice in the Makefile that the generate out.mem file is merged with a .bit file dependent on the board type to build a resultant out.bit file for upload.  The lines that don't combine with the .bit file for the build type are commented out in all of the builds.  I tried modifying the Makefile and locking it but it still gets overwritten.

 

Clearly, I am doing something incorrect.  Any directional information that could be provided would be appreciated.  Or point me to something to read?

 

As an aside; I have been doing FPGA development with Xilinx since they were part of AMD back in the early 90s so I am very familiar with the process, just haven't done anything with embedded processor cores in the FPGA.

Link to comment
Share on other sites

Hello,

 

I just read carefully back through this thread and noticed something big that is probably the reason for the trip up.

 

We should start with some background information. There are two tracks of the modified Arduino IDE, the one I put together for the AVR8 Soft Processor and the one that Alvie put together for the ZPUino Soft Processor. We both made them independently for different Soft Processors so they are not compatible with each other. They have different methods of loading code to the Soft Processor, in the ZPUino's case you have to load the ZPUino to SPI flash and then the programmer loads code over the serial port. In the AVR8's case the code is converted to a mem file, merged into a bit file, and then the bit file is loaded to the FPGA.

 

It looks like you are mixing the different IDE's which is leading to a bunch of frustration on your part. It's a situation that was built up over time and in hindsight there is nothing out there that would make this obvious to anyone wanting to get up and running.

 

I think Alvie and I need to get together and come up with names for our releases that make this clearer. I've been calling the AVR8 releases Papilio-Arduino and Alvie goes with arduino-xxx-Z. We should maybe do something like arduino-xxx-zpuino and arduino-xxx-avr8. Or even better, with the 1.5 release maybe we can merge both soft processor toolchains into a single release...

 

I'm very sorry for the confusion, I would recommend starting out with this guide:

http://www.papilio.cc/index.php?n=Papilio.ZPUinoIntroduction

 

Get setup with the correct IDE and seeing how the ZPUino operates normally. Then it might be easier to make a custom zpuino soft processor. We really need to put together a quick guide on how to do that, probably the closest thing we have right now is the videos I made for the Papilio SOC:

http://forum.gadgetfactory.net/index.php?/topic/1550-building-complete-papilio-soc-for-logicstart-megawing/

 

I have to deal with a lot of circuit board preparation tomorrow but I will try to be in the chat room as much as possible to help out.

 

Jack.

Link to comment
Share on other sites

Thanks, Jack, for a great writeup.  I believe that you have nailed what my problem is.  I will get the appropriate files and try my testing.

Hello Alvie,

 

Any idea of why Arduino-Z (both rev 1.00 from the website and 1.02 that you provided a link) won't compile any sketches?  It fails with:

 

zpuino-accel.S:1:22: register.h: No such file or directory

 

I have validated that the file is present and I have tried deleting the preferences.txt file (even the whole Arduino preferences directory) from the application data location.  I have also removed my sketchbook to force it to create a new one.  It is acting as though the include paths are incorrect for the compiler, but I don't see where to set that information.  It fails even compiling a blank sketch.  It could be a windows path thing?

 

Thanks,

Richard

Link to comment
Share on other sites

Jack - no improvement with the board/port selection.

 

Alvie -- here is the output:

 

 
\\psf\Home\Documents\Downloads\arduino-0102\hardware\tools\zpu\bin\make --silent -C C:\DOCUME~1\RFUNDE~1\LOCALS~1\Temp\build4873954155892152179.tmp all 
zpuino-accel.S:1:22: register.h: No such file or directory
make[1]: *** [zpuino-accel.o] Error 1
make: *** [core\libcore.a] Error 2
\\psf\Home\Documents\Downloads\arduino-0102\hardware\tools\zpu\bin\make returned 2
 
Link to comment
Share on other sites

Hi Alvie - I moved everything so that my VM wasn't using forced reference paths (like the \\psf path above).  The code now compiles, but I get this error:

 

 

C:\Utils\arduino-0102\hardware\tools\zpu\bin\make --silent -C C:\DOCUME~1\RFUNDE~1\LOCALS~1\Temp\build4354571368501934118.tmp all 
Binary sketch size: 988 bytes (of a 8,388,608 byte maximum) - 968 bytes ROM, 28 bytes memory
Board: Unknown board @ 96000000 Hz (0xa4040f00)
Cannot program flash on non-sector boundaries!
 
I assume that this is because I don't have a Papilio Pro bit image to load (I can only find Papilio Plus with LX9).  Is there a pre-built bit image that I can load?  I would like to start with a known entity before attempting to load compiled bit files.
Link to comment
Share on other sites

Ohhhh! Now I think I remember where I saw this error, there can not be any spaces in your path.

 

BTW Richard, I saw that you came in the chat room. I was away getting lunch, but I saw that you dropped in. I don't think there was a firewall problem, I was just not at the computer.

 

Jack.

Link to comment
Share on other sites

Ok, I have a solution for the Papilio Pro:

 

Use the RetroCade environment.  

 

It is the only configuration that I was able to get the HDL and the Arduino development environment to operate.  This requires downloading the RetroCade Synth Windows installer from the RetroCade Synth download section.  You then download the ZPUino-HDL source from the GadgetFactory github repository.  Change to the "zpu/hdl/zpuino/boards/papilio-pro/S6LX9/variants/retrocade" directory and build the HDL - this is easiest by installing cygwin and setting up the Xilinx environment variables and issuing 'make'.  The resultant .bit file can then be uploaded to the Papilio Pro using Papilio Programmer and, using the Arduino environment from the RetroCade Synth, you can upload sketches and it all works as expected.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.