black-parrot-example in Pynqz2

45 views
Skip to first unread message

Amit Hiremath

unread,
Feb 26, 2025, 9:47:55 AM2/26/25
to black-parrot
Hello All,

I bought pynqz2 board, when I  execute make load_bitstream in black-parrot-example/zynq, I am getting following errors:

make load_bitstream
echo 'from pynq import PL; PL.reset();' | sudo -E PYTHONPATH=/home/xilinx/BP/zynq-parrot/cosim/py python3
echo 'import pprint; from pynq import Overlay; overlay=Overlay("blackparrot_bd_1.bit"); print (overlay.__doc__); pprint.pprint(overlay.ip_dict,width=1); pprint.pprint(overlay.clock_dict,width=1);' | sudo -E PYTHONPATH=/home/xilinx/BP/zynq-parrot/cosim/py python3
Traceback (most recent call last):
  File "/usr/local/share/pynq-venv/lib/python3.10/site-packages/pynq/pl_server/embedded_device.py", line 252, in get_parser
    parser = self._get_cache()
  File "/usr/local/share/pynq-venv/lib/python3.10/site-packages/pynq/pl_server/embedded_device.py", line 228, in _get_cache
    raise CacheMetadataError(f"No cached metadata present")
pynq.pl_server.embedded_device.CacheMetadataError: No cached metadata present

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/share/pynq-venv/lib/python3.10/site-packages/pynq/overlay.py", line 319, in __init__
    self.device.set_bitfile_name(self.bitfile_name)
  File "/usr/local/share/pynq-venv/lib/python3.10/site-packages/pynq/pl_server/device.py", line 118, in set_bitfile_name
    self.parser = self.get_bitfile_metadata(self.bitfile_name)
  File "/usr/local/share/pynq-venv/lib/python3.10/site-packages/pynq/pl_server/embedded_device.py", line 690, in get_bitfile_metadata
    parser = _get_bitstream_handler(bitfile_name).get_parser(partial=partial)
  File "/usr/local/share/pynq-venv/lib/python3.10/site-packages/pynq/pl_server/embedded_device.py", line 254, in get_parser
    parser = RuntimeMetadataParser(Metadata(input=self._filepath.with_suffix(".hwh")))
  File "/usr/local/share/pynq-venv/lib/python3.10/site-packages/pynqmetadata/frontends/metadata.py", line 40, in Metadata
    return HwhFrontend(_hwhfile=input)
  File "<string>", line 25, in __init__
  File "/usr/local/share/pynq-venv/lib/python3.10/site-packages/pynqmetadata/frontends/hwh_frontend.py", line 219, in __post_init__
    self.parse()
  File "/usr/local/share/pynq-venv/lib/python3.10/site-packages/pynqmetadata/frontends/hwh_frontend.py", line 240, in parse
    self.resolve_addressing()
  File "/usr/local/share/pynq-venv/lib/python3.10/site-packages/pynqmetadata/frontends/hwh_frontend.py", line 596, in resolve_addressing
    self._resolve_subordinate_addressing()
  File "/usr/local/share/pynq-venv/lib/python3.10/site-packages/pynqmetadata/frontends/hwh_frontend.py", line 452, in _resolve_subordinate_addressing
    core = self.blocks[i.get("INSTANCE")]
KeyError: 'GP0_AXI'

I did execute "python3 -m pip uninstall pynqmetadata python3 -m pip cache purge python3 -m pip install pynqmetadata" but couldn't resolve the errors

Can anyone please assist?

Thanks,
-Amit

Dan Petrisko

unread,
Feb 27, 2025, 5:27:40 PM2/27/25
to Amit Hiremath, black-parrot
Hi,

There are small breaking changes between pynq3 (what ships in the default sd card) and pynq2 (which is what we use). Our pynq-images can be found here: https://github.com/black-parrot-hdk/pynq-image. You can downgrade to the supported version or perhaps debug the issue and make a PR for pynq3 support

 More info in this issue:

