Updates and corrections based on the new nextpnr-xilinx-install script
[libreriscv.git] / HDL_workflow / nextpnr-xilinx.mdwn
1 # Installation instructions for Nextpnr-xilinx with Xilinx Artix7 100T Board
2
3 * <https://github.com/gatecat/nextpnr-xilinx>
4
5 ## Bugzilla page
6
7 * <https://bugs.libre-soc.org/show_bug.cgi?id=790>
8
9 ## Page under work
10
11 ## Setting up new debootstrap and chroot into it
12
13 Run the following if you wish to isolate the symbiflow build
14 from other software (reproducible builds) or use the schroot
15 auto-preparation script here:
16 <https://git.libre-soc.org/?p=dev-env-setup.git;a=blob;f=mk-deb-chroot;hb=HEAD>
17
18 export MY_CHROOT=/stable-chroot
19 mkdir $MY_CHROOT
20 debootstrap buster $MY_CHROOT http://deb.debian.org/debian/
21 mount -t proc proc $MY_CHROOT/proc
22 mount -t sysfs sysfs $MY_CHROOT/sys
23 mount -t devpts devpts $MY_CHROOT/dev/pts/
24 chroot $MY_CHROOT /bin/bash
25
26 ## Add Buster Backports Repo and Update
27
28 ""buster backports is needed for cmake""
29
30 cat << EOF > /etc/apt/sources.list.d/buster_backports.list
31 deb http://deb.debian.org/debian buster-backports main
32 EOF
33
34 ""oooo annoying, pin preferences for buster-backports""
35
36 cat << EOF > /etc/apt/preferences.d/99buster-backports
37 Package: *
38 Pin: release a=buster-backports
39 Pin-Priority: 900
40 EOF
41
42 ""upgrade to buster-backports""
43
44 apt-get update -y
45 apt-get upgrade -y
46
47 ## Download neccessary softwares
48
49 apt-get install -y libcurl3-gnutls/buster git/buster
50
51 git clone https://github.com/YosysHQ/yosys.git
52 git clone https://github.com/YosysHQ/abc.git
53 git clone https://github.com/f4pga/prjxray.git
54 git clone https://github.com/SymbiFlow/prjxray-db.git
55 git clone https://github.com/gatecat/nextpnr-xilinx.git
56
57 ## Steps to compile Yosys
58
59 ### Necessary software to install
60
61 apt-get install -y build-essential make g++ cmake bison flex python3 \
62 clang libreadline-dev gawk tcl-dev libffi-dev pkg-config zlib1g-dev \
63 libboost-system-dev libboost-python-dev libboost-filesystem-dev
64
65 ### Build Yosys
66
67 cd abc
68 git checkout 00b674d5b3ccefc7f2abcbf5b650fc14298ac549
69 cd ../yosys
70 git checkout 6318db6152d053244adb316fda6e01a32a4f3c72
71 ln -s ../abc .
72 make -j $(nproc) PREFIX=/usr/local/nx
73 make PREFIX=/usr/local/nx install
74 export PATH=/usr/local/nx/bin:$PATH
75 cd ..
76
77 ## Steps to compile prjxray
78
79 ### Necessary software to install
80
81 apt-get install -y python3-pip
82
83 ### Build prjxray
84
85 cd prjxray
86 git checkout 18b92012afe2b03f3f975a78c4372c74b60dca0c
87 git submodule update --init --recursive
88 mkdir build; cd build
89 cmake -DCMAKE_INSTALL_PREFIX=/usr/local/nx ..
90 make -j$(nproc)
91 make install
92 install -d -m 0755 /usr/local/nx/build/tools
93 install -m 0755 tools/{bitread,bittool,frame_address_decoder,gen_part_base_yaml,segmatch,xc7frames2bit,xc7patch} \
94 /usr/local/nx/build/tools
95 cd ..
96 cp -dpr utils /usr/local/nx
97 sed -i -e '/^# Vivado /,$d' /usr/local/nx/utils/environment.sh
98 pip3 install .
99 cd ..
100
101 ## Steps to compile prjxray-db
102
103 ### Install prjxray-db
104
105 cd prjxray-db
106 git archive --format=tar --prefix=database/ \
107 0a0addedd73e7e4139d52a6d8db4258763e0f1f3 | \
108 tar -C /usr/local/nx -xf -
109 cd ..
110
111 ## Steps to compile nextpnr-xilinx
112
113 ### Necessary software to install
114
115 apt-get install -y libboost-thread-dev libboost-iostreams-dev \
116 libboost-program-options-dev libeigen3-dev
117
118 ### Build nextpnr-xilinx
119
120 cd nextpnr-xilinx
121 git checkout 565588a69ea95a52f7c7592f4ed81d9bef6cfb60
122 cmake -DARCH=xilinx -DBUILD_GUI=OFF -DCMAKE_INSTALL_PREFIX=/usr/local/nx .
123 make -j$(nproc)
124 make install
125 python3 xilinx/python/bbaexport.py --device xc7a100tcsg324-1 \
126 --bba xilinx/xc7a100t.bba
127 ./bbasm --l xilinx/xc7a100t.bba xilinx/xc7a100t.bin
128 install -d -m 0755 /usr/local/nx/share/xilinx
129 install -m 0755 xilinx/xc7a100t.bin /usr/local/nx/share/xilinx
130 export XRAY_DIR=/usr/local/nx
131
132 # build attosoc example; it should build attosoc.bit as final bitstream
133
134 cd xilinx/examples
135 cp -dpr arty-a35 arty-a100
136 cd arty-a100
137 sed -i -e 's@xc7a35tcsg324-1@xc7a100tcsg324-1@g' \
138 -e 's@../../../nextpnr-xilinx@nextpnr-xilinx@g' \
139 -e 's@../../xc7a35t.bin@/usr/local/nx/share/xilinx/xc7a100t.bin@g' \
140 attosoc.sh
141 ./attosoc.sh
142
143 # see file attosoc.bit; it is the bitstream file and if built then success