summaryrefslogtreecommitdiffstats
path: root/meta-xilinx-pynq/recipes-devtool/python
diff options
context:
space:
mode:
authorManjukumar Matha <manjukumar.harthikote-matha@xilinx.com>2019-09-09 12:13:21 -0700
committerSai Hari Chandana Kalluri <chandana.kalluri@xilinx.com>2019-12-13 13:27:17 -0800
commiteebb98f0a10271ed6f57c1934f9e1120031c5344 (patch)
tree8bfdaff3b6fdc45fbfc26ff433aa8c8b18efcc02 /meta-xilinx-pynq/recipes-devtool/python
parentcd16edc211bfbc365eb7dc8fe5d97e650baa9ece (diff)
downloadmeta-xilinx-eebb98f0a10271ed6f57c1934f9e1120031c5344.tar.gz
meta-xilinx-pynq: Add layer to support PYNQ
This layer collects Yocto recipes required to build and run PYNQ based examples using jupyter-notebooks on Zynq and ZU+ SoC's. PYNQ is an open-source project from Xilinx that makes it easy to design embedded systems with Zynq All Programmable Systems on Chips (APSoCs). Using the Python language and libraries, designers can exploit the benefits of programmable logic and microprocessors in Zynq to build more capable and exciting embedded systems. See https://github.com/Xilinx/PYNQ for more details and examples Signed-off-by: Sai Hari Chandana Kalluri <chandana.kalluri@xilinx.com> Signed-off-by: Peter Ogden <ogden@xilinx.com> Signed-off-by: Manjukumar Matha <manjukumar.harthikote-matha@xilinx.com>
Diffstat (limited to 'meta-xilinx-pynq/recipes-devtool/python')
-rw-r--r--meta-xilinx-pynq/recipes-devtool/python/python-pynq.inc53
-rw-r--r--meta-xilinx-pynq/recipes-devtool/python/python3-pynq/pl_server_init109
-rw-r--r--meta-xilinx-pynq/recipes-devtool/python/python3-pynq_2.4.bb3
3 files changed, 165 insertions, 0 deletions
diff --git a/meta-xilinx-pynq/recipes-devtool/python/python-pynq.inc b/meta-xilinx-pynq/recipes-devtool/python/python-pynq.inc
new file mode 100644
index 00000000..fa717f45
--- /dev/null
+++ b/meta-xilinx-pynq/recipes-devtool/python/python-pynq.inc
@@ -0,0 +1,53 @@
1SUMMARY = "Xilinx PYNQ Library"
2HOMEPAGE = "http://pynq.io"
3LICENSE = "MIT"
4LIC_FILES_CHKSUM = "file://LICENSE;md5=b42e39ad2ddbad7e8ad47f3eee6feff5"
5
6RDEPENDS_${PN} += "\
7 ${PYTHON_PN}-core \
8 ${PYTHON_PN}-asyncio \
9 ${PYTHON_PN}-cffi \
10 ${PYTHON_PN}-json \
11 ${PYTHON_PN}-math \
12 ${PYTHON_PN}-mmap \
13 ${PYTHON_PN}-multiprocessing \
14 ${PYTHON_PN}-numpy \
15 ${PYTHON_PN}-pycparser \
16 ${PYTHON_PN}-resource \
17 ${PYTHON_PN}-setuptools \
18 ${PYTHON_PN}-threading \
19 ${PYTHON_PN}-xml \
20 lmsensors-libsensors \
21 libdrm \
22 libcma \
23 pynq-overlay \
24 "
25
26inherit update-rc.d xilinx-pynq
27
28DEPENDS += " libdrm boost libcma"
29
30PYNQBRANCH ?= "image_v2.4"
31SRCBRANCHARG = "${@['nobranch=1', 'branch=${PYNQBRANCH}'][d.getVar('PYNQBRANCH', True) != '']}"
32PYNQURI ?= "git://github.com/Xilinx/PYNQ.git;protocol=https"
33
34SRC_URI = "${PYNQURI};${SRCBRANCHARG} \
35 file://pl_server_init \
36 "
37SRCREV ?= "3d659d374701b7c34fa702e7aa23f71f9113f826"
38
39FILESEXTRAPATHS_prepend := "${THISDIR}:"
40S = "${WORKDIR}/git"
41
42INSANE_SKIP_${PN} = "staticdev"
43
44INITSCRIPT_PACKAGES = "${PN}"
45INITSCRIPT_NAME = "pl_server_init"
46INITSCRIPT_PARAMS = "start 99 S ."
47
48do_install_append() {
49 install -d ${D}${INIT_D_DIR}
50 install -m 755 ${WORKDIR}/pl_server_init ${D}${INIT_D_DIR}/pl_server_init
51}
52
53FILES_${PN} += " ${INIT_D_DIR}/pl_server_init "
diff --git a/meta-xilinx-pynq/recipes-devtool/python/python3-pynq/pl_server_init b/meta-xilinx-pynq/recipes-devtool/python/python3-pynq/pl_server_init
new file mode 100644
index 00000000..8b13ae1f
--- /dev/null
+++ b/meta-xilinx-pynq/recipes-devtool/python/python3-pynq/pl_server_init
@@ -0,0 +1,109 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides:
4# Required-Start: $remote_fs $syslog
5# Required-Stop: $remote_fs $syslog
6# Default-Start: 2 3 4 5
7# Default-Stop: 0 1 6
8# Short-Description: Start daemon at boot time
9# Description: Enable service provided by daemon.
10### END INIT INFO
11
12dir=""
13cmd="start_pl_server.py"
14user=""
15
16name="pl_server"
17pid_file="/var/run/$name.pid"
18stdout_log="/var/log/$name.log"
19stderr_log="/var/log/$name.err"
20
21get_pid() {
22 cat "$pid_file"
23}
24
25is_running() {
26 [ -f "$pid_file" ] && (ps -o"pid" | grep '^ '`get_pid`'$') > /dev/null 2>&1
27}
28
29install_overlay() {
30if [ ! -e '/sys/kernel/config/device-tree/overlays/pynq' ]; then
31 modprobe uio_pdrv_genirq
32 if [ ! -e /proc/device-tree/__symbols__ ]; then
33 mkdir /sys/kernel/config/device-tree/overlays/pynq-symbols
34 cat /lib/firmware/pynq-symbols.dtbo > /sys/kernel/config/device-tree/overlays/pynq-symbols/dtbo
35 fi
36 mkdir /sys/kernel/config/device-tree/overlays/pynq
37 cat /lib/firmware/pynq.dtbo > /sys/kernel/config/device-tree/overlays/pynq/dtbo
38fi
39}
40
41case "$1" in
42 start)
43 if is_running; then
44 echo "Already started"
45 else
46 echo "Starting $name"
47 cd "$dir"
48 install_overlay
49 $cmd >> "$stdout_log" 2>> "$stderr_log" &
50 echo $! > "$pid_file"
51 if ! is_running; then
52 echo "Unable to start, see $stdout_log and $stderr_log"
53 exit 1
54 fi
55 fi
56 ;;
57 stop)
58 if is_running; then
59 echo -n "Stopping $name.."
60 kill `get_pid`
61 for i in 1 2 3 4 5 6 7 8 9 10
62 # for i in `seq 10`
63 do
64 if ! is_running; then
65 break
66 fi
67
68 echo -n "."
69 sleep 1
70 done
71 echo
72
73 if is_running; then
74 echo "Not stopped; may still be shutting down or shutdown may have failed"
75 exit 1
76 else
77 echo "Stopped"
78 if [ -f "$pid_file" ]; then
79 rm "$pid_file"
80 fi
81 fi
82 else
83 echo "Not running"
84 fi
85 ;;
86 restart)
87 $0 stop
88 if is_running; then
89 echo "Unable to stop, will not attempt to start"
90 exit 1
91 fi
92 $0 start
93 ;;
94 status)
95 if is_running; then
96 echo "Running"
97 else
98 echo "Stopped"
99 exit 1
100 fi
101 ;;
102 *)
103 echo "Usage: $0 {start|stop|restart|status}"
104 exit 1
105 ;;
106esac
107
108exit 0
109
diff --git a/meta-xilinx-pynq/recipes-devtool/python/python3-pynq_2.4.bb b/meta-xilinx-pynq/recipes-devtool/python/python3-pynq_2.4.bb
new file mode 100644
index 00000000..5a904c8f
--- /dev/null
+++ b/meta-xilinx-pynq/recipes-devtool/python/python3-pynq_2.4.bb
@@ -0,0 +1,3 @@
1inherit pypi setuptools3
2require python-pynq.inc
3