C API for the Pynq

Hi all,

We have written a C API for the Pynq which is available at and fairly well documented.

Whilst the Python API is fantastic, we have been working on a number of projects interacting with the Zynq from compiled C code executed via the command line. As such calling out to Python from these C codes isn’t ideal, and-so we put together a C based API to avoid this (and also many other languages interact with C a bit easier than they do with Python.) We have found this helpful in our work, so I thought I would post it on here in-case it is of interest or use to other people working with the Pynq too.


1 Like

Hi Nick,

Great work on this.

It appears that this API does not make use of the HWH file. Is that correct?

The interrupt API seems to require polling. Do you plan on providing an asynchronous API?


Hi Rob, thanks for the reply. Yes you are right, the design decision we took is that the user provides the bitstream which the API will deploy, but they are responsible for knowing aspects such as IRQ numbers, memory addresses etc from the block design which are provided to the calls (in this manner the level of abstraction provided by the API is lower than the approach taken by the Python API). I think there is a more general point here too, that some software to parse the HWH file and display all the information would be quite nice to develop (and indeed Xilinx might have already done this) - not only in this situation, but for other boards also.

Good point on the interrupt polling, I hadn’t though about making it interrupt driven but we could absolutely do that (either at the API level using pthreads and a user provided callback, or I wonder if Linux provides a mechanism we could hook into to do this.)