PYNQ是使用Jupyter notebook服务器进行程序开发的,为了能使调试好的程序开机自动运行,需要将代码写入.py文件
代码如下:
from pynq.overlays.base import BaseOverlay
from pynq.lib.video import *
base = BaseOverlay(“base.bit”)
hdmi_in = base.video.hdmi_in
hdmi_out = base.video.hdmi_out
hdmi_in.configure()
hdmi_out.configure(hdmi_in.mode)
hdmi_in.start()
hdmi_out.start()
hdmi_in.tie(hdmi_out)
拷贝到linux系统目录下
在 PYNQ 板上,运行有一个文件共享服务:Samba。通过它,板子上的主目录可以作为网 络驱动器访问,同时你可以将文件在板子和电脑间传递。
在 Windows 下,访问 PYNQ 主目录你可以键入:
\pynq\xilinx # If connected to a Network/Router with DHCP
\192.168.2.99\xilinx # If connected to a Computer with a Static IP
或者在 Linux 下:
smb://pynq/xilinx # If connected to a Network/Router with DHCP
smb://192.168.2.99/xilinx # If connected to a Computer with a Static IP
设置开机启动
在/etc/rc.local文件中添加一行:
/opt/python3.6/bin/python3.6 /home/xilinx/hdmi.py #(我这里的py文件命名为hdmi)
上诉代码的意思是使用python3.6编译器运行hdmi.py文件
具体操作如下
vim /etc/rc.local
e #进入编辑模式
i #insert模式
将/opt/python3.6/bin/python3.6 /home/xilinx/hdmi.py键入
完成后按Esc退出编辑模式
:wq #保存退出
备注
PYNQ中安装的ubuntu管理混乱,python版本众多,Jupyter中应该是使用的python3.6版本,固所有的指令都要加上3.6才能正确运行,安装包也得pip3.6执行。