# fpga demo from all open resource ## install depends ```bash sudo apt-get install build-essential clang bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev build-essential libboost-system-dev libboost-thread-dev libboost-program-options-dev libboost-test-dev libboost-iostreams-dev python3.9-dev libboost-iostreams-dev libeigen3-dev libudev-dev cmake python3-pip gcc gdb autoconf automake libtool libusb-dev libusb-1.0-0-dev python2.7-dev ``` ## install ecpdap for configuration to the flash ```bash curl https://sh.rustup.rs -sSf | sh # install catgo cargo install ecpdap # install ecpdap # Run ecpdap help for detailed usage. # install CMSIS-DAP probes driver sudo cp 99-cmsis-dap.rules /etc/udev/rules.d sudo udevadm control --reload ecpdap flash write xxx.bit # Write configuration to the flash ecpdap program xxx.bit # Configure with xxx.svf ecpdap flash erase # Erase flash ``` ## install verilator form source to use new version ``` git clone https://github.com/verilator/verilator # Only first time # Every time you need to build: unsetenv VERILATOR_ROOT # For csh; ignore error if on bash unset VERILATOR_ROOT # For bash cd verilator git pull # Make sure git repository is up-to-date git tag # See what versions exist #git checkout master # Use development branch (e.g. recent bug fixes) #git checkout stable # Use most recent stable release #git checkout v{version} # Switch to specified release version autoconf # Create ./configure script ./configure # Configure and create Makefile make -j `nproc` # Build Verilator itself (if error, try just 'make') sudo make install ``` ## install yosys ``` git clone https://github.com/YosysHQ/yosys make config-gcc make -j sudo make install ``` ## install Trellis for ECP5 devices support ``` git clone --recursive https://github.com/YosysHQ/prjtrellis \ && cd prjtrellis && cd libtrellis \ && cmake -DCMAKE_INSTALL_PREFIX=/usr/local . && make -j \ && sudo make install \ && cd ../../ ``` ## install nextpnr ``` git clone https://github.com/YosysHQ/nextpnr.git \ && cd nextpnr \ && cmake . -DARCH=ecp5 -DTRELLIS_INSTALL_PREFIX=/usr/local \ && make -j \ && sudo make install \ && cd .. ``` ## build openocd with DAP ```bash git clone https://github.com/signal11/hidapi.git \ && cd hidapi \ && ./bootstrap \ && ./configure \ && make -j \ && sudo make install \ && cd .. git clone https://github.com/riscv/riscv-openocd.git \ && cd riscv-openocd \ && ./bootstrap \ && ./configure --prefix=$RISCV --enable-cmsis-dap --enable-remote-bitbang --enable-jtag_vpi --enable-ftdi --enable-jlink \ && make \ && sudo make install \ && cd .. ``` ## test with office demo At /home/colin/develop/Colorlight-FPGA-Projects/demo/i5 ```bash ./../../tools/dapprog blink.svf ```