Best,
-Dan

--
You received this message because you are subscribed to the Google Groups "black-parrot" group.
To unsubscribe from this group and stop receiving emails from it, send an email to black-parrot...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/black-parrot/eb1b26a9-63c6-4fad-b6bf-bd72d280c70fn%40googlegroups.com.
Message has been deleted

Amit Hiremath

unread,
Feb 28, 2025, 2:30:02 PM2/28/25
to black-parrot
Hi,

I copied pynq folder from https://github.com/black-parrot-hdk/PYNQ/tree/e97529eb371c813668bc216f3c2a6a5c2df5aae8/pynq and even I did sudo pip3 install --upgrade --upgrade-strategy only-if-needed pynq   and rebooted the board, I am unable to  load bitstream file.

-Amit

Daniel Petrisko

unread,
Feb 28, 2025, 2:53:48 PM2/28/25
to black-parrot
If you have the same error, then the downgrade is not happening. I believe copying the files at best changes the python runtime but not the OS image. I'm also not sure if it affects the pynq installation itself or just the headers. The real answer is to flash a new image to the SD through the instructions on the pynq website: https://www.pynq.io/boards.html

> sudo pip3 install --upgrade --upgrade-strategy only-if-needed pynq
Additionally, this will _upgrade_, not _downgrade_ as needed

-Dan

Amit Hiremath

unread,
Mar 1, 2025, 3:09:44 AM3/1/25
to black-parrot
Can you please provide pre compiled Pynq Z2 Image which is working for you?  In the git hub repo: https://github.com/black-parrot-hdk/PYNQ/tree/e97529eb371c813668bc216f3c2a6a5c2df5aae8/sdbuild there is procedure to build Pynq Z2 Image, but it requires of settings, I am getting lot of build errors, it will be great if you could just provide the pynq z2 image, I will then write to SD card.

Thanks,
-Amit

Dan Petrisko

unread,
Mar 2, 2025, 12:37:35 AM3/2/25
to Amit Hiremath, black-parrot
Yeah, the dependencies are kind of a pain. They recommend building in a VM but that has its own annoyances. I believe the 2.6 image here should work; the only thing we add is a watchdog timer so that the board resets when hung (very useful, but not critical): https://www.tulembedded.com/FPGA/ProductsPYNQ-Z2.html

Best,
-Dan

You received this message because you are subscribed to a topic in the Google Groups "black-parrot" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/black-parrot/5Mm0RxhsMw0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to black-parrot...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/black-parrot/99c82b43-f841-4900-b909-bf72792f5811n%40googlegroups.com.

Amit Hiremath

unread,
Mar 4, 2025, 7:59:52 AM3/4/25
to Dan Petrisko, black-parrot
After writing v2.6 PynqZ2 image, I am getting following output:
sudo] password for xilinx:
// bsg_zynq_pl: be sure to run as root
// bsg_zynq_pl: mmap returned 40000000 (offset 0) errno=0
// bsg_zynq_pl: mmap returned 80000000 (offset 0) errno=0
INFO:    ps.cpp: reading four base registers
INFO:    ps.cpp: reset(lo)=-1207959552, bitbang=0, dram_init=0, dram_base=0
INFO:    ps.cpp: attempting to write and read register 0x8
INFO:    ps.cpp: successfully wrote and read registers in bsg_zynq_shell (verified ARM GP0 connection)
INFO:    Creating Bitbang Driver: 0x4faab8 40000004 16 1
INFO:    Reset Tag Master
INFO:    Resetting Tag Client 0
INFO:    Resetting Tag Client 1
INFO:    Setting Tag Client 0<-1
INFO:    Setting Tag Client 1<-1
INFO:    Setting Tag Client 0<-0
INFO:    Idling for 50
INFO:    ps.cpp: CSRs do not contain a DRAM base pointer; calling allocate dram with size 67108864
bsg_zynq_pl: allocate_dram() called with size 67108864 bytes --> virtual ptr=0xb2a6a000, physical ptr=0x16900000
INFO:    ps.cpp: received 0xb2a6a000 (phys = 16900000)
INFO:    ps.cpp: wrote and verified base register
INFO:    ps.cpp: attempting to read mtime reg in BP CFG space, should increase monotonically  (testing ARM GP1 connections)
make: warning:  Clock skew detected.  Your build may be incomplete.

