Jack Gassett

ZPUino Info

Recommended Posts

The ZPUino is a great idea of Alvaro "Alvie" to implement a small version of the 32 bit Open Source ZPU processor and optimize it for use with the Arduino IDE. The end result will be a very fast, small, and 32 bit processor that can run Arduino sketches!

Alvie has a blog with more details.

We, at Gadget Factory, like this idea so much that we want to support the effort any way we can. This forum is one way to support further development, we hope to get this project running on the Papilio One board.

Quoted below is a post that Alvie posted to the ZPU mailing list with more information:

"Hi all,

It's late night now here, but I think I cannot hold for much longer one of my latest ongoing projects, also given I promised to speak about it on my last email

(patch for weakening ___zpu_interrupt_vector).

So, first of all, let me introduce you to ZPUino.

You're all smart enough to hear a bell ringing. Yes - it's like an "arduino", but it's based on "ZPU".

Why ?

Several reasons exist. First, "because I can", second, because AVR8 implementations are huge and perform badly (clock frequency). Third, because these guys at

GadgetFactory ( http://www.gadgetfactory.net/ ) have a nice FPGA board meant to replace arduino, and one board (5V tolerant) meant to be used as a "shield" to

existing arduino boards. They are cheap. [Jack from GadgetFactory on CC]

Why again ?

AVR devices are nice, but they are slow. And "because I can".

What makes arduino (a slow 8-bit micro, not that cheap) so successful among hobbyists ? IMHO two reasons:

a) It's easily programmed (just a serial cable or USB/serial)

B) It's well documented, and gory details are hidden from "typical" users.

c) Has a nice IDE (which I don't use personally)

d) It's geekie !

So I decided to pick ZPU small core, add a bunch of devices, and mimic arduino's behaviour.

And then ZPUino was born.

What are beneficts/drawbacks of ZPUino ?


* Blazing fast clock speed (100MHz on a S3E grade 4) [opencores AVR8 does not get past 33MHz - at least on my attempts]

* 32-bit, small code footprint

* DAC (based on sigma-delta) [not yet on design]


* No internal ADC

What does ZPUino requires?

* An external SPI flash to store program memory (can be shared with FPGA, if SPI flash used).

Implementation State:


Very much ALPHA!

Only a bunch of stuff is tested, interrupt management might need some tweaking, although it looks like perfect ATM.

Below is my intro to ZPUino:


Welcome to ZPUino!

1) What is ZPUino ?

ZPUino is a SoC (System-on-a-Chip) based on Zylin's ZPU 32-bit processor core.

2) What is inside ZPUino ?

Harware-wise, ZPUino currently integrates the following devices:

* ZPU small core (slightly modified)

* One UART

* One SPI interface

* Two 16-bit timers

* One TSC (Time Stamp Counter)

* 32-bit GPIO interface

* Interrupt Controller

UART Specifications:

* 16-bit prescaler.

* 16-byte deep receive FIFO

SPI Specifications:

* Programmable prescaler.

* Configurable CPOL.

* 8-bit transmission mode, 4 byte receive register.

Timers Specifications:

* 10-bit prescaler

* 16-bit wide counter

* Count-up and Count-down mode

* 16-bit Compare register

* Clear on Compare match support

* Interrupt support on Compare Match

Interrupt controller Specifications:

* Up to 16 interrupt lines

* Ensures safety (does not allow interrupt recursion)

* 16-bit interrupt mask (TODO)

* Interrupt Enable bit

GPIO Specifications:

* 32-bit wide (one reserved for SPI)

* Bi-directional (tristate) configuration.

Software-wise, it supports the following features:

* 4Kb Bootloader, which includes required emulation code for ZPU.

* Bootstraps code from program flash (shadows into FPGA blockram)

* Serial programming of program flash.

* Serial reset (TODO)

3) Where does it run ?

First implementation was done on Spartan3E 500 (-4), on a S3E Starter Kit, with a M25P16 SPI flash ROM and 32Kbytes RAM.

Implemented sizes (approximate): 841 Slices ( 563 FF, 1094 LUT )

Running speed: 100MHz (50Mhz external clock + DCM)


Latest (DEVELOPMENT CODE): http://repo.or.cz/w/zpu/zpuino.git

What's left to do ?

Well, a basic programmer is included. Idea is to use Arduino's IDE to program ZPUino, and changes should be quite trivial.

but, read:


Many things have to be decided. Many things have to be changed, and implemented.

I'm expecting you all, if you feel this project makes you feel cool, to help me and others finish/improve its design.

So, I'm expecting your feedback, suggestions, rants and raves.

All the best,


Share this post

Link to post
Share on other sites
Guest amar

I just unpacked my brand new Papilio (S250E), got stoked to try it out, figured that the ZPUino IDE would work easily on linux ... and have been getting nowhere for the last couple of hours. I got the latest (alpha 4) ZPUino binaries, ran them and cannot seem to escape the "Cannot get programmer version, aborting" error when I try to upload sketches to the Papilio board. So here's a request, from a brain-fried noob: can someone tell me exactly what I should  do to solve this? It seems like others have had this problem, but I haven't been able to figure it out.

Cannot get uploader to work, aborting. For now anyway. Help?

Share this post

Link to post
Share on other sites

Hello Amar,

