Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[VTA] pynq v2.1 -> v2.3 #1945

Merged
merged 4 commits into from Oct 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion apps/pynq_rpc/start_rpc_server.sh
Expand Up @@ -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
9 changes: 3 additions & 6 deletions cmake/modules/VTA.cmake
Expand Up @@ -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..")
Expand Down
2 changes: 1 addition & 1 deletion docs/vta/install.md
Expand Up @@ -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:
Expand Down
6 changes: 0 additions & 6 deletions vta/include/vta/driver.h
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions vta/python/vta/exec/rpc_server.py
Expand Up @@ -10,9 +10,9 @@
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
Expand Down Expand Up @@ -51,7 +51,8 @@ def ext_dev_callback():
@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)
Expand Down
31 changes: 0 additions & 31 deletions vta/src/pynq/pynq_driver.cc
Expand Up @@ -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);
}
5 changes: 0 additions & 5 deletions vta/src/pynq/pynq_driver.h
Expand Up @@ -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 */
Expand Down