I am not sure whether it is the correct output because in VCS, it is giving output: Hello Word! 

-Amit

Amit Hiremath

unread,
Mar 5, 2025, 10:29:02 AM3/5/25
to black-parrot
I tried old version of black-parrot-example (https://github.com/Yuan-Mao/zynq-parrot), it is stuck at Errant read from (110000) following is the output after running in Pynq Z2 board:

// VS_HK_zynq_pl: mmap returned 40000000 (offset 0) errno=0
// VS_HK_zynq_pl: mmap returned 80000000 (offset 0) errno=0

INFO:    ps.cpp: reading four base registers
INFO:    ps.cpp: reset(lo)=0, bitbang=0, dram_init=0, dram_base=0

INFO:    ps.cpp: attempting to write and read register 0x8
INFO:    ps.cpp: successfully wrote and read registers in VividSparks_FRST_zynq_shell (verified ARM GP0 connection)
INFO:    Creating Bitbang Driver: 0x4ceab8 40000004 16 1

INFO:    Reset Tag Master
INFO:    Resetting Tag Client 0
INFO:    Resetting Tag Client 1
INFO:    Setting Tag Client 0<-1
INFO:    Setting Tag Client 1<-1
INFO:    Setting Tag Client 0<-0
INFO:    Idling for 50
INFO:    ps.cpp: CSRs do not contain a DRAM base pointer; calling allocate dram with size 83886080
VS_HK_zynq_pl: allocate_dram() called with size 83886080 bytes --> virtual ptr=0xb1aae000, physical ptr=0x16900000
INFO:    ps.cpp: received 0xb1aae000 (phys = 16900000)

INFO:    ps.cpp: wrote and verified base register
INFO:    ps.cpp: attempting to read mtime reg in BP CFG space, should increase monotonically  (testing ARM GP1 connections)
INFO:    ps.cpp: attempting to read and write mtime reg in BP CFG space (testing ARM GP1 connections)
INFO:    ps.cpp: reading mtimecmp
INFO:    ps.cpp: writing mtimecmp
INFO:    ps.cpp: reading mtimecmp
INFO:    ps.cpp: attempting to write L2 655360 times over 80 MB (testing ARM GP1 and HP0 connections)
INFO:    ps.cpp: finished write L2 655360 times over 80 MB
INFO:    ps.cpp: DIRECT access from ARM to DDR (some L1/L2 coherence mismatches expected) 655232 matches, 128 mismatches, 0.999805
INFO:    ps.cpp: attempting to read L2 655360 times over 80 MB (testing ARM GP1 and HP0 connections)
INFO:    ps.cpp: READ access through BP (some L1 coherence mismatch expected): 1310592 matches, 128 mismatches, 0.999902
INFO:    ps.cpp: beginning nbf load
DEBUG-PS: ps.cpp: nbf finish command, line 4016
DEBUG-PS: ps.cpp: finished loading 4016 lines of nbf.
DEBUG-PS: ps.cpp: finished nbf load
INFO:    Setting Tag Client 1<-0
INFO:    ps.cpp: starting watchdog
INFO:    Idling for 50
INFO:    ps.cpp: Starting scan thread
INFO:    ps.cpp: Starting i/o polling thread
INFO:    ps.cpp: waiting for i/o packet
ERROR:   ps.cpp: Errant read from (110000)

I am unable to figure-out where it's going wrong, any guidance of great help.

Thanks,
-Amit
Reply all
Reply to author
Forward
0 new messages