How to Load PL bitstream at startup? Pynq 2.7

Hi, is there a way to enable pynq 2.7 to load PL bitstream at startup?
I know in previous versions there was a way to comment out the FPGA manager configuration but at 2.7 version the build fails.
If we configure the board with FPGA_MANAGER parameter =0 in config file, the petalinux kernel does not load.
I know the pitfalls of having ethernet controlled trough EMIO ports, and loading overlays. Eventually when deployed I would have final overlay loaded at startup, but i cannot find a way to have PL configured.

It is also very important to have fpga configured with defined state of pins during and after boot. If the FPGA is controlling an inverter or any serious equipment, you can see why this is critical requirement.

I cannot be the only one with this problem.

1 Like

Hi @bierkof,

Could you use boot.py?

https://pynq.readthedocs.io/en/latest/pynq_sd_card.html?#leveraging-boot-py-to-modify-sd-card-boot-behavior

Mario

1 Like

Hello Mario

Thank you for answering. Yes I would expect that to work but for some reason it does not.
I copied the base.bit file to jupyter notebooks. I thought just loading the overlay in boot.py would configure the FPGA.

However it looks like boot.py is never executed. Even if I only put single print function inside, it is never called.
I have attached the booting log, perhaps you would see something I am missing.
I appreciate any suggestions.
booting.log (27.0 KB)

Some update. I was probably wrong in my previous post.
I have 2 boards, one is Arty Z7-10 with smaller Zynq7010 and one is this cheap ebaz4502 with the same 7010.
I made images for both. Arty does not have ethernet routed trough PL so it works from the start, and this small ebaz board does so ethernet does not work, or any other setting really.

As @marioruiz suggested I tried to load the PL bitstream in the boot.py file and that did not work.
So I tried to load overlay trough jupyther notebook using the same code, and it also did not work.
But the reason why is that 2.7 version apparently did not accept *.tcl metadata file, it only accepted *.hwh file

I then fixed that and copied the code to boot.py on arty and it loaded perfectly.
I will try it on ebaz board now.

1 Like

boot.py is executed as a service, you won’t see the log with dmesg,

you can run systemctl status bootpy.service to check the log

But the reason why is that 2.7 version apparently did not accept *.tcl metadata file, it only accepted *.hwh file

That is correct, tcl support is deprecated since 2.6

Hi Mario

Good to know. Unfortunately it looks like it is not possible to configure the fpga through boot.py
the output of bootpy service returns:

â—Ź bootpy.service - Executing boot.py from the boot partitione[m
     Loaded: loaded (/lib/systemd/system/bootpy.service; enabled; vendor presete[me[7m>e[27m
     Active: inactive (dead)

restarting the service also is not possible, and all the errors in journalctl appear related to ethernet.

Hi @marioruiz
I managed to fix this issue. I did not delete sdbuild/build folder so i used petalinux_project to create new boot.bin file so that fpga will be programmed by u-boot.

Ethernet now works, and hostname is correct. I can ssh to the board without issue by just typing pynq. However jupyter website does not load.
I can see the correct IP.

 ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::644f:59ff:fefc:b3e5  prefixlen 64  scopeid 0x20<link>
        ether 66:4f:59:fc:b3:e5  txqueuelen 1000  (Ethernet)
        RX packets 248  bytes 21062 (21.0 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 315  bytes 85352 (85.3 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 26  base 0xb000

eth0:1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.2.99  netmask 255.255.255.0  broadcast 192.168.2.255
        ether 66:4f:59:fc:b3:e5  txqueuelen 1000  (Ethernet)
        device interrupt 26  base 0xb000

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 2423  bytes 173973 (173.9 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2423  bytes 173973 (173.9 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

but checking what the jupyter is doing I see something strange:

xilinx@pynq:~$ jupyter-notebook
[I 2021-12-13 02:39:25.348 LabApp] JupyterLab extension loaded from /usr/local/share/pynq-venv/lib/python3.8/site-pac       kages/jupyterlab
[I 2021-12-13 02:39:25.350 LabApp] JupyterLab application directory is /usr/local/share/pynq-venv/share/jupyter/lab
[I 02:39:26.315 NotebookApp] Serving notebooks from local directory: /home/xilinx
[I 02:39:26.316 NotebookApp] Jupyter Notebook 6.4.0 is running at:
[I 02:39:26.316 NotebookApp] http://localhost:8888/?token=05ce934c00c081e88e52caa4721f8b2212a57c739b6165e9
[I 02:39:26.317 NotebookApp]  or http://127.0.0.1:8888/?token=05ce934c00c081e88e52caa4721f8b2212a57c739b6165e9
[I 02:39:26.317 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation)       .
[W 02:39:26.382 NotebookApp] No web browser found: could not locate runnable browser.
[C 02:39:26.384 NotebookApp]

    To access the notebook, open this file in a browser:
        file:///home/xilinx/.local/share/jupyter/runtime/nbserver-1848-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/?token=05ce934c00c081e88e52caa4721f8b2212a57c739b6165e9
     or http://127.0.0.1:8888/?token=05ce934c00c081e88e52caa4721f8b2212a57c739b6165e9

I was confused by this at first because it appears in is running on port 8888, and localhost only. but it is the same on my working board.
however checking if jupyter is running shows that it isn’t.


systemctl status jupyter
jupyter.service - Jupyter Notebook Server
     Loaded: loaded (/lib/systemd/system/jupyter.service; enabled; vendor preset: enabled)
     Active: failed (Result: timeout) since Mon 2021-12-13 03:18:41 UTC; 50min ago
    Process: 232 ExecStart=/usr/local/bin/start_jupyter.sh (code=killed, signal=TERM)

Dec 13 03:18:32 pynq start_jupyter.sh[232]: Waiting for Jupyter
Dec 13 03:18:33 pynq start_jupyter.sh[232]: Waiting for Jupyter
Dec 13 03:18:34 pynq start_jupyter.sh[232]: Waiting for Jupyter
Dec 13 03:18:36 pynq start_jupyter.sh[232]: Waiting for Jupyter
Dec 13 03:18:37 pynq start_jupyter.sh[232]: Waiting for Jupyter
Dec 13 03:18:38 pynq start_jupyter.sh[232]: Waiting for Jupyter
Dec 13 03:18:39 pynq start_jupyter.sh[232]: Waiting for Jupyter
Dec 13 03:18:41 pynq systemd[1]: jupyter.service: start operation timed out. Terminating.
Dec 13 03:18:41 pynq systemd[1]: jupyter.service: Failed with result 'timeout'.
Dec 13 03:18:41 pynq systemd[1]: Failed to start Jupyter Notebook Server.

In the log files i see the :

Dec 13 04:27:28 pynq systemd[1]: Starting Jupyter Notebook Server...
Dec 13 04:27:44 pynq start_jupyter.sh[4633]: Waiting for Jupyter
Dec 13 04:27:45 pynq start_jupyter.sh[4633]: Waiting for Jupyter
Dec 13 04:27:46 pynq start_jupyter.sh[4633]: Waiting for Jupyter
Dec 13 04:27:48 pynq start_jupyter.sh[4633]: Waiting for Jupyter
.
.
.

This would stay like this forever.
I use “systemctl start jupyter” and after about a half a minute or a minute the service is started and i can connect to jupyter normally. But it would never start by itself.
Any idea how to go about debugging this?

Thank you for any help .

1 Like