I've been working on a Linux Virtual machine that will provide a hassle free base to get started with. Will hopefully start working on it again when I return from California tomorrow.


Share this post

Link to post
Share on other sites
Guest amar

Alvaro & Jack,

Thanks for your replies. After some stumbling around, I got things to work -- at least to the point where I can upload a sketch to the board without any error messages through the IDE. I still need to make sure if this is enough to start playing with it.

If it might be useful in any way to other users who have the same problem, or for y'all in your development of an installer/quick start guide, here's a post listing the things I had to do on my machine running Ubuntu 11.04.


Any comments/suggestions you might have would be very welcome.



Share this post

Link to post
Share on other sites

Hello Amar,

I just saw your blog post about the "Unknown Flash Manufacturer". Today is going to be all about working on the Linux support. So if you get a chance you might want to stop by the IRC channel.


Share this post

Link to post
Share on other sites

Hello, I've gotten the virtual machine to run, and find it very difficut to find the fpga tools. Jacks video says ~' it automatically loads FireFox then starts Zpuino' ( paraphrase). Well it did start Firefox and stopped because the web page needs flash ( at least there was something wrong..., Zpuino didnt appear at all, so i went after the obvious intitial errs). After getting Flash up, the web page was ok, so i rebooted the VM and still no Zpuino. I can search thru and locate the bugger, but do people really open a terminal and exec the command that way? is there really no desktop or menu item? It looks like a great tool, but who can tell? Im running Ubuntu 10.04 and the VM runs fine ( used YAST t get sound to run, that was informative on the diffs between Yast & Apt!) ( also was not obvious where the startup scripts were ) Betcha something simple , eh? thx tom3p

Share this post

Link to post
Share on other sites

Hello tom3p,

That virtual machine is getting quite dated now, there never was enough interest/downloads to justify keeping it up to date... It's probably better to download the latest tools directly into the OS of your choice. At the time I made the VM the ZPUino tools were only working under Linux and it was meant to help Windows users get up and running but the ZPUino tools run natively under Windows now. Do you prefer Windows or Linux? And are you just looking to write sketches to run on the ZPUino or do you want to do more complex things with the ZPUino like modify the VHDL or use the gcc compiler directly without the Arduino IDE?

I'm going to assume you just want to start writing sketches using the ZPUino/Arduino IDE on Windows. If that is the case then just download the ZPUino/Arduino IDE for Windows from the download page. This ZPUino getting started page will help you get oriented with a quick startup sketch. Let us know how it goes, we can help get you past any issues getting started.



Share this post

Link to post
Share on other sites

Jack, is http://www.alvie.com/zpuino/download.html the best spot for windows users?  


Seems like forum.gadgetfactory.net/index.php?/topic/1899-papilio-schematic-library-v16-and-zap-ide-220/ is the latest and greatest.  That is, unless you are compiling from source?



Jack: perhaps I should add the ZAP binaries to my website also.


What you think?




That is indeed the latest and greatest location to download ZPUino for use on a Papilio board. If you want the latest and greatest ZPUino improvements that Alvaro is making, ZPUino 2.0 for example, then I am a bit behind and your best bet is to pull from Alvaro's github repository.


Alvie and I work closely to pull all of his improvements into the releases available on the Gadget Factory download page but we are a little behind right now. The focus has been on converting the latest 1.0 release to a schematic library. Alvie has a lot of great things in ZPUino 2.0 like support for the upcoming HDMI Wing so we are going to have to act soon to get it available!



Absolutely, lets get them available in both places. I made a linux release too yesterday... MacOS is next.



Share this post

Link to post
Share on other sites

Hi..I am planning to use the ZAPuino for my spartan 500 fpga board,and I wanted to build my custom peripheral that performs some custom function(for example say inputs obstacen distance from an ultrasonic sensor and outputs the distance on screen in vhdl), could someone please guide me on the steps i need to take to accomplish this?..thanks!

Share this post

Link to post
Share on other sites

Hello akshay, 


The best resource for this right now is to download the latest version of the ZAP IDE and look for the wishbone example template. (I'm uploading a new version of ZAP IDE as we speak so you might want to wait a little while. The version I'm uploading is 2.3.0)



Share this post

Link to post
Share on other sites



is there some way to get binaries from a C compiler into a ZPUino?

I have the gcc toolchain installed and can merge the code via "data2mem" into RAM of a small ZPU, but haven't seen anything similar with the ZPUino.

Share this post

Link to post
Share on other sites

You can convert them into a binary file, but probably won't work, because the entry points are not the same.


is that a full bootstrap image ? If so, you might convert it to VHDL using the perl script on the repo, and replace the prom .vhd file.


But your luck may vary.

Share this post

Link to post
Share on other sites

Thanks. Maybe I'll try this over holiday.

Do I need to change anything in the default zpu toolchain to get the entry points right (i.e. crt0.S)?

What I might do is put in my own "ROM", constructed from striped RAMB16s so that "data2mem" can configure it. Alternatively, inferred memory and initial values would achieve the same.


I tried earlier with the "avalanche" version but it wasn't that easy. My RAM itself works (it's tested with the small zpu) but no luck with the avalanche. I was wondering also here, if the toolchain needs some changes for the specific zpu version. But the linker scripts are rather cryptic, no idea what's going on inside.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now