diff --git a/apps/pynq_rpc/start_rpc_server.sh b/apps/pynq_rpc/start_rpc_server.sh index 30b3c9a90d6b500e4e5ed5bda5c472ef4a5a3c3f..2dce74472414bf8c50e0544b2e7dc08482a355dc 100755 --- a/apps/pynq_rpc/start_rpc_server.sh +++ b/apps/pynq_rpc/start_rpc_server.sh @@ -2,4 +2,5 @@ PROJROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../../" && pwd )" export PYTHONPATH=${PYTHONPATH}:${PROJROOT}/python:${PROJROOT}/vta/python -python -m vta.exec.rpc_server +export PYTHONPATH=${PYTHONPATH}:/home/xilinx/pynq +python3 -m vta.exec.rpc_server diff --git a/cmake/modules/VTA.cmake b/cmake/modules/VTA.cmake index 43fb700203c707e8584b0c7cf09aa05c05ea2ce4..ea5bb5ae916a3056ad987edff3486359eedb2372 100644 --- a/cmake/modules/VTA.cmake +++ b/cmake/modules/VTA.cmake @@ -38,13 +38,10 @@ elseif(PYTHON) set_target_properties(vta PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") endif(APPLE) - # PYNQ rules + # PYNQ rules for Pynq v2.3 if(${VTA_TARGET} STREQUAL "pynq") - find_library(__sds_lib NAMES sds_lib PATHS /usr/lib) - find_library(__dma_lib NAMES dma PATHS - "/opt/python3.6/lib/python3.6/site-packages/pynq/drivers/" - "/opt/python3.6/lib/python3.6/site-packages/pynq/lib/") - target_link_libraries(vta ${__sds_lib} ${__dma_lib}) + find_library(__cma_lib NAMES cma PATH /usr/lib) + target_link_libraries(vta ${__cma_lib}) endif() else() message(STATUS "Cannot found python in env, VTA build is skipped..") diff --git a/docs/vta/install.md b/docs/vta/install.md index ca5969386e8015c71db697fe46b77e80b28e1bd2..4a05f9fd83186de5142ddc97fb6061769ee30e23 100644 --- a/docs/vta/install.md +++ b/docs/vta/install.md @@ -67,7 +67,7 @@ This guide covers the following themes: Setup your Pynq board based on the [Pynq board getting started tutorial](http://pynq.readthedocs.io/en/latest/getting_started.html). You should follow the instructions up to and including the *Turning On the PYNQ-Z1* step (no need to pursue the tutorial beyond this point). -* Make sure that you've downloaded the latest Pynq image, [PYNQ-Z1 v2.1](http://pynq-testing.readthedocs.io/en/image_v2.2/getting_started/pynq_image.html) (released 21 Feb 2018), and have imaged your SD card with it (we recommend the free [Etcher](https://etcher.io/) program). +* Make sure that you've downloaded the latest Pynq image, [PYNQ-Z1 v2.3](http://www.pynq.io/board.html) (released October 3rd 2018), and have imaged your SD card with it (we recommend the free [Etcher](https://etcher.io/) program). * For this test setup, follow the ["Connect to a Computer"](http://pynq.readthedocs.io/en/latest/getting_started.html#connect-to-a-computer) Ethernet setup instructions. To be able to talk to the board, make sure to [assign your computer a static IP address](http://pynq.readthedocs.io/en/latest/appendix.html#assign-your-computer-a-static-ip) Once the board is powered on and connected to your development machine, try connecting to it to make sure you've properly set up your Pynq board: diff --git a/vta/include/vta/driver.h b/vta/include/vta/driver.h index 269728c51cda8b86202baaf758508e91e451272c..588819a5fe6b653fefc3c84906e4128de2832f68 100644 --- a/vta/include/vta/driver.h +++ b/vta/include/vta/driver.h @@ -95,12 +95,6 @@ void VTAFlushCache(vta_phy_addr_t buf, int size); */ void VTAInvalidateCache(vta_phy_addr_t buf, int size); -/*! - * \brief Programming the bit stream on the FPGA. - * \param bitstream The path to the bit stream file. - */ -void VTAProgram(const char* bitstream); - #ifdef __cplusplus } #endif diff --git a/vta/python/vta/exec/rpc_server.py b/vta/python/vta/exec/rpc_server.py index 233d37ccad7c8b3462340d2892c45ad4d8e3061d..768f6a00d4518754d0f0b6cd8b14c4b9727c7c05 100644 --- a/vta/python/vta/exec/rpc_server.py +++ b/vta/python/vta/exec/rpc_server.py @@ -10,9 +10,9 @@ import os import ctypes import json import tvm -from tvm._ffi.base import c_str from tvm import rpc from tvm.contrib import cc +from pynq import Bitstream from ..environment import get_env from ..pkg_config import PkgConfig @@ -51,7 +51,8 @@ def server_start(): @tvm.register_func("tvm.contrib.vta.init", override=True) def program_fpga(file_name): path = tvm.get_global_func("tvm.rpc.server.workpath")(file_name) - load_vta_dll().VTAProgram(c_str(path)) + bitstream = Bitstream(path) + bitstream.download() logging.info("Program FPGA with %s", file_name) @tvm.register_func("tvm.rpc.server.shutdown", override=True) diff --git a/vta/src/pynq/pynq_driver.cc b/vta/src/pynq/pynq_driver.cc index 1909ed35c56215deae27eadc556491e998007ca0..5c597d918b5f5b3c7de6011cb1ebfd5e72c82e65 100644 --- a/vta/src/pynq/pynq_driver.cc +++ b/vta/src/pynq/pynq_driver.cc @@ -136,34 +136,3 @@ int VTADeviceRun(VTADeviceHandle handle, return static_cast<VTADevice*>(handle)->Run( insn_phy_addr, insn_count, wait_cycles); } - -void VTAProgram(const char* bitstream) { - int elem; - FILE *src, *dst, *partial; - partial = fopen(VTA_PYNQ_BS_IS_PARTIAL, "w"); - if (partial == NULL) { - printf("Cannot open partial config file %s\n", VTA_PYNQ_BS_IS_PARTIAL); - fclose(partial); - exit(1); - } - fputc('0', partial); - fclose(partial); - src = fopen(bitstream, "rb"); - if (src == NULL) { - printf("Cannot open bitstream %s\n", bitstream); - exit(1); - } - dst = fopen(VTA_PYNQ_BS_XDEVCFG, "wb"); - if (dst == NULL) { - printf("Cannot open device file %s\n", VTA_PYNQ_BS_XDEVCFG); - fclose(dst); - exit(1); - } - elem = fgetc(src); - while (elem != EOF) { - fputc(elem, dst); - elem = fgetc(src); - } - fclose(src); - fclose(dst); -} diff --git a/vta/src/pynq/pynq_driver.h b/vta/src/pynq/pynq_driver.h index 7aba00441abdf222ffd7f96208de3a28ec5bf5a8..4a0b03ac25bd2fc52c3d351ac4a68c554755c782 100644 --- a/vta/src/pynq/pynq_driver.h +++ b/vta/src/pynq/pynq_driver.h @@ -37,11 +37,6 @@ void VTAUnmapRegister(void *vta, size_t length); void VTAWriteMappedReg(void* base_addr, uint32_t offset, uint32_t val); uint32_t VTAReadMappedReg(void* base_addr, uint32_t offset); -/*! \brief (Pynq only) Partial bitstream status file path */ -#define VTA_PYNQ_BS_IS_PARTIAL "/sys/devices/soc0/amba/f8007000.devcfg/is_partial_bitstream" -/*! \brief (Pynq only) Bitstream destination file path */ -#define VTA_PYNQ_BS_XDEVCFG "/dev/xdevcfg" - /*! \brief (Pynq only) Path to /dev/mem */ #define VTA_PYNQ_DEV_MEM_PATH "/dev/mem" /*! \brief (Pynq only) MMIO driver